aspose file tools*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes global - name not bound exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "global - name not bound exception" Watch "global - name not bound exception" New topic
Author

global - name not bound exception

Sagar Shroff
Ranch Hand

Joined: Jun 07, 2011
Posts: 208

Hello ranchers i am trying a small example of jndi global namespace . I have deployed my service bean in jboss , packaged in TestLocationIndependence.jar , my client is web application (servlet) packaged in RemClientJboss.war . Inside my servlet i have written the following jndi code

and when i try to request this servlet i get javax.naming.NameNotFoundException: global not bound . I dont understand where i am getting wrong.

Does this exception have any relation because i am using jboss 5.1 (I dont know whether it supports ejb 3.1)
But to add on i tries the same example in glassfishv3 which i think support JEE 6 so it should have worked there atleast ?

Rancher just to add on in Glassfish i am getting a little different error
SEVERE: javax.naming.NamingException: Lookup failed for 'java:global/TestLocationIndependece/MyBean!mypack.MyBeanRemote' in SerialContext [Root exception is javax.naming.NamingException: ejb ref resolution error for remote business interfacemypack.MyBeanRemote [Root exception is java.lang.ClassNotFoundException: mypack.MyBeanRemote]]

Why ClassNotFoundException ? confused

Regards,
Shroff


OCJP-90%,OCPWCD-95%
gurpeet singh
Ranch Hand

Joined: Apr 04, 2012
Posts: 924
    
    1

do your .war file and .jar file packaged in EAR file ? if not then you need to package them in ear file and then run the code. according to ejb 3. 1 specifications inter-application component access is possible in ejb but how this will be achieved is largely vendor specific.
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1696
    
  25

Hi

I agree with Gurpeet Singh.

@Shroff: You might want to look at the packaging example in my notes (chapter 10, ScbcdLinks). That example uses the glassfish server (v3) and the option of an ejb-client.jar (chapter 20, EJB-specs). In this example you can see an inter-application (inter-ear) communication.

Regards,
Frits
Sagar Shroff
Ranch Hand

Joined: Jun 07, 2011
Posts: 208

But one thing i dont get is why this exception , cant we make a simple remote invocation ? that's what i did ? i just looked up in the container's directory service and internally it should have got one stub and do all the RMI thing .(as my service had exposed Remote view)
So as you mentioned it is vendor specific ? so i just want to confirm that my above code which dint worked in my app-server(Glassfish) , will it work in other app server ? (just because you mentioned that inter application communication is vendor specific).
Also lets say i want somehow achieve the above scenario , lets say my service is running in some server , now you the client who is also deployed in the same app server but not packaged in the same EAR , now there must be some way you should be able to invoke this , as i have studied that Remote client view is suitable for such scenario.

Regards,
Shroff.
Sagar Shroff
Ranch Hand

Joined: Jun 07, 2011
Posts: 208

Frits I tried your examples they were quite helpful . But now i feel my basics are still weak, please help to clear it out.
In eclipse whenever my project is depended on external class files , i do RClick on project properties and go to java build path and from there i click on Add External Jars .
So in my previous example what i did in my ServiceEJB was , i first exported remote interface of my service bean as an archive in a certain location and then in my client i added that zip as Add External Jars method which i described above.So at compile time it was not giving me any problem but at runtime it blowed off . So my main question to you is that i am not understanding how ClassNotFoundException blowing here because i follow the same methodology of Add External Jar in my standalone java app and it works fine, why is it not able to pick up at runtime ?

Regards,
Shroff.
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1696
    
  25

Yes you can really struggle to get this thing working (which is mostly caused by incorrect project setup) You might want to check the Jboss or Glassfish manuals to get the right project configuration.

You can also have a look at Ivan notes in chapter 5.2. Remote Session Bean Clients

Regards,
Frits
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: global - name not bound exception