cancel
Showing results for 
Search instead for 
Did you mean: 

Using JCo as an RFCServer in a J2EE Container (Threading Issue)

Former Member
0 Kudos

Hello,

I want to use JCo as an RFCServer in a J2EE Container

(e.g. JBoss, BEA WLS or WAS6.40).

Threrefore I use a the JCo.Server class

as shown in Example5 in the JCo Examples.

But the JCo.Server class starts a thread (JCo.ServerThread) for each Server(Listener).

According to the J2EE specs it is not allowed

to start (user) threads in a J2EE Container,

because the container does the whole thread

manangement/lifecycle.

If JCo creates threads on its own, this might

lead to erros. For Example: BEA WLS stores

information in ThreadLocal variables and if you

call a SessionBean from the JCoServer.handleRequest method

the Container will (perhaps) fail, because the

thread created by JCo does not have the ThreadLocals

needed by the container.

I know that there is the IServerThread interface in JCo,

but I don't know how to use it in a J2EE Container.

What is the correct way to implement a JCo Server

in a J2EE container?

Does anyone know a working solution of a JCo Server

in the BEA Application Server?

Thanks,

Joachim

Accepted Solutions (0)

Answers (2)

Answers (2)

SidBhattacharya
Product and Topic Expert
Product and Topic Expert
0 Kudos

SAP JCo Rfc Provider Service provides help with making outbound calls from SAP to Java. To use this service you need to develop a stateless session bean and provide a processFunction(JCO.Function function) method in that. The JNDI name of the bean should match the function module name. This works for SAP WAS only.

For other app servers you can start up JCO.Server threads in the web Container from a Servlet. It doesnt violate the spec, though these threads are not managed by the container.

The correct way would have been JCA but again that doesnt have support for outbound( from EIS to Java) calls. Hopefully that will change in the future so that we have a unified API for accessing EIS' (both inbound and outbound).

Former Member
0 Kudos

Thanks for your comment,

I know that i can create "conforming" threads in the

J2EE Container (via Servlet or via Timer API).

But how do I tell JCo.Server to use this threads?

Joachim

SidBhattacharya
Product and Topic Expert
Product and Topic Expert
0 Kudos

You can register multiple instances of JCO.Server thread with SAP system and within each JCO.Server thread instance you can create/manage threads for further processing.

Former Member
0 Kudos

Joachim,

As you wrote, it may not be a good idea to use JCO.Server's inside a J2EE container; i suggest you to build an 'adapter' for this purpose.

An adapter is a program that can listen for any type of event and, once the event has been identified (type and specific data), the adapter will handle it accordingly.

In this case, you can create a program that starts a JCO.Server (as in Example5) and use JMS to send messages (built from the info gathered from the JCO.Function call) to a Message Driven Bean in the J2EE container.

Hope this helps.

RaTB

Former Member
0 Kudos

Hi,

I'm also interested in a solution for the problem mentioned by Joachim.

The JMS-based solution proposed by Ramon sounds good for starting asynchronous actions in the J2EE container. But is it also applicable to synchronous request/reply-calls to EJBs, especially if the JCO server should use its multi-threading capability ?

Thanx in advance,

Thomas