6 Replies Latest reply on Oct 16, 2011 7:35 AM by dude0507

    Problem EJB example

    dude0507 Newbie

      Hi, I've this problem when run as server my "Test" EBJ application:

       

       

      14:16:57,942 INFO  [org.jboss.modules] JBoss Modules version 1.0.2.GA
      14:16:58,123 INFO  [org.jboss.msc] JBoss MSC version 1.0.1.GA
      14:16:58,163 INFO  [org.jboss.as] JBoss AS 7.0.2.Final "Arc" starting
      14:16:58,832 WARN  [org.jboss.as] No security realm defined for native management service, all access will be unrestricted.
      14:16:58,867 INFO  [org.jboss.as] creating http management service using network interface (management) port (9990)
      14:16:58,869 WARN  [org.jboss.as] No security realm defined for http management service, all access will be unrestricted.
      14:16:58,875 INFO  [org.jboss.as.logging] Removing bootstrap log handlers
      14:16:58,888 INFO  [org.jboss.as.connector.subsystems.datasources] (Controller Boot Thread) Deploying JDBC-compliant driver class org.h2.Driver (version 1.2)
      14:16:58,898 INFO  [org.jboss.as.clustering.infinispan.subsystem] (Controller Boot Thread) Activating Infinispan subsystem.
      14:16:58,962 INFO  [org.jboss.as.naming] (Controller Boot Thread) JBAS011800: Activating Naming Subsystem
      14:16:58,970 INFO  [org.jboss.as.naming] (MSC service thread 1-3) JBAS011802: Starting Naming Service
      14:16:58,975 INFO  [org.jboss.as.osgi] (Controller Boot Thread) JBAS011910: Activating OSGi Subsystem
      14:16:58,992 INFO  [org.jboss.as.security] (Controller Boot Thread) Activating Security Subsystem
      14:16:58,997 INFO  [org.jboss.remoting] (MSC service thread 1-1) JBoss Remoting version 3.2.0.Beta2
      14:16:59,005 INFO  [org.xnio] (MSC service thread 1-1) XNIO Version 3.0.0.Beta3
      14:16:59,014 INFO  [org.xnio.nio] (MSC service thread 1-1) XNIO NIO Implementation Version 3.0.0.Beta3
      14:16:59,193 INFO  [org.apache.catalina.core.AprLifecycleListener] (MSC service thread 1-4) The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/lib/jvm/java-6-openjdk/jre/lib/i386/server:/usr/lib/jvm/java-6-openjdk/jre/lib/i386:/usr/lib/jvm/java-6-openjdk/jre/../lib/i386:/usr/lib/jvm/java-6-sun-1.6.0.26/jre/lib/i386/client:/usr/lib/jvm/java-6-sun-1.6.0.26/jre/lib/i386::/usr/java/packages/lib/i386:/usr/lib/i386-linux-gnu/jni:/lib/i386-linux-gnu:/usr/lib/i386-linux-gnu:/usr/lib/jni:/lib:/usr/lib
      14:16:59,212 INFO  [org.jboss.as.remoting] (MSC service thread 1-3) Listening on /127.0.0.1:9999
      14:16:59,227 INFO  [org.jboss.as.jmx.JMXConnectorService] (MSC service thread 1-1) Starting remote JMX connector
      14:16:59,227 INFO  [org.jboss.as.ee] (Controller Boot Thread) Activating EE subsystem
      14:16:59,397 INFO  [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-4) Starting Coyote HTTP/1.1 on http--127.0.0.1-8080
      14:16:59,470 INFO  [org.jboss.as.connector] (MSC service thread 1-4) Starting JCA Subsystem (JBoss IronJacamar 1.0.3.Final)
      14:16:59,494 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-4) Bound data source [java:jboss/datasources/ExampleDS]
      14:16:59,765 INFO  [org.jboss.as.deployment] (MSC service thread 1-2) Started FileSystemDeploymentService for directory /home/michele/jboss-as-7.0.2.Final/standalone/deployments
      14:16:59,778 INFO  [org.jboss.as] (Controller Boot Thread) JBoss AS 7.0.2.Final "Arc" started in 2039ms - Started 93 of 148 services (55 services are passive or on-demand)
      14:16:59,769 ERROR [org.jboss.as.deployment] (DeploymentScanner-threads - 1) The deployment scanner found a directory named META-INF that was not inside a directory whose name ends with .ear, .jar, .rar, .sar or .war. This is likely the result of unzipping an archive directly inside the /home/michele/jboss-as-7.0.2.Final/standalone/deployments directory, which is a user error. The META-INF directory will not be scanned for deployments, but it is possible that the scanner mayfind other files from the unzipped archive and attempt to deploy them, leading to errors.
      14:16:59,792 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) Starting deployment of "Testnull"
      14:16:59,833 INFO  [org.jboss.as.jpa] (MSC service thread 1-3) added javax.persistence.api dependency to Testnull
      14:16:59,866 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-1) JNDI bindings for session bean named HelloBean in deployment unit deployment "Testnull" are as follows:
      
          java:global/Testnull/HelloBean!examples.session.stateless.Hello
          java:app/Testnull/HelloBean!examples.session.stateless.Hello
          java:module/HelloBean!examples.session.stateless.Hello
          java:global/Testnull/HelloBean
          java:app/Testnull/HelloBean
          java:module/HelloBean
      
      14:17:00,010 INFO  [org.jboss.as.server.controller] (DeploymentScanner-threads - 2) Deployed "Testnull"
      

       

      Hello.java

       

      package examples.session.stateless;
      
      import javax.ejb.Remote;
      
      @Remote
      public interface Hello 
      {
          public String hello();
      }
      

       

      HelloBean.java

       

      package examples.session.stateless;
      
      import javax.ejb.Stateless;
      import examples.session.stateless.Hello;
      
      public @Stateless class HelloBean implements Hello 
      {
          public String hello()
          {
              System.out.println("hello()");
              return "Hello, World!";
          }
      }
      

       

      TestClient.java

       

      package examples.session.stateless;
      
      import javax.naming.*;
      
      public class TestClient 
      {
          public static void main(String[] args)
          {
              try 
              {
                  Context ctx = new InitialContext();
                  Hello hello = (Hello) ctx.lookup("examples.session.stateless.Hello");
                  System.out.println(hello.hello());
                  
              } catch (Exception e) {
                  System.out.println(e.getMessage());
                  System.exit(-1);
              }
              
          }
      }
      
        • 1. Re: Problem EJB example
          Steve Tarver Newbie

          Looking at the log line

           

          14:16:59,769 ERROR [org.jboss.as.deployment] (DeploymentScanner-threads - 1) The deployment scanner found a directory named META-INF that was not inside a directory whose name ends with .ear, .jar, .rar, .sar or .war. This is likely the result of unzipping an archive directly inside the /home/michele/jboss-as-7.0.2.Final/standalone/deployments directory, which is a user error. The META-INF directory will not be scanned for deployments, but it is possible that the scanner mayfind other files from the unzipped archive and attempt to deploy them, leading to errors. 

          What does a "jar tf" of your jar look like? Is there a META-INF where there should not be as the error indicates?

          • 2. Re: Problem EJB example
            dude0507 Newbie

            <?xml version="1.0" encoding="UTF-8"?>

            <ejb-jar version="3.1" xmlns="http://java.sun.com/xml/ns/javaee"

                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                xsi:schemaLocation="http://java.sun.com/xml/ns/javaee

                http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd">

              <display-name>HelloWorldEJB </display-name>

            </ejb-jar>

             

            Project type: EJB Project

            Bean Type: EJB3 Stateless Bean

             

            The META-INF class is in HelloWorldEJB/ejbModule and I trye to put directly in HelloWorldEJB and there is not the previous problem.

             

             

            20:37:28,009 INFO  [org.jboss.as.jpa] (MSC service thread 1-3) added javax.persistence.api dependency to HelloWorldEJBnull

            20:37:28,033 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-4) JNDI bindings for session bean named HelloBean in deployment unit deployment "HelloWorldEJBnull" are as follows:

             

                java:global/HelloWorldEJBnull/HelloBean!examples.session.stateless.Hello

                java:app/HelloWorldEJBnull/HelloBean!examples.session.stateless.Hello

                java:module/HelloBean!examples.session.stateless.Hello

                java:global/HelloWorldEJBnull/HelloBean

                java:app/HelloWorldEJBnull/HelloBean

                java:module/HelloBean

             

            20:37:28,118 INFO  [org.jboss.as.server.controller] (DeploymentScanner-threads - 2) Deployed "HelloWorldEJBnull"


             

            But I don't understand why the project deployed is named: HelloWorldEJBnull.

            • 3. Re: Problem EJB example
              Wolf-Dieter Fink Master

              What do you use for developing and deploy the example?

              This looks like a configuration problem in your IDE ...

              • 4. Re: Problem EJB example
                dude0507 Newbie

                I use EJBProject and I "Run as Server" in Eclipse with the JBoos Tool 3.3.

                 

                Must I use the Maven project type?

                • 5. Re: Problem EJB example
                  Wolf-Dieter Fink Master

                  It looks like that the Eclipse project is not correct. You might check the tutorials at eclipse.org and build a simple EAR project again following the example.

                  • 6. Re: Problem EJB example
                    dude0507 Newbie

                    I've installed the JBoss Tool for Eclipse.

                     

                    What kind of project should I use for EJB for example?