Closed Rosthouse closed 9 years ago
Hi, is it possible that you are using the same JNDI name for the Cuckoo ConnectionFactory and the Hibersap SessionManager? Both must be different, Hibersap needs its SessionManager and itself uses the ConnectionFactory, i.e. both must reside in JNDI. It looks like Hibersap overwrites your existing JNDI node for the ConnectionFactory with the Hibersap SM.
I had a similar problem with JBoss 7. The JNDI look up in HibersapBootstrapBean did not work. Caused by: javax.naming.NameNotFoundException: jboss/eis/sap/NSP -- service jboss.naming.context.java.jboss.exported.jboss.eis.sap.NSP
Could anyone help.
This error sometimes shows up as a follow-up when the RAR deployment did not work. Are there any previous errors in the JBoss log? Is the Cuckoo RAR successfully deployed?
If no other errors appear, please check if the Hibersap SessionManager is actually bound to the JNDI name "java:jboss/eis/sap/NSP" using the jndi-view operation in JBoss CLI:
/subsystem=naming/:jndi-view
I think the rar deployment was successful, correct me if I was wrong: 2015-06-24 15:52:33,083 INFO [org.cuckoo.ra.spi.CuckooManagedConnectionFactory:85] Registering new SAP destination named NSP 2015-06-24 15:52:33,084 INFO [org.cuckoo.ra.spi.CuckooResourceAdapter:125] Cuckoo-RA: registering JCo destination 'NSP' 2015-06-24 15:52:33,085 WARNING [org.cuckoo.ra.jco.CuckooDestinationDataProvider:62] The eventListener is null! 2015-06-24 15:52:33,085 INFO [org.jboss.as.connector.deployment:347] JBAS010406: Registrierung von Connection-Factory java:jboss/eis/sap/NSP 2015-06-24 15:52:33,091 INFO [org.cuckoo.ra.spi.CuckooResourceAdapter:90] Starting Cuckoo Resource Adapter for SAP Version 1.1.0 2015-06-24 15:52:33,305 INFO [org.hibersap.configuration.Configuration:52] Hibersap Version 1.2.0
"java:jboss/eis/sap/NSP" ist the name of the connection factory and that is bound.
What is not working in HibersapBootstrapBean
:
SessionManager sessionManager = new AnnotationConfiguration("NSP").buildSessionManager();
which did a look up at the JCA factory I think?!
hibersap.xml:
<?xml version="1.0" encoding="UTF-8"?>
<hibersap>
<session-manager name="NSP">
<context>org.hibersap.execution.jca.JCAContext</context>
<jca-connection-factory>java:jboss/eis/sap/NSP</jca-connection-factory>
<!-- <jca-connectionspec-factory>org.hibersap.execution.jca.cci.SapBapiJcaAdapterConnectionSpecFactory</jca-connectionspec-factory> -->
<annotated-classes>
<!-- <annotated-class>de.keohl.sap.rfc.Customer</annotated-class>
<annotated-class>de.akquinet.jbosscc.cuckoo.example.model.CustomerChange</annotated-class> -->
</annotated-classes>
<validation-mode>CALLBACK</validation-mode>
</session-manager>
</hibersap>
Yes, sorry, Hibersap here looks for the connection factory using the JNDI name from the jca-connection-factory element in the hibersap.xml.
Strangely, it seems to look under the exported namespace:
Caused by: javax.naming.NameNotFoundException: jboss/eis/sap/NSP -- service jboss.naming.context.java.jboss.exported.jboss.eis.sap.NSP
I would expect a lookup under jboss.naming.context.java.jboss.eis.sap.NSP
(without the 'exported') with the given configuration. Are you sure the deployed application has the correct connection factory jndi name in hibersap.xml?
Please check also in JBoss config that the jndi-name attribute of the connection-definition element in the resource-adapter subsystem has the same value as the jndi name in hibersap.xml.
Excerpt standalone.xml:
<connection-definition
class-name="org.cuckoo.ra.spi.CuckooManagedConnectionFactory"
jndi-name="java:jboss/eis/sap/NSP"
enabled="true"
use-java-context="true"
pool-name="eis/sap/NSP"
use-ccm="true">
I think you've found the problem:"Strangely, it seems to look under the exported namespace". But why?
I found that in other deployments a jndi.properties exists. Removing them solves the problem that the look up is executed under the exported namespace. But now I got:
Caused by: javax.naming.NameNotFoundException: Error looking up eis/sap/NSP, service service jboss.naming.context.java.jboss.eis.sap.NSP is not started
I started from scratch, removing all jndi.properties from classpath, adding some deps in deployment descriptor. And then it works.
2015-06-25 08:55:21,573 DEBUG [org.hibersap.configuration.Configuration:144] Reading HibersapConfig from configuration file
2015-06-25 08:55:21,769 INFO [org.hibersap.configuration.Configuration:114] Building SessionManager 'NSP'
Thanks a lot Carsten.
Great that you got it to work!
Over the last two days, I’ve tried to get Cuckoo and Hibersap to work together. I checked out the latest versions of both libraries, on github, compiled them and tried to get it to run.
Cuckoo by itself works fine. I’ve verified that by using your cuckoo-test application (https://github.com/cerker/cuckoo-test). I get a connection and response from our own SAP system. So far so good. Next, I tried to work myself through the cuckoo-hibersap-example. That’s where the troubles started.
The problem starts with the HiberSapBootsStrapper, where some of the internal workings of the application Server are replaced. See the following example:
Class de.akquinet.jbosscc.cuckoo.example.ejb.HibersapBootstrapBean
On line 10 of the above listening, the Jndi name is replaced with hibersaps sessionmanager. This leads to problems in the JCAContext class, where we actually need to look up the CuckooConnectionFactory, but do it with the same JNDI-name as before.
Class org.hibersap.execution.jca.JCAContext
The problem arises on line 4 of the above listening. We get the Hibersap SessionManager, which leads to a circular reference and results in a stackoverflow. What should be returned is an instance of the interface org.cuckoo.ra.cci.CuckooConnectionFactory (more precisely, an instance of the implementation class).
My question is, am I doing something wrong with the deployment, or should cuckoo and Hibersap receive two different Connector Resources to work properly?
I’d greatly appreciate if someone could shed some light on this.