cancel
Showing results for 
Search instead for 
Did you mean: 

JCA: Exception with getConnection()

Former Member
0 Kudos

Hi,

Fot fetching data from R3 within my webservice I'm using the JCA framework.

Everything is working and I retrieve data back from the R3 system.

But, when I check the logging I notice the following exception everytime I execute the webservice method:

#1.5 #001635C4B388007700004263000078C900046080420ABDB7#1232003886923#com.sap.engine.services.security#com.company/compprojectsite~archive#com.sap.engine.services.security#Guest#0##n/a##a7eb6930e2d411dd9a87001635c4b388#SAPEngine_Application_Thread[impl:3]_6##0#0#Path##Java###Exception #1#: Crypt service is locked.

java.lang.Exception

at com.sap.exception.BaseExceptionInfo.traceAutomatically(BaseExceptionInfo.java:1175)

at com.sap.exception.BaseExceptionInfo.<init>(BaseExceptionInfo.java:263)

at com.sap.engine.services.security.exceptions.BaseSecurityException.<init>(BaseSecurityException.java:203)

at com.sap.engine.services.security.crypt.CryptographyModuleCreator.getCipher(CryptographyModuleCreator.java:53)

at com.sap.engine.services.security.server.CryptographyContextImpl.getCipher(CryptographyContextImpl.java:63)

at com.sap.engine.services.userstore.UserContextImpl.decode(UserContextImpl.java:674)

at com.sap.engine.services.userstore.UserInfoImpl.engineReadUserProperty(UserInfoImpl.java:346)

at com.sap.engine.services.userstore.UserContextImpl.engineFillSubject(UserContextImpl.java:530)

at com.sap.engine.services.security.userstore.context.UserContext.fillSubject(UserContext.java:259)

at com.sap.engine.services.security.server.jaas.mapping.ConfiguredIdentityMappingLoginModule.initialize(ConfiguredIdentityMappingLoginModule.java:55)

at com.sap.engine.services.security.login.LoginModuleLoggingWrapperImpl.initialize(LoginModuleLoggingWrapperImpl.java:164)

at com.sap.engine.services.security.login.LoginContextFactory.initializeLoginContext(LoginContextFactory.java:186)

at com.sap.engine.services.security.login.FastLoginContext.login(FastLoginContext.java:144)

at com.sap.engine.services.connector.jca.ConnectorPrivilegedAction.run(ConnectorPrivilegedAction.java:44)

at java.security.AccessController.doPrivileged(AccessController.java:246)

at com.sap.engine.services.connector.jca.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:249)

at com.sap.mw.jco.jra.JRA$ConnectionFactoryImpl.getConnection(JRA.java:3953)

at com.sap.mw.jco.jra.JRA$ConnectionFactoryImpl.getConnection(JRA.java:3921)

at com.company.project.site.commons.helpers.handlers.RfcHandler.executeRfcModule(RfcHandler.java:63)

at com.company.project.site.commons.helpers.handlers.profiles.GetEmailHandler.execute(GetEmailHandler.java:50)

at com.company.project.site..beans.profiles.ProfilesBean.getEmail(ProfilesBean.java:228)

at com.company.project.site..beans.profiles.ProfilesLocalLocalObjectImpl0_0.getEmail(ProfilesLocalLocalObjectImpl0_0.java:535)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60)

at java.lang.reflect.Method.invoke(Method.java:391)

at com.sap.engine.services.webservices.runtime.EJBImplementationContainer.invokeMethod(EJBImplementationContainer.java:126)

at com.sap.engine.services.webservices.runtime.RuntimeProcessor.process(RuntimeProcessor.java:157)

at com.sap.engine.services.webservices.runtime.RuntimeProcessor.process(RuntimeProcessor.java:79)

at com.sap.engine.services.webservices.runtime.servlet.ServletDispatcherImpl.doPost(ServletDispatcherImpl.java:92)

at SoapServlet.doPost(SoapServlet.java:51)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:386)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:364)

at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:1039)

at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:265)

at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)

at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:175)

at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)

at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)

at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)

at java.security.AccessController.doPrivileged(AccessController.java:219)

at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:102)

at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:172)

#

The RfcHandler-class is part of my framework.

Within this RfcHandler I'm building the connection like this:

private static final Location logger = Location.getLocation(RfcHandler.class);

private ConnectionFactory connectionfactory;

public RfcHandler() throws NamingException, ResourceException {

this("java:comp/env/eis/SAPJRAFactory");

}

public RfcHandler(String dataSource) throws NamingException, ResourceException {

GeneralLogHandler.logLine(logger, "Create connection-object from datasource: " +dataSource);

InitialContext initialcontext = new InitialContext();

connectionfactory = (ConnectionFactory) initialcontext.lookup(dataSource);

GeneralLogHandler.logLine(logger, "Successfully created connection-object from datasource: " +dataSource);

}

// Handle the rfc-transactions.

public MappedRecord executeRfcModule(String rfcName, HashMap valueMap) throws ResourceException, SQLException {

GeneralLogHandler.logLine(logger, "Execute RFC-module: " +rfcName);

Connection connection = null;

Interaction interaction = null;

MappedRecord output = null;

try {

if (connection == null) {

connection = connectionfactory.getConnection();

}

RecordFactory recordFactory = connectionfactory.getRecordFactory();

MappedRecord input = recordFactory.createMappedRecord(rfcName);

processInputRecord(input, valueMap);

interaction = connection.createInteraction();

output = (MappedRecord) interaction.execute(null, input);

}

finally {

closeConnections(interaction, connection);

}

GeneralLogHandler.logLine(logger, "Successfully executed RFC-module: " +rfcName);

return output;

}

The closeConnections is raising the followin exception:

Exception Message: Connection handle is already closed and no longer associated with a managed connection#

The method: closeConnection();

private void closeConnections(Interaction interaction, Connection connection) {

GeneralLogHandler.logLine(logger, "Closing the connections");

if (interaction != null) {

try {

interaction.close();

interaction = null;

GeneralLogHandler.logLine(logger, "Successfully closed the interaction");

}

catch (ResourceException e) {

GeneralLogHandler.logLine(logger, "Exception caught while closing the interaction");

GeneralLogHandler.logLine(logger, "Exception Message: " +e.getMessage());

interaction = null;

}

}

if (connection != null) {

try {

connection.close();

connection = null;

GeneralLogHandler.logLine(logger, "Successfully closed the connection");

}

catch (ResourceException e) {

GeneralLogHandler.logLine(logger, "Exception caught while closing the connection");

GeneralLogHandler.logLine(logger, "Exception Message: " +e.getMessage());

connection = null;

}

}

}

I'v searched SDN and used google to search for this specific Exception but haven't found anything usefull.

Does anyone has a clue?

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Check these links,

/message/34320#34320 [original link is broken]

/message/832446#832446 [original link is broken]

Regards,

Sunaina Reddy T

ravindra_bollapalli2
Active Contributor
0 Kudos

hi

this may be the one of the reason for getting error message

check the note -- abap user authentication

http://help.sap.com/saphelp_nw04/helpdata/en/64/351941edd5ef23e10000000a155106/frameset.htm

http://help.sap.com/saphelp_nw04s/helpdata/en/f6/daea401675752ae10000000a155106/frameset.htm

let me know u need any further data

bvr