1个带有jboss7.1final和eclipse的样本。 我的客户代码如下
final Hashtable<Object,Object> jndiProperties = new Hashtable<Object,Object>();
jndiProperties.put(InitialContext.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
jndiProperties.put(InitialContext.PROVIDER_URL, "remote://localhost:4447");
jndiProperties.put("jboss.naming.client.ejb.context", true);
jndiProperties.put("jboss.naming.client.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT", "false");
final Context context = new InitialContext(jndiProperties);
System.out.println("Initial context created");
ExampleBeanRemote exampleBean = (ExampleBeanRemote) context.lookup("ExampleBean/remote");
System.out.println("Message from Bean :" + exampleBean.getMessage());
} catch (Exception e) {
e.printStackTrace();
}
我收到以下错误:
20:17:14,086 INFO [org.jboss.modules] JBoss Modules version 1.1.1.GA
20:17:14,617 INFO [org.jboss.msc] JBoss MSC version 1.0.2.GA
20:17:14,692 INFO [org.jboss.as] JBAS015899: JBoss AS 7.1.1.Final "Brontes" starting
20:17:18,355 INFO [org.xnio] XNIO Version 3.0.3.GA
20:17:18,355 INFO [org.jboss.as.server] JBAS015888: Creating http management service using socket-binding (management-http)
20:17:18,370 INFO [org.xnio.nio] XNIO NIO Implementation Version 3.0.3.GA
20:17:18,377 INFO [org.jboss.remoting] JBoss Remoting version 3.2.3.GA
20:17:18,434 INFO [org.jboss.as.configadmin] JBAS016200: Activating ConfigAdmin Subsystem
20:17:18,448 INFO [org.jboss.as.osgi] JBAS011940: Activating OSGi Subsystem
20:17:18,471 INFO [org.jboss.as.clustering.infinispan] JBAS010280: Activating Infinispan subsystem.
20:17:18,473 INFO [org.jboss.as.security] JBAS013101: Activating Security Subsystem
20:17:18,483 INFO [org.jboss.as.naming] JBAS011800: Activating Naming Subsystem
20:17:18,502 INFO [org.jboss.as.webservices] JBAS015537: Activating WebServices Extension
20:17:18,502 INFO [org.jboss.as.logging] JBAS011502: Removing bootstrap log handlers
20:17:18,608 INFO [org.jboss.as.connector] (MSC service thread 1-8) JBAS010408: Starting JCA Subsystem (JBoss IronJacamar 1.0.9.Final)
20:17:18,631 INFO [org.jboss.as.naming] (MSC service thread 1-6) JBAS011802: Starting Naming Service
20:17:18,784 INFO [org.jboss.as.mail.extension] (MSC service thread 1-8) JBAS015400: Bound mail session [java:jboss/mail/Default]
20:17:18,976 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
20:17:19,551 INFO [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-7) Starting Coyote HTTP/1.1 on http-localhost-127.0.0.1-8080
20:17:20,951 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-8) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
20:17:22,106 INFO [org.jboss.ws.common.management.AbstractServerConfig] (MSC service thread 1-6) JBoss Web Services - Stack CXF Server 4.0.2.GA
20:17:22,822 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-6) JBAS015012: Started FileSystemDeploymentService for directory C:\param\learning\softwares\jboss-as-7.1.1.Final\jboss-as-7.1.1.Final\standalone\deployments
20:17:22,828 INFO [org.jboss.as.remoting] (MSC service thread 1-7) JBAS017100: Listening on localhost/127.0.0.1:8999
20:17:22,829 INFO [org.jboss.as.remoting] (MSC service thread 1-8) JBAS017100: Listening on localhost/127.0.0.1:4447
20:17:22,831 INFO [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) JBAS015003: Found EjbExample.jar in deployment directory. To trigger deployment create a file called EjbExample.jar.dodeploy
20:17:23,272 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015876: Starting deployment of "EjbExample.jar"
20:17:23,381 WARN [org.jboss.as.server.deployment] (MSC service thread 1-3) Class Path entry javax.ejb-3.1.jar in "/C:/param/learning/softwares/jboss-as-7.1.1.Final/jboss-as-7.1.1.Final/standalone/deployments/EjbExample.jar" does not point to a valid jar for a Class-Path reference.
20:17:23,384 WARN [org.jboss.as.server.deployment] (MSC service thread 1-3) Class Path entry jboss-client.jar in "/C:/param/learning/softwares/jboss-as-7.1.1.Final/jboss-as-7.1.1.Final/standalone/deployments/EjbExample.jar" does not point to a valid jar for a Class-Path reference.
20:17:23,669 INFO [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-4) JNDI bindings for session bean named ExampleBean in deployment unit deployment "EjbExample.jar" are as follows:
java:global/EjbExample/ExampleBean!com.ejbs.ExampleBeanLocal
java:app/EjbExample/ExampleBean!com.ejbs.ExampleBeanLocal
java:module/ExampleBean!com.ejbs.ExampleBeanLocal
java:global/EjbExample/ExampleBean!com.ejbs.ExampleBeanRemote
java:app/EjbExample/ExampleBean!com.ejbs.ExampleBeanRemote
java:module/ExampleBean!com.ejbs.ExampleBeanRemote
java:jboss/exported/EjbExample/ExampleBean!com.ejbs.ExampleBeanRemote
20:17:23,908 INFO [org.jboss.as] (MSC service thread 1-5) JBAS015951: Admin console listening on http://127.0.0.1:8990
20:17:23,909 INFO [org.jboss.as] (MSC service thread 1-5) JBAS015874: JBoss AS 7.1.1.Final "Brontes" started in 10552ms - Started 173 of 250 services (76 services are passive or on-demand)
20:17:23,977 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018559: Deployed "EjbExample.jar"
**23:35:01,710 INFO [org.jboss.as.naming] (Remoting "par-pc" task-3) JBAS011806: Channel end notification received, closing channel Channel ID 1917e694 (inbound) of Remoting connection 0f6f903c to /127.0.0.1:51061**