5 Replies Latest reply on Sep 29, 2011 12:04 PM by Wolf-Dieter Fink

    Context look up failed with JBOSS 6

    Sam W Expert

      Hi,

       

      I got the following error when during the deployment with Jboss 6:

       

       

      2011-09-29 12:33:44,743 INFO  [org.jboss.web.tomcat.service.deployers.TomcatDeployment] (HDScanner) deploy, ctxPath=/CategoryClient2-web

      2011-09-29 12:33:44,781 INFO  [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/CategoryClient2-web]] (HDScanner) Initializing Spring root WebApplicationContext

      2011-09-29 12:33:44,827 INFO  [STDOUT] (HDScanner)

      2011-09-29 12:33:44,827 INFO  [STDOUT] (HDScanner)

      2011-09-29 12:33:44,827 INFO  [STDOUT] (HDScanner)       Hello ...

      2011-09-29 12:33:44,828 ERROR [STDERR] (HDScanner) javax.naming.NameNotFoundException: CategoryClient2-ejb not bound

       

       

       

      CategoryFinderController.java:

      @Controller

      //@SessionAttributes("categoryFinder")

      @RequestMapping("/category")

      @Transactional

      public class CategoryFinderController {

       

       

              private static final Logger logger = Logger.getLogger(CategoryFinderController.class);

                         

                        public CategoryFinderController() {

                          logger.info("calling CategoryFinderController");

                          List<CategorySubcategories> result = null;

                          System.out.println("\n\n\t Hello ...");

                          logger.info("calling CalculatorFinderController");

                          try {

                              InitialContext ic = new InitialContext();

                              // Obtain the application component's ENC

                              CallerLocal remote = (CallerLocal) ic.lookup("java:global/CategoryClient2-ear/CategoryClient2-ejb/CallerName!ix.category.remote.CallerLocal");

       

                              result = (List<CategorySubcategories>) remote.findAll();

                          } catch (Exception e) {

                              e.printStackTrace();

                          }

                          System.out.println("ONE----result = " + result.size());

                         

                      }

       

      //          // setup binder for adding/editing products

                @InitBinder

                protected void initBinder(WebDataBinder binder) {

                                          logger.info("callling initBinder");

                                          SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy", Locale.US);

                          binder.registerCustomEditor(Boolean.class, new CustomBooleanEditor(false));

                          binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));

                          binder.registerCustomEditor(String.class, new StringTrimmerEditor(true));

                }

      //

      //          // default render page - search

                @RequestMapping

                public String showSearch(Model model) {

                                          logger.info("calling default submit method showSeach()");

                          model.addAttribute("totalResults", Integer.valueOf(0));

                          return "categoryFinderSearch";

                }

       

       

      I have attached an ear file here for reference.

       

      Any suggestion would be very appreciated.

      Thanks

      Sam

        • 1. Re: Context look up failed with JBOSS 6
          Sam W Expert

          I also have a looked into the jboss jmx-console/ page and found that my *.ejb module is missing from the tree.

          Here is the current "tree" of the project deployment:

           

          +- global (class: org.jnp.interfaces.NamingContext)

            |   +- jmx-console (class: org.jnp.interfaces.NamingContext)

            |   +- CategoryClient2-ear (class: org.jnp.interfaces.NamingContext)

            |   |   +- CategoryClient2-web (class: org.jnp.interfaces.NamingContext)

           

          As it shown that CategoryClient2-ear only cosists of CategoryClient2-web module.

          The ejb module (CategoryClient2-ejb) is missing.

           

          Can anyone tell me what is wrong wtih my project setup?

           

          Thanks

          Sam

          • 2. Re: Context look up failed with JBOSS 6
            Wolf-Dieter Fink Master

            Could you show the EAR structure and the descriptors?

            BTW why do you use ic.lookup() and not DI with '@EJB CallerLocal myLocal;' ?

            • 3. Re: Context look up failed with JBOSS 6
              Sam W Expert

              Hi, thank you for the reply.

               

              Here is the structure of the ear project:

              jar -tvf CategoryClient2-ear.ear

                   0 Thu Sep 29 21:47:22 EST 2011 META-INF/

                 122 Thu Sep 29 21:47:20 EST 2011 META-INF/MANIFEST.MF

                   0 Thu Sep 29 21:47:22 EST 2011 lib/

              19992 Thu Sep 29 21:47:22 EST 2011 CategoryClient2-ejb.jar

              3638375 Thu Sep 29 21:47:22 EST 2011 CategoryClient2-web.war

              45105 Thu Sep 29 21:47:22 EST 2011 lib/jboss-ejb-api_3.1_spec-1.0.1.Final.jar

              481535 Thu Sep 29 21:47:22 EST 2011 lib/log4j-1.2.16.jar

              53842 Thu Sep 29 21:47:22 EST 2011 lib/persistence-api-1.0.2.jar

                 556 Thu Sep 29 21:47:22 EST 2011 META-INF/application.xml

                   0 Thu Sep 29 21:47:22 EST 2011 META-INF/maven/

                   0 Thu Sep 29 21:47:22 EST 2011 META-INF/maven/ix.category/

                   0 Thu Sep 29 21:47:22 EST 2011 META-INF/maven/ix.category/CategoryClient2-ear/

                1934 Wed Sep 28 12:31:52 EST 2011 META-INF/maven/ix.category/CategoryClient2-ear/pom.xml

                 127 Thu Sep 29 21:47:22 EST 2011 META-INF/maven/ix.category/CategoryClient2-ear/pom.properties

               

               

              Since I am calling EJB module from the WAR module, @EJB annotation can't be used to call a remote EJB object.

               

              Thanks

              Sam

              • 4. Re: Context look up failed with JBOSS 6
                Sam W Expert

                I just tried " @EJB CallerLocal myLocal;" , but the following line of code resulted null pointer exception.

                 

                result = (List<CategorySubcategories>) myLocal.findAll();

                 

                 

                Thanks

                Sam

                • 5. Re: Context look up failed with JBOSS 6
                  Wolf-Dieter Fink Master

                  Please attach the application.xml also.

                   

                  I would recommend to remove the log4j and jboss jars from your ear because they are available from the server lib directory and might bring classloader and other unexpected problems.