Results 1 to 5 of 5

Thread: Java EJB not Found in Netbeans 6.0.1 and GlassFish V2

  1. #1
    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:
    Exception in thread "main" javax.naming.NameNotFoundException: mySessionBean not found
    Thank you to give me benefit from your experience.

  2. #2
    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.

  3. #3
    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).

  4. #4
    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,

  5. #5
    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

Similar Threads

  1. Problem install Glassfish Server
    By Defender14 in forum Software Development
    Replies: 7
    Last Post: 26-10-2010, 01:38 PM
  2. Java main class not found
    By Rily in forum Software Development
    Replies: 6
    Last Post: 13-08-2010, 10:21 AM
  3. Java Card Manager NetBeans plug-in
    By Galimberti in forum Software Development
    Replies: 5
    Last Post: 24-07-2010, 03:27 AM
  4. Java console application used in netbeans 5.5 ide
    By Erie in forum Software Development
    Replies: 6
    Last Post: 22-07-2010, 09:46 AM
  5. How do i load and save picture in java ide netbeans 6.5
    By nanakofiboafo in forum Software Development
    Replies: 1
    Last Post: 23-04-2009, 08:22 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,904,952.95308 seconds with 17 queries