on 02-22-2005 12:59 PM
Hi,
Can someone help me to get a connection to a SAP system using JCA.
I'm using WAS 6.4 SP9.
The code below is the code I used.
Hashtable env1 = new Hashtable();
env1.put(
Context.INITIAL_CONTEXT_FACTORY,
"com.sap.engine.services.jndi.InitialContextFactoryImpl");
env1.put(Context.PROVIDER_URL, "yar2:50004");
Context context = new InitialContext(env1);
Object obj = (Object)context.lookup("deployedAdapters/SAPFactory");
int i = 43;
ConnectionFactory connectionFactory = (ConnectionFactory) obj;
The code below works. But I get a "ClassCastException" when I want to change the object to a connectionFactory.
On my build path the following jar is included.
Connector.jar.
I wan't to use this code in a EJB.
Help
Thanx Vladimir Pavlov,
But unfortunately it didn't help me any further. I can't set the properties.
Of the connection and I can't find any implementation of the Interface ConnectionSpec.
The jar file you mentioned was deprecated so I don't want to use that one.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanx Ivaylo Ivanov,
I now do get a instance ConnectionFactory but now I have to configure it to get the right connection from the Factory. This is in someway possible by implementing the Interface ConnectionSpec.
Is there a implemenation of this Interface. Or how can I configure this specific connection.
Can U help me?
Message was edited by: Edward van der Kust
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanx Ivaylo Ivanov,
I tried that but with the following result.
"NameNotFoundException".
The ejb-jar.xml looks like below
<session>
<ejb-name>BackendServiceBean</ejb-name>
<home>be.something.service.BackendServiceHome</home>
<remote>be.something.service.BackendService</remote>
<ejb-class>be.something.service.BackendServiceBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<resource-ref>
<res-ref-name>eis/SAPJRAFactor</res-ref-name>
<res-type>javax.resource.cci.ConnectionFactory</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</session>
I have to configure something more to get the mapping working from my EJB context to the right EIS JCA connector. How do I do that?
Thanx
Message was edited by: Edward van der Kust
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Edward,
first of all, did you check (as Stephan suggested) if this is a typing error in the <res-ref-name> tag declaration?
Anyway, to find out what the correct lookup string is, you could have a look at the JNDI tree on your server. To do that, connect the Visual Administrator to the server and open the JNDI Registry Service on the server node. Under the Runtime tab on the lefthand side browse the JNDI tree (it should look like the one below):
ejbContexts [Context]
sap.com [Context]
_________<your application> [Context]
_____________sap.com [Context]
_________________<your application> [Context]
_____________________BackendServiceBean [Context]
________________________<b>java:comp</b> [Context]
....
....
__________________________<b>env</b> [Context]
_____________________________<b>eis</b> [Context] -- this is based on the info from the ejb-jar.xml you pasted!
_________________________________<b>SAPJRAFactor</b> -- this is based on the info from the ejb-jar.xml you pasted!
Well, then the lookup string you need to use is "java:comp/env/eis/SAPJRAFactor".
Hope it's much crear now.
Hi Edward,
did you see this page from the JCA dev manual: http://help.sap.com/saphelp_nw04/helpdata/en/23/40e6df7eec43a486652d1f626bf6fa/frameset.htm ?
If you are about to get the connection from an EJB, then you can declare a resource reference to the connection factory and look that up relative to the java:comp/env context.
Hope that helps!
Message was edited by: Ivaylo Ivanov
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.