Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 13-12-2008
Member
 
Join Date: Dec 2008
Posts: 49
Java EJB not Found in Netbeans 6.0.1 and GlassFish V2

Hi,

I use Netbeans 6.0.1 and GlassFish V2 to make EJB3.

So I created a Session Bean the following code:

Code:
@ Stateless 
public class MySessionBean implements MySessionBeanRemote, MySessionBeanLocal ( 
public String getMessage () ( 
return "Hello World!"; 
) 
)
When I call this bean via a servlet (locally) via the @ EJB, it works very well, but when I call customer via a stand-alone, it gives me all the time except " EJB not found ", this is the source of my stand-alone application:

Code:
Context ctx = null; 
ctx = new InitialContext (); 
MySessionBeanRemote tsr = (MySessionBeanRemote) ctx.lookup ( "mySessionBean"); 
System.out.println ( "message =" + tsr.getMessage ());
I just want to clarify that I am working on the same machine and under the localhost port 3700 by default, so the file of the library jndi.properties AppServ-rt will be sufficient to service JNDI.

When I run my client application, I always except as follows:
Quote:
Exception in thread "main" javax.naming.NameNotFoundException: mySessionBean not found
Thank you to give me benefit from your experience.
Reply With Quote
  #2  
Old 13-12-2008
Member
 
Join Date: May 2008
Posts: 115
Re: Java EJB not Found in Netbeans 6.0.1 and GlassFish V2

Your exception is that it does not mySessionBean jndi in your tree.

I worked on a little ss weblogic and conf jndi was provided in xml files included in the classpath. In the case of your client application, you should check whether you load well conf files (. xml or properties) that contain the information to access your ejb.
Reply With Quote
  #3  
Old 13-12-2008
Member
 
Join Date: Dec 2008
Posts: 49
Re: Java EJB not Found in Netbeans 6.0.1 and GlassFish V2

Thank you for your reply , I just wanted to correct something, the bean that I seek is MySessionBean not mySessionBean (m first in capitals), it was a typo when posting my problem and it ' is not the source of the problem.

For your proposed solution I look into it .
Thank you.

I reviewed what I like jndi property, and do not see the problem exactly, thank you for me clarify exactly what I have to check my configuration. I even avoid using the file. Properties, passing under an item InitialContext Properties containing the requirements, but in vain. I do not know if I am wrong if I think the object is not instantiated in the application server (it's still a hypothesis).
Reply With Quote
  #4  
Old 13-12-2008
Member
 
Join Date: May 2008
Posts: 115
Re: Java EJB not Found in Netbeans 6.0.1 and GlassFish V2

Hello,

Well, I thought I share a little I do not used the same configuration as you but I will try to show you As I understand:

When deploying ejb weblogic on a server, you can also generate customers who can call in the ejb remote. It is also valid for other server applications.
Here are the config files generated by weblogic for a call to a ejb given:

ejb-jar.xml:

Code:
<session> 
<ejb-name> MyBeanSession </ ejb-name> 
<home> en.edf.erdsge.ejb.mybean.MyBeanSessionHome </ home> 
<remote> en.edf.erdsge.ejb.mybean.MyBeanSessionRemote </ remote> 
<local-home> en.edf.erdsge.ejb.mybean.MyBeanSessionLocalHome </ local-home> 
<local> en.edf.erdsge.ejb.mybean.MyBeanSessionLocal </ local> 
<ejb-class> en.edf.erdsge.ejb.mybean.MyBeanSession </ ejb-class> 
Stateless <session-type> </ session-type> 
<transaction-type> Container </ transaction-type> 
</ session>

weblogic-ejb-jar.xml:

Code:
<weblogic-enterprise-bean> 
<ejb-name> MyBeanSession </ ejb-name> 
<stateless-session-descriptor> 
</ stateless-session-descriptor> 
<enable-call-by-reference> true </ enable-call-by-reference> 
<jndi-name> ejb.MyBeanSessionRemoteHome </ jndi-name> 
<local-jndi-name> ejb.MyBeanSessionLocalHome </ local-jndi-name> 
</ weblogic-enterprise-bean>


Here the lookup jndi fetches the reference in jndi weblogic-ejb-jar.xml then goes to the mapping in ejb-jar.xml to retrieve the name of the ejb to load classes that go well. These classes * * local and remote are delivered to the customer.

I hope it can help you

Good luck,
Reply With Quote
  #5  
Old 13-12-2008
Member
 
Join Date: Dec 2008
Posts: 49
Re: Java EJB not Found in Netbeans 6.0.1 and GlassFish V2

First of All I uses EJB3 with annotations and therefore I do not think I need all this setting.I found the problem, I had just specify the mappedName my EJB,

So a line like:

@ Stateless (mappedName = "mySessionBean")

Should have been the case (Stateful and Stateless as you want)

Thank you for your aid.Regards
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Java EJB not Found in Netbeans 6.0.1 and GlassFish V2"
Thread Thread Starter Forum Replies Last Post
Problem install Glassfish Server Defender14 Software Development 7 26-10-2010 01:38 PM
Java main class not found Rily Software Development 6 13-08-2010 10:21 AM
Java Card Manager NetBeans plug-in Galimberti Software Development 5 24-07-2010 03:27 AM
Java console application used in netbeans 5.5 ide Erie Software Development 6 22-07-2010 09:46 AM
How do i load and save picture in java ide netbeans 6.5 nanakofiboafo Software Development 1 23-04-2009 08:22 AM


All times are GMT +5.5. The time now is 08:56 PM.