cancel
Showing results for 
Search instead for 
Did you mean: 

strange error during runtime of custom JCA adapter

Former Member
0 Kudos

Hi all,

we're about developing an JCA adapter for XI. Therefore, we originally derrived SAP's sample adapter. During startup, the adapter's main class (SPIManagedConnectionFactory) is starting a thread for outbound processing, which perodically checks for unsent messages in the database via a SessionBean.

Everything is working fine, but after (I guess) two days, the instantiation of the SessionBean starts to fail and with this, the thread doesn't work any more. After a restart of the adapter, everything's fine again.

The call of the SessionBean is done via it's local interfaces.

Here's the exception's stack trace:

com.sap.engine.services.ejb.exceptions.BaseEJBException: Exception in method getUnsentMessages.
	at xi.adapter.messageDB.MessageServiceLocalLocalObjectImpl40.getUnsentMessagesWithSendTimeReached(MessageServiceLocalLocalObjectImpl40.java:1155)
	at xi.adapter.outbound.AdapterOutboundProcessor.sendUnsentMessages(AdapterOutboundProcessor.java:221)
	at xi.adapter.outbound.scheduler.OutboundMessageScheduler.run(OutboundMessageScheduler.java:66)
Caused by: com.sap.engine.services.ejb.exceptions.BaseRuntimeException: Cannot create an instance of the stateless bean.
	at com.sap.engine.services.ejb.session.stateless_sp5.BeanFactory.getActiveBean(BeanFactory.java:192)
	at com.sap.engine.services.ejb.session.stateless_sp5.StatelessContainerFP.getActiveBean(StatelessContainerFP.java:183)
	at xi.adapter.messageDB.MessageServiceLocalLocalObjectImpl40.getUnsentMessages(MessageServiceLocalLocalObjectImpl40.java:1146)
	... 2 more
Caused by: com.sap.engine.services.connector.exceptions.BaseRuntimeException: Resource system and application components cannot be used in system threads.
	at com.sap.engine.services.connector.jca.ResourceSetContextObject.popRecord(ResourceSetContextObject.java:101)
	at com.sap.engine.services.connector.resource.impl.ResourceContextImpl.exitMethod(ResourceContextImpl.java:154)
	at com.sap.engine.services.ejb.session.stateless_sp5.BeanFactory.createObject(BeanFactory.java:141)
	at com.sap.engine.services.ejb.util.pool.ContainerPoolImpl.doResizeOneStepUp(ContainerPoolImpl.java:374)
	at com.sap.engine.services.ejb.util.pool.ContainerPoolImpl.ensureNotEmpty(ContainerPoolImpl.java:343)
	at com.sap.engine.services.ejb.util.pool.ContainerPoolImpl.pop(ContainerPoolImpl.java:291)
	at com.sap.engine.services.ejb.session.stateless_sp5.BeanFactory.getActiveBean(BeanFactory.java:188)
	... 4 more

Does anybody has an idea about this behavior. Help is - as always - highly appreciated and will be rewarded.

Thank you in advance!!!

Kind regards,

Matthias

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi again,

this morning, I had that error again, and I started analyzing the logs:

The adapter had worked properly until the system was shut down for backup yesterday evening. After restart of the system, the adapter was also started but the EJB calls started failing again.

After restarting the adapter from Visual Admin / Connector Contaier, everything's working fine again.

Does anybody have any clue? Please help...

Cheers,

Matthias

Former Member
0 Kudos

Easy question, difficult answer:

What is different in the restart procedure

a)when the system gets restarted after backup

b)when the system is restarted via the VisualAdmin/ connector container

Note: It could be a timing thing(add a sleep xxx in the startup script), or a sequence thing... etc...

Enjoy

Former Member
0 Kudos

Hello FJ,

thanks for your reply. Good idea, I will ask the admins for executing some system restart scenarios.

It shouldn't be a timing issue, because the periodic thread is trying to instantiating the EJB at each run. And there's already a wait at startup of the thread, because we had this timing issue formerly.

Cheers,

Matthias

Former Member
0 Kudos

OK, I've just restarted the J2EE Server Node, and I'm running into that problems again.

The EJB call is done via its local interface. In the JNDI registry the bean is located below localejbs. Is it possible that localejbs will be initialized later on, or do they have to be initialized manually?

Thanks for your replies.

Matthias

nikolai_tankov
Explorer
0 Kudos

Hi Matthias,

Which version of the server you are using?

Could you send whole stack trace and also traces from the log file that are before this StackTrace.

Best regards,

Nikolai.

Message was edited by: Nikolai Tankov

Former Member
0 Kudos

Nikolai,

thanks for your helpful answer. Our XI is currently running under WebAS 6.40. XI is version 3.0 SP 16 (still).

The WorkManager you mentioned could fix the problem, but my adapter is also still in JCA 1.0.

Is it possible to use WorkManager also in JCA 1.0? Does it make sense to do a migration to 1.5?

Thank you again,

Matthias

Former Member
0 Kudos

Ok, finally I could fix that problem:

As Nikolai said (and unfortunately removed with editing his statement), we used thread.start() in order to run that scheduling thread. Instead of this, it is required to use class SAPAdapterResources for starting threads.

Fixing the problem was as easy as reading the comment in SampleAdapter's SPIManagedConnectionFactory )

Position CS_THSTR: /* XI AF ra's MUST NOT use Java native threads

SAPAdapterResources msRes;
ctx = new InitialContext();
Object res = ctx.lookup("SAPAdapterResources");
msRes = (SAPAdapterResources)res;
msRes.startRunnable(thread);

Thank you all!

Cheers,

Matthias

Answers (0)