Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Help with NameNotFoundException using EJB's after AppServer Upgrade

905309Dec 14 2011 — edited Dec 15 2011
Hello Everyone!
I am looking for some much needed help on a problem I've been having and have tried to remedy for awhile now.
First some background... Our organization was previously using an older AppServer with JDeveloper 10.1.3. In the coming months we will be upgrading to JDeveloper 11g and WebLogic server 11g. So it has been my task to ensure that our application works with the forthcoming technologies.

My main issue with the upgrade has been when I have tried to lookup an EJB. It seems that the application can no longer find the EJB I am searching for, hence the name not found exception below. Mind you this was working perfectly fine with the older JDeveloper and WebLogic.

I'm not sure what could be causing this as I've seem to checked everything and am completely stumped. I have looked on the WebLogic Administration console to make sure that the EJB's have the correct lookup name. I have included some relevant code below that may give someone a better idea of what is going on. Please ask questions or for additional code if needed. As always, thank you for the help.

EXCEPTION:
javax.naming.NameNotFoundException: Unable to resolve 'CoSerFormManager'. Resolved ''; remaining name 'CoSerFormManager'
at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1139)
at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:252)
at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.java:182)
at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:206)
at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:254)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:411)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at gov.nysed.sams.ui.ServiceLocator.getService(ServiceLocator.java:28)
at gov.nysed.sams.ui.delegate.CoSerFormManagerDelegate.<init>(CoSerFormManagerDelegate.java:31)
at gov.nysed.sams.timer.CoSerNoticeTimer.run(CoSerNoticeTimer.java:35)
at java.lang.Thread.run(Thread.java:619)
gov.nysed.sams.exception.SAMSInternalException: Error running suspense transfer timer thread: Unable to locate the service object for CoSerFormManager: Unable to resolve 'CoSerFormManager'. Resolved '': Unable to resolve 'CoSerFormManager'. Resolved ''
at gov.nysed.sams.timer.CoSerNoticeTimer.run(CoSerNoticeTimer.java:68)
at java.lang.Thread.run(Thread.java:619)

Example EJB JAR Entry
<session>
<description>Session Bean (Stateless)</description>
<display-name>CoSerFormManager</display-name>
<ejb-name>CoSerFormManager</ejb-name>
<home>gov.nysed.sams.remote.home.CoSerFormManagerHome</home>
<remote>gov.nysed.sams.remote.CoSerFormManager</remote>
<ejb-class>gov.nysed.sams.server.session.CoSerFormManagerBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Bean</transaction-type>
<resource-ref>
<res-ref-name>jdbc/SAMSDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</session>

Code being used to execute the EJB lookup
public static Object getService(String serviceName, Class serviceClass) {

Object remote = null;

try {
if (cache.containsKey(serviceName)) {
remote = cache.get(serviceName);
} else {
setInitialContext();
Object lookup = context.lookup(serviceName);*//THIS IS THE LINE WHERE THE EXCEPTION OCCURS*
cache.put(serviceName, remote);
}
} catch (Exception ex) {
throw new SAMSInternalException(ex, "Unable to locate the service object for " + serviceName + ": "
+ ex.getMessage());
}

return remote;
}

Edited by: user8917183 on Dec 14, 2011 11:53 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 12 2012
Added on Dec 14 2011
5 comments
823 views