This week's book giveaways are in the Jython/Python and Object-Oriented programming forums.
We're giving away four copies each of Machine Learning for Business: Using Amazon SageMaker and Jupyter and Object Design Style Guide and have the authors on-line!
See this thread and this one for details.
Win a copy of Machine Learning for Business: Using Amazon SageMaker and JupyterE this week in the Jython/Python forum
or Object Design Style Guide in the Object-Oriented programming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

InitialContext for EJB 2.x JNDI on Glassfish v2ur2 under Windows Vista

 
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[color=#444444]
[size=12]
Hi,

I am working under Windows Vista Home Premium, Glassfish v2ur2 and developing on NetBeans 6.5. I have been visiting the threads in the forum and some pages googling over there. I have found some answers but no one solve my problem.

The furthest I have got is the following code,



I am trying to call JNDI EJB 2.x but this code gives me a NamingException. It is possible that I do not include the necessaries jar into the project, or that the code should be wrong.

This is the server log,



Does it mean that I need any jar or maybe the code is wrong?

Thanks in advance,
Jose Alvarez de Lara

[/size]
[/color]
 
Author
Posts: 531
Mac OS X Netbeans IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jose,

You need to add the following file to your project classpath and I think you should use com.sun.appserv.naming.S1ASCtxFactory instead of the com.sun.enterprise.naming.SerialInitContextFactory, honestly I do not remember the difference right now.


 
Jose Alvarez de Lara
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[color=#444444]
[size=12]
Hi Masoud,

I have folowed your indications and now the system repots me the exception,




I have no idea about what does it mean.

Have you?

Thanks for your interesting and best regards,
Jose Alvarez de Lara


[/size]
[/color]
 
Masoud Kalali
Author
Posts: 531
Mac OS X Netbeans IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Can you explain what you are going to do? you need to initialize the context factory when you are outside a preconfigured container, for example when you want to access the container managed objects from outside the container. You can take a look at this blog entry to understand how we can use the contextfactory to access container managed resources.



this is a simple code for initializing a context factory for GlassFish. you can find a more extensive explanation at http://weblogs.java.net/blog/kalali/archive/2006/05/step_by_step_to_2.html
 
Jose Alvarez de Lara
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[color=#444444]
[size=12]
Hello Masoud,

My application is a web application. I have the EJBs in a jar file and the client is the web application. I have got thi InitialContext but I have not the lookup JNDI of the EJBs. It is because the descriptors. I do not know how to declare the EJBs in ejb-jar.xml and sun-ejb-jar.xml This is what I have done,

ejb-jar.xml



sun-ejb-jar.xml



Excuse me if I do not know enought but I am trying to learn.
On this descriptors, how do I have to call the EJBs home interface?

Because just reach this point I think I can go on alone.

Best regards,
Jose Alvarez de Lara

[/size]
[/color]
 
I once met a man from Nantucket. He had a tiny ad
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!