| Author |
InitialContext for EJB 2.x JNDI on Glassfish v2ur2 under Windows Vista
|
Jose Alvarez de Lara
Ranch Hand
Joined: May 10, 2008
Posts: 92
|
|
[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]
|
 |
Masoud Kalali
Author
Ranch Hand
Joined: Jul 08, 2004
Posts: 531
|
|
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.
|
Masoud Kalali
Software Engineer - My Weblog - GlassFish Security
|
 |
Jose Alvarez de Lara
Ranch Hand
Joined: May 10, 2008
Posts: 92
|
|
[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
Ranch Hand
Joined: Jul 08, 2004
Posts: 531
|
|
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
Joined: May 10, 2008
Posts: 92
|
|
[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]
|
 |
 |
|
|
subject: InitialContext for EJB 2.x JNDI on Glassfish v2ur2 under Windows Vista
|
|
|