Problem EJB example
dude0507 Oct 9, 2011 8:37 AMHi, 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); } } }