• Post Reply Bookmark Topic Watch Topic
  • New Topic

NameNotFoundException: while context lookup in WL 8.1 SP4

 
Sara Fox
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We recently upgraded from Web Logic Server 6.1 to Web Logic 8.1 SP4. I did not encounter any errors during building of the webservice nor during deployment.

However, I am getting the following error:

javax.naming.NameNotFoundException: Unable to resolve 'EcasServices' Resolved ; remaining name 'EcasServices'

The code is as follows:

Properties prop = new Properties();
prop.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory"); String url = ECWSurl+":80";
prop.put(Context.PROVIDER_URL,url);
Context initialContext = new InitialContext(prop);
EcasServices service = (EcasServices) initialContext.lookup("EcasServices");

Could anyone please throw light on what I am doing wrong? I am new to Web Logic and Web Services. Any help is greatly appreciated.
 
praveenkumarr manchuu
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
generally this exception raises because of two reasons
if your jndiname and lookup name is not correct

if you do not paste classes12.jar into your lib folder genrally which is saved into your work folder
 
Stephan Staeheli
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you still looking for help?

I suggest you open the wls console (normally at http://localhost:7001/console), go to your server and open the jndi tree. Is the bean there that your were looking up in you jndi context?

Regards,
Stephan
 
Sara Fox
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot for your responses. Yes, I am still looking for help.

I do not see "EcasServices" in the JNDI tree view in my console. In addition to javax, jms, and weblogic, I see the following nodes:

1. EcasServicesEcasServices_jarstatelessSession_EO
2. NameService
3. statelessSession/EcasServicesHome

So, I tried looking up EcasServicesHome but got the same error as before:
javax.naming.NameNotFoundException: Unable to resolve 'EcasServicesHome' Resolved ; remaining name 'EcasServicesHome'

When I tried looking up "statelessSession.EcasServicesHome", I got the following error: java.lang.ClassCastException

I know I am not reading it correctly. Could you please let me know what I need to be looking up Context for to access the webservice?

Thanks a lot.
 
Mark Spritzler
ranger
Sheriff
Posts: 17290
9
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, you are closer. You found that the name you were using to lookup was wrong and now are correectly looking up the Home object. But you are casting it to "(EcasServices)", which is the bean class and not the Home object, you need to cast it to the Home, then call create to return the proxy to the bean.

Mark
 
Mark Spritzler
ranger
Sheriff
Posts: 17290
9
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, you are closer. You found that the name you were using to lookup was wrong and now are correectly looking up the Home object. But you are casting it to "(EcasServices)", which is the bean class and not the Home object, you need to cast it to the Home, then call create to return the proxy to the bean.

Mark
 
Sara Fox
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot for all your advice. I am able to get response from my webservice.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!