Showing results for 
Search instead for 
Did you mean: 

Problem looking up entity local home - ejb-local-ref

0 Kudos


I have an application with a session bean (MetaManager) and an entity bean (InfoItem) which I want to reference from that session bean. The entity

bean is deployed correctly, but I simply cannot look it up locally from the session bean (the remote lookup works alright).

I use the following code for the lookup:

Context initial = new InitialContext();

InfoItemLocalHome home = (InfoItemLocalHome)initial.lookup("");

The following exception is thrown: Object not found in lookup of InfoItemLocal.

In ejb-jar.xml I have specified MetaManagerBean as follows:


















In ejb-j2ee-engine.xml I have specified:










The error occurs regardless of whether I use

"InfoItemLocal" (as specified as the ejb-ref-name) or

"" (jndi-name).

I simply cannot do a local lookup. Anybody has an idea of what I'm doing wrong?

Thanks alot for your help!

View Entire Topic
0 Kudos

Hi Peter & Maksim,

I have used the code you adviced, but unfortunately I cannot even create the InitialContext. When I start the bundle that contains the code, the

exception stack reads as follows:

-> start file:bundle/devhl.jar

javax.naming.NoInitialContextException: Cannot instantiate class:

.services.jndi.InitialContextFactoryImpl [Root exception is java.lang.ClassNotFo


at javax.naming.spi.NamingManager.getInitialContext(


at javax.naming.InitialContext.getDefaultInitCtx(


at javax.naming.InitialContext.init(

at javax.naming.InitialContext.<init>(


at org.ungoverned.oscar.Oscar.startBundleWithStartLevel(

at org.ungoverned.oscar.Oscar.startBundle(

at org.ungoverned.oscar.BundleImpl.start(




at org.ungoverned.osgi.bundle.shelltui.ShellTuiActivator$ShellTuiRunnabl


Caused by: java.lang.ClassNotFoundException:



at Method)


at java.lang.ClassLoader.loadClass(

at sun.misc.Launcher$AppClassLoader.loadClass(

at java.lang.ClassLoader.loadClass(

at java.lang.ClassLoader.loadClassInternal(

at java.lang.Class.forName0(Native Method)

at java.lang.Class.forName(

at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.jav


at javax.naming.spi.NamingManager.getInitialContext(


... 11 more

I have started a bundle sapj2eeclient which exports the package AND have included the jar-file with the bundle by


Bundle-ClassPath: ., lib/bundle/sapj2eeclient.jar

in the the devhl.jar bundle's manifest.

Do you have an idea what is going wrong here?

Thanks for your help, again!


Also, just to make sure I'm not working in a wrong direction: Is it generally possible to use JMS inside an OSGI bundle? (What I actually want to look up here is a QueueFactory, not a bean).

Former Member
0 Kudos

Hi Katrin,

It is possible to have a remote client that uses JMS launched by a standard java program (with a main class). However I am not familiar with OSGI.

Looking at the exception

is not in the classpath. Probably it's not included properly in the bundle.

Btw, besides jndi, you will need to export you your bundle everything under from the sapj2eeclient.jar. You will reach to that problem when attempting to perform a lookup for the JMS connection factory.