8 Replies Latest reply on Oct 6, 2010 9:38 AM by nimo stephan

    WELD-000079 Could not find the EJB in JNDI

    nimo stephan Master

      I am using the following maven-archetype:




      The archetype is shipped with example-sources. Unfortunately, it cannot be run:

      15:52:02,687 INFO  [org.jboss.bootstrap.impl.base.server.AbstractServer] JBossAS [ "Neo"] Started in 26s:797ms
      15:52:13,234 SEVERITY [javax.enterprise.resource.webcontainer.jsf.application] Error Rendering View[/home.xhtml]: org.jboss.weld.exceptions.CreationException: WELD-000079 Could not find the EJB in JNDI:  class foo.WidgetRepositoryProducer_$$_javassist_6
           at org.jboss.weld.bean.SessionBean.create(SessionBean.java:315) [:1.0.1.Final]
           at org.jboss.weld.context.DependentContext.get(DependentContext.java:62) [:1.0.1.Final]
           at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:709) [:1.0.1.Final]
           at org.jboss.weld.bean.AbstractReceiverBean.getReceiver(AbstractReceiverBean.java:83) [:1.0.1.Final]

      You see, I take the actually WELD-Version and put it also in JBOSSAS.

      The Source-Code makes use of javax.ejb:

      import javax.ejb.Stateless;
      import javax.enterprise.inject.Produces;
      import javax.enterprise.inject.Disposes;
      import javax.persistence.EntityManager;
      import javax.persistence.PersistenceContext;
      public class WidgetRepositoryProducer ...

      How can I solve this failure:

      WELD-000079 Could not find the EJB in JNDI

      Is this related to the bug described here ?:

      The other question is:
      Why it is packed as a WAR instead of an EAR?

      I cannot find any other weld-archetype packing the application as an EAR.

        • 1. Re: WELD-000079 Could not find the EJB in JNDI
          Susanne Jarl Newbie

          I have exactly the same problem and questions as you have.

          • 2. Re: WELD-000079 Could not find the EJB in JNDI
            Steven Boscarine Apprentice

            Hello Nimo and Susanne,

            To answer your question about the WAR vs EAR, Since EJB 3.1 in Java EE 6 works within wars as well as ears, we chose to have the application deploy as a war.  I greatly prefer using wars as it builds much faster and can be run very easily from an embedded container, like Glassfish Embedded.  Certainly, if there is demand from the community, we can accommodate ears as well.

            I am one of the volunteers on the archetypes project and I apologize you got this error.  If I read your message correctly, you got the error just by building and deploying.  If that's the case, I can vouch that the latest batch does work in JBoss AS 6 M3.  You can use it, right now, simply by adding one extra variable to your archetype:generate command:

            Here's the command to build the latest:

            mvn archetype:generate -DarchetypeArtifactId=jboss-javaee6-webapp -DarchetypeGroupId=org.jboss.weld.archetypes -DarchetypeVersion=1.0.1.Beta1 -DarchetypeRepository=https://oss.sonatype.org/content/repositories/orgjbossweld-187

            There's one extra step that's described in detail in the readme.txt and that is to deploy a datasource.  If you run:

            mvn clean package jboss:hard-deploy

            ...everything will be automatically taken care of. The newest version has a small CDI and JPA example which requires deploying a datasource (the config is supplied and it's an embedded Hypersonic Database, so it doesn't require an install or any further action on your part).

            The new release is greatly improved as it is contains all the specifications, as maintained by the JBoss server team.  If you build it, you'll see a much cleaner POM.  It's a nice improvement.

            We'll get the release out very soon, so in a week or two, you won't have to specify a URL. I'll post an update to this thread when a new version is ready. 



            • 3. Re: WELD-000079 Could not find the EJB in JNDI
              Steven Boscarine Apprentice

              Hello Nimo and Susanne,

              I apologize, but upon further examination, I see I missed a step in that command.  Unfortunately, Maven 2.2 didn't feel like pointing out my stupid mistake and telling me my archetypeRepository URL is invalid (unless you edit your setting.xml first).  Rather than update that post and put a temporary procedure up which won't be needed in a few days, I'll update this forum posting with a link to the correct procedure.  Expect something in a few days.

              I apologize again for the confusion and I promise we'll get something worth up that's worth the wait in a few days!


              • 4. Re: WELD-000079 Could not find the EJB in JNDI
                Andy Gibson Novice

                The problem is that CDI doesn't work with EJBs without a @local interface, so for the EJB, you need to extract the methods to an interface, implement the interface in the class, and then mark the interface with the EJB @Local annotation. It's like without the Local interface its an anonymous EJB that CDI can't find. 

                Alternatively, I released a set of Java EE 6 Maven Archetypes called Knappsack which were based on the Weld Archetypes that fixes the problems and includes a full Java EE 6 demo application using JSF, JPA and CDI that works with JBoss 6 M3 at least (I haven't tested it on M4 yet) and Glassfish v3.0.1.


                Andy Gibson

                • 5. Re: WELD-000079 Could not find the EJB in JNDI
                  Nicklas Karlsson Master

                  Viewless EJBs should be working in M4 (has been since around JBW)

                  • 6. Re: WELD-000079 Could not find the EJB in JNDI
                    Susanne Jarl Newbie

                    Thanks! I got it working by adding a @local interface.

                    I would really like to have an EAR archetype. One common use case, I guess, is when you want to have one WAR for the standard web site and one WAR for your mobile web site and point them to different domains e.g. example.com and mobile.example.com.

                    • 7. Re: WELD-000079 Could not find the EJB in JNDI
                      nimo stephan Master

                      Yes, it would be really nice to have an EAR-Archetype. EAR is still needed and has its sense in the ejb-world.

                      I like the knappsack-archetypes and it would be fine to support these archetypes within org.jboss.weld.archetypes.