cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with lookup of datasource

Former Member
0 Kudos

Hi all!

I get an exception when I try to lookup a datasource for an EJB application deployed to SAP WebAS (J2EE Engine 6.40 SP18) from within my Java 1.4.2 RMI client.

The stacktrace:

-


java.rmi.RemoteException: com.sap.engine.services.ejb.exceptions.BaseRemoteException: Exception in method getRolenames.

at beans.TestObjectImpl0.getRolenames(TestObjectImpl0.java:105)

at beans.TestObjectImpl0p4_Skel.dispatch(TestObjectImpl0p4_Skel.java:130)

at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:320)

at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:198)

at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:129)

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(Native Method)

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

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

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 beans.TestObjectImpl0.getRolenames(TestObjectImpl0.java:98)

... 10 more

Caused by: javax.ejb.CreateException: com.sap.engine.services.jndi.persistent.exceptions.NameNotFoundException: Path to object does not exist at java:comp, the whole lookup name is java:comp/env/CaAnafeeDS.

at beans.TestBean.ejbCreate(TestBean.java:86)

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

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

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

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

at com.sap.engine.services.ejb.session.stateless_sp5.BeanFactory.createObject(BeanFactory.java:113)

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)

... 12 more

; nested exception is:

java.lang.RuntimeException: 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 beans.TestObjectImpl0.getRolenames(TestObjectImpl0.java:98)

at beans.TestObjectImpl0p4_Skel.dispatch(TestObjectImpl0p4_Skel.java:130)

at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:320)

at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:198)

at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:129)

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(Native Method)

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

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

Caused by: javax.ejb.CreateException: com.sap.engine.services.jndi.persistent.exceptions.NameNotFoundException: Path to object does not exist at java:comp, the whole lookup name is java:comp/env/CaAnafeeDS.

at beans.TestBean.ejbCreate(TestBean.java:86)

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

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

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

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

at com.sap.engine.services.ejb.session.stateless_sp5.BeanFactory.createObject(BeanFactory.java:113)

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)

... 12 more

at com.sap.engine.services.ejb.exceptions.BaseRemoteException.writeReplace(BaseRemoteException.java:276)

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

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

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

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

at java.io.ObjectStreamClass.invokeWriteReplace(ObjectStreamClass.java:896)

at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1011)

at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278)

at com.sap.engine.services.rmi_p4.DispatchImpl.throwException(DispatchImpl.java:144)

at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:322)

at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:198)

at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:129)

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(Native Method)

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

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

Caused by: java.lang.RuntimeException: 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 beans.TestObjectImpl0.getRolenames(TestObjectImpl0.java:98)

at beans.TestObjectImpl0p4_Skel.dispatch(TestObjectImpl0p4_Skel.java:130)

at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:320)

at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:198)

at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:129)

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(Native Method)

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

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

Caused by: javax.ejb.CreateException: com.sap.engine.services.jndi.persistent.exceptions.NameNotFoundException: Path to object does not exist at java:comp, the whole lookup name is java:comp/env/CaAnafeeDS.

at beans.TestBean.ejbCreate(TestBean.java:86)

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

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

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

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

at com.sap.engine.services.ejb.session.stateless_sp5.BeanFactory.createObject(BeanFactory.java:113)

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)

... 12 more

at com.sap.engine.services.ejb.exceptions.BaseRuntimeException.writeReplace(BaseRuntimeException.java:273)

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

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

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

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

at java.io.ObjectStreamClass.invokeWriteReplace(ObjectStreamClass.java:896)

at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1011)

at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1332)

at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1304)

at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)

at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)

... 11 more

The data-sources.xml:

-


<?xml version="1.0" encoding="UTF-8" ?>

<data-sources>

<data-source>

<data-source-name>CaAnafeeDS</data-source-name>

<driver-name>OracleDriver</driver-name>

<sql-engine>Vendor_SQL</sql-engine>

<jdbc-1.x>

<driver-class-name>oracle.jdbc.driver.OracleDriver</driver-class-name>

<url>jdbc:oracle:thin:@192.168.100.14:1521:anafee</url>

<user-name>mku_322</user-name>

<password>mku_322</password>

</jdbc-1.x>

</data-source>

</data-sources>

The lookup:

-


public void ejbCreate() throws CreateException

{

try

{

InitialContext ctx = getInitialContext();

dataSource = (DataSource)ctx.lookup("java:comp/env/CaAnafeeDS");

}

catch (Exception e)

{

throw new CreateException(e.toString());

}

}

My EJB application is deployed successfully to the J2EE Engine from Netweaver developer studio with the data-sources.xml. When I look at the Visual Administrator Console, the JDBC Connector seems to be configured correctly.

Can you imagine why the lookup fails? What would be the correct JNDI path?

Regards,

Matthias

Accepted Solutions (1)

Accepted Solutions (1)

Gstoiljkovski
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Matthias,

please check the actual JNDI name in the JNDI registry service of the engine. The NameNotFoundException is a indicator that your lookup has the wrong String as an argument.

Cheers, Goran

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Gunter,

the correct lookup should be "jdbc/CaAnafeeDS".

You should find this also in the JNDI Registry-Service in the Visual Administrator.

If you want to use the java:comp/env/CaAnafeeDS you will have to configure it for your EJB in the ejb-jar.xml of your EJB Applicatio separtly.

Best regards,

Stefan Brauneis

Former Member
0 Kudos

Hi,

Is there a data-source-name in your persistent.xml?

If so, it may help to create an alias with the same name in your EA Project.

Good luck!

Roelof