9 Replies Latest reply on Oct 14, 2010 3:10 PM by wdfink

    Error: java.lang.reflect.UndeclaredThrowableException

    jyotsana
      Hi I am using JBoss5 as ejb container and deployed an ejb jar file in it.
      From Tomcat6 through an Servlet I am accessing this ejb.
      This is the part of code of servlet deployed in Tomcat.
                Properties props=new Properties();
                      props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
                      props.put(Context.PROVIDER_URL, "jnp://localhost:1099");
                      props.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
                      System.out.println("Properties ok");
                      Context ctx=new InitialContext(props);
                      System.out.println("context ok");
                      greetHome home = (greetHome)
                      ctx.lookup("greetJndi");
                      System.out.println("home ok");
                      greetRemote remote=home.create();
                      System.out.println("remote ok");
                      String a = req.getParameter("text1");
                      String s = remote.greetme(a);
                      System.out.println(s);
                      out.println(s);

      In the Tomcat Server Screen I am getting the following Message

       

       

      Properties ok

      context ok

      home ok

      java.lang.reflect.UndeclaredThrowableException

       

      context ok
      Greet Home assigned to Null
      javax.naming.NameNotFoundException: greet not bound

       

       

      Here is my ejb-jar.xml file

       

      <ejb-jar>

      <enterprise-beans>

      <session>

      <ejb-name>greetBean</ejb-name>

      <home>greetHome</home>

      <remote>greetRemote</remote>

      <ejb-class>greetBean</ejb-class>

      <session-type>Stateless</session-type>

      <transaction-type>Container </transaction-type>

      </session>

      </enterprise-beans>

      </ejb-jar>

       

       

      I created a greet.jar and deployed in JBoss. greet.jar contains three class(greetHome,greetRemote,greetBeen) and META-INF/ejb-jar.xml and META-INF/jboss.xml file.

       

      What I am doing wrong?

      Thanks