Opa galera beleza?
Estava algum tempo atrás tentando iniciar com EJB 3.0 mais tive problemas, agora voltando estou encontrando o mesmo problema novamente…
Estou utilizando o livro EJB 3 em ação e o JBoss como servidor de aplicação.
Cheguei no primeiro exemplo do livro agora e estou tentando fazer funcionar , vendo que ele está incompleto.
Abaixo segue minhas classes:
HelloUser (Interface)
[code]package ejb3inaction.example;
import javax.ejb.Local;
@Local
public interface HelloUser {
public void sayHello(String name);
}
[/code]
HelloUserBean:
[code]
package ejb3inaction.example;
import javax.ejb.Stateless;
@Stateless
public class HelloUserBean implements HelloUser {
public void sayHello(String name) {
System.out.println("Hello: " + name + " welcome to EJB3");
}
}[/code]
QUando vou subir a aplicação tenho isto no console:
[code]21:28:37,921 INFO [ServerImpl] Starting JBoss (Microcontainer)…
21:28:37,936 INFO [ServerImpl] Release ID: JBoss [The Oracle] 5.1.0.GA (build: SVNTag=JBoss_5_1_0_GA date=200905221053)
21:28:37,937 INFO [ServerImpl] Bootstrap URL: null
21:28:37,937 INFO [ServerImpl] Home Dir: C:\jboss-5.1.0.GA
21:28:37,938 INFO [ServerImpl] Home URL: file:/C:/jboss-5.1.0.GA/
21:28:37,938 INFO [ServerImpl] Library URL: file:/C:/jboss-5.1.0.GA/lib/
21:28:37,941 INFO [ServerImpl] Patch URL: null
21:28:37,941 INFO [ServerImpl] Common Base URL: file:/C:/jboss-5.1.0.GA/common/
21:28:37,942 INFO [ServerImpl] Common Library URL: file:/C:/jboss-5.1.0.GA/common/lib/
21:28:37,947 INFO [ServerImpl] Server Name: default
21:28:37,947 INFO [ServerImpl] Server Base Dir: C:\jboss-5.1.0.GA\server
21:28:37,948 INFO [ServerImpl] Server Base URL: file:/C:/jboss-5.1.0.GA/server/
21:28:37,948 INFO [ServerImpl] Server Config URL: file:/C:/jboss-5.1.0.GA/server/default/conf/
21:28:37,948 INFO [ServerImpl] Server Home Dir: C:\jboss-5.1.0.GA\server\default
21:28:37,948 INFO [ServerImpl] Server Home URL: file:/C:/jboss-5.1.0.GA/server/default/
21:28:37,948 INFO [ServerImpl] Server Data Dir: C:\jboss-5.1.0.GA\server\default\data
21:28:37,949 INFO [ServerImpl] Server Library URL: file:/C:/jboss-5.1.0.GA/server/default/lib/
21:28:37,949 INFO [ServerImpl] Server Log Dir: C:\jboss-5.1.0.GA\server\default\log
21:28:37,949 INFO [ServerImpl] Server Native Dir: C:\jboss-5.1.0.GA\server\default\tmp\native
21:28:37,949 INFO [ServerImpl] Server Temp Dir: C:\jboss-5.1.0.GA\server\default\tmp
21:28:37,950 INFO [ServerImpl] Server Temp Deploy Dir: C:\jboss-5.1.0.GA\server\default\tmp\deploy
21:28:38,918 INFO [ServerImpl] Starting Microcontainer, bootstrapURL=file:/C:/jboss-5.1.0.GA/server/default/conf/bootstrap.xml
21:28:40,004 INFO [VFSCacheFactory] Initializing VFSCache [org.jboss.virtual.plugins.cache.CombinedVFSCache]
21:28:40,008 INFO [VFSCacheFactory] Using VFSCache [CombinedVFSCache[real-cache: null]]
21:28:40,526 INFO [CopyMechanism] VFS temp dir: C:\jboss-5.1.0.GA\server\default\tmp
21:28:40,551 INFO [ZipEntryContext] VFS force nested jars copy-mode is enabled.
21:28:42,445 INFO [ServerInfo] Java version: 1.6.0_18,Sun Microsystems Inc.
21:28:42,447 INFO [ServerInfo] Java Runtime: Java™ SE Runtime Environment (build 1.6.0_18-b07)
21:28:42,447 INFO [ServerInfo] Java VM: Java HotSpot™ Client VM 16.0-b13,Sun Microsystems Inc.
21:28:42,447 INFO [ServerInfo] OS-System: Windows Vista 6.0,x86
21:28:42,459 INFO [ServerInfo] VM arguments: -Dprogram.name=JBossTools: JBoss 5.1 Runtime 1 -Xms256m -Xmx512m -XX:MaxPermSize=256m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djava.endorsed.dirs=C:\jboss-5.1.0.GA\lib\endorsed -Dfile.encoding=Cp1252
21:28:42,522 INFO [JMXKernel] Legacy JMX core initialized
21:28:44,887 INFO [ProfileServiceBootstrap] Loading profile: ProfileKey@1e3bfb6[domain=default, server=default, name=default]
21:28:47,384 INFO [WebService] Using RMI server codebase: http://localhost:8083/
21:28:57,321 INFO [NativeServerConfig] JBoss Web Services - Stack Native Core
21:28:57,322 INFO [NativeServerConfig] 3.1.2.GA
21:28:58,889 INFO [AttributeCallbackItem] Owner callback not implemented.
21:29:00,757 INFO [LogNotificationListener] Adding notification listener for logging mbean “jboss.system:service=Logging,type=Log4jService” to server org.jboss.mx.server.MBeanServerImpl@1402eeb[ defaultDomain=‘jboss’ ]
21:29:24,897 INFO [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@27238286{vfsfile:/C:/jboss-5.1.0.GA/server/default/deploy/profileservice-secured.jar/}
21:29:24,899 INFO [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@27238286{vfsfile:/C:/jboss-5.1.0.GA/server/default/deploy/profileservice-secured.jar/}
21:29:24,899 INFO [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@27238286{vfsfile:/C:/jboss-5.1.0.GA/server/default/deploy/profileservice-secured.jar/}
21:29:24,899 INFO [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@27238286{vfsfile:/C:/jboss-5.1.0.GA/server/default/deploy/profileservice-secured.jar/}
21:29:28,901 INFO [JMXConnectorServerService] JMX Connector server: service:jmx:rmi://localhost/jndi/rmi://localhost:1090/jmxconnector
21:29:29,170 INFO [MailService] Mail Service bound to java:/Mail
21:29:33,626 WARN [JBossASSecurityMetadataStore] WARNING! POTENTIAL SECURITY RISK. It has been detected that the MessageSucker component which sucks messages from one node to another has not had its password changed from the installation default. Please see the JBoss Messaging user guide for instructions on how to do this.
21:29:33,657 WARN [AnnotationCreator] No ClassLoader provided, using TCCL: org.jboss.managed.api.annotation.ManagementComponent
21:29:33,838 WARN [AnnotationCreator] No ClassLoader provided, using TCCL: org.jboss.managed.api.annotation.ManagementComponent
21:29:33,955 INFO [TransactionManagerService] JBossTS Transaction Service (JTA version - tag:JBOSSTS_4_6_1_GA) - JBoss Inc.
21:29:33,955 INFO [TransactionManagerService] Setting up property manager MBean and JMX layer
21:29:34,408 INFO [TransactionManagerService] Initializing recovery manager
21:29:34,709 INFO [TransactionManagerService] Recovery manager configured
21:29:34,710 INFO [TransactionManagerService] Binding TransactionManager JNDI Reference
21:29:34,767 INFO [TransactionManagerService] Starting transaction recovery manager
21:29:35,697 INFO [AprLifecycleListener] The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre6\bin;.;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;native
21:29:35,821 INFO [Http11Protocol] Initializing Coyote HTTP/1.1 on http-localhost%2F127.0.0.1-8080
21:29:35,823 INFO [AjpProtocol] Initializing Coyote AJP/1.3 on ajp-localhost%2F127.0.0.1-8009
21:29:35,875 INFO [StandardService] Starting service jboss.web
21:29:35,879 INFO [StandardEngine] Starting Servlet Engine: JBoss Web/2.1.3.GA
21:29:36,142 INFO [Catalina] Server startup in 318 ms
21:29:36,209 INFO [TomcatDeployment] deploy, ctxPath=/invoker
21:29:38,106 INFO [TomcatDeployment] deploy, ctxPath=/web-console
21:29:38,701 INFO [TomcatDeployment] deploy, ctxPath=/jbossws
21:29:38,911 INFO [RARDeployment] Required license terms exist, view vfszip:/C:/jboss-5.1.0.GA/server/default/deploy/jboss-local-jdbc.rar/META-INF/ra.xml
21:29:38,935 INFO [RARDeployment] Required license terms exist, view vfszip:/C:/jboss-5.1.0.GA/server/default/deploy/jboss-xa-jdbc.rar/META-INF/ra.xml
21:29:38,989 INFO [RARDeployment] Required license terms exist, view vfszip:/C:/jboss-5.1.0.GA/server/default/deploy/jms-ra.rar/META-INF/ra.xml
21:29:39,026 INFO [RARDeployment] Required license terms exist, view vfszip:/C:/jboss-5.1.0.GA/server/default/deploy/mail-ra.rar/META-INF/ra.xml
21:29:39,087 INFO [RARDeployment] Required license terms exist, view vfszip:/C:/jboss-5.1.0.GA/server/default/deploy/quartz-ra.rar/META-INF/ra.xml
21:29:39,261 INFO [SimpleThreadPool] Job execution threads will use class loader of thread: main
21:29:39,308 INFO [QuartzScheduler] Quartz Scheduler v.1.5.2 created.
21:29:39,313 INFO [RAMJobStore] RAMJobStore initialized.
21:29:39,314 INFO [StdSchedulerFactory] Quartz scheduler ‘DefaultQuartzScheduler’ initialized from default resource file in Quartz package: 'quartz.properties’
21:29:39,314 INFO [StdSchedulerFactory] Quartz scheduler version: 1.5.2
21:29:39,314 INFO [QuartzScheduler] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started.
21:29:40,239 INFO [ConnectionFactoryBindingService] Bound ConnectionManager ‘jboss.jca:service=DataSourceBinding,name=DefaultDS’ to JNDI name 'java:DefaultDS’
21:29:41,969 INFO [ServerPeer] JBoss Messaging 1.4.3.GA server [0] started
21:29:42,121 INFO [ConnectionFactoryJNDIMapper] supportsFailover attribute is true on connection factory: jboss.messaging.connectionfactory:service=ClusteredConnectionFactory but post office is non clustered. So connection factory will not support failover
21:29:42,121 INFO [ConnectionFactoryJNDIMapper] supportsLoadBalancing attribute is true on connection factory: jboss.messaging.connectionfactory:service=ClusteredConnectionFactory but post office is non clustered. So connection factory will not support load balancing
21:29:42,214 INFO [ConnectionFactory] Connector bisocket://localhost:4457 has leasing enabled, lease period 10000 milliseconds
21:29:42,214 INFO [ConnectionFactory] org.jboss.jms.server.connectionfactory.ConnectionFactory@cf58d7 started
21:29:42,246 INFO [QueueService] Queue[/queue/ExpiryQueue] started, fullSize=200000, pageSize=2000, downCacheSize=2000
21:29:42,249 INFO [QueueService] Queue[/queue/DLQ] started, fullSize=200000, pageSize=2000, downCacheSize=2000
21:29:42,251 INFO [ConnectionFactory] Connector bisocket://localhost:4457 has leasing enabled, lease period 10000 milliseconds
21:29:42,251 INFO [ConnectionFactory] org.jboss.jms.server.connectionfactory.ConnectionFactory@11325d3 started
21:29:42,253 INFO [ConnectionFactory] Connector bisocket://localhost:4457 has leasing enabled, lease period 10000 milliseconds
21:29:42,254 INFO [ConnectionFactory] org.jboss.jms.server.connectionfactory.ConnectionFactory@192ba63 started
21:29:42,444 INFO [ConnectionFactoryBindingService] Bound ConnectionManager ‘jboss.jca:service=ConnectionFactoryBinding,name=JmsXA’ to JNDI name 'java:JmsXA’
21:29:43,403 INFO [JBossASKernel] Created KernelDeployment for: profileservice-secured.jar
21:29:43,410 INFO [JBossASKernel] installing bean: jboss.j2ee:jar=profileservice-secured.jar,name=SecureProfileService,service=EJB3
21:29:43,411 INFO [JBossASKernel] with dependencies:
21:29:43,411 INFO [JBossASKernel] and demands:
21:29:43,411 INFO [JBossASKernel] jndi:SecureManagementView/remote-org.jboss.deployers.spi.management.ManagementView
21:29:43,411 INFO [JBossASKernel] jboss.ejb:service=EJBTimerService
21:29:43,411 INFO [JBossASKernel] and supplies:
21:29:43,412 INFO [JBossASKernel] Class:org.jboss.profileservice.spi.ProfileService
21:29:43,412 INFO [JBossASKernel] jndi:SecureProfileService/remote
21:29:43,413 INFO [JBossASKernel] jndi:SecureProfileService/remote-org.jboss.profileservice.spi.ProfileService
21:29:43,413 INFO [JBossASKernel] Added bean(jboss.j2ee:jar=profileservice-secured.jar,name=SecureProfileService,service=EJB3) to KernelDeployment of: profileservice-secured.jar
21:29:43,414 INFO [JBossASKernel] installing bean: jboss.j2ee:jar=profileservice-secured.jar,name=SecureDeploymentManager,service=EJB3
21:29:43,415 INFO [JBossASKernel] with dependencies:
21:29:43,415 INFO [JBossASKernel] and demands:
21:29:43,415 INFO [JBossASKernel] jboss.ejb:service=EJBTimerService
21:29:43,415 INFO [JBossASKernel] and supplies:
21:29:43,415 INFO [JBossASKernel] jndi:SecureDeploymentManager/remote-org.jboss.deployers.spi.management.deploy.DeploymentManager
21:29:43,415 INFO [JBossASKernel] Class:org.jboss.deployers.spi.management.deploy.DeploymentManager
21:29:43,416 INFO [JBossASKernel] jndi:SecureDeploymentManager/remote
21:29:43,416 INFO [JBossASKernel] Added bean(jboss.j2ee:jar=profileservice-secured.jar,name=SecureDeploymentManager,service=EJB3) to KernelDeployment of: profileservice-secured.jar
21:29:43,417 INFO [JBossASKernel] installing bean: jboss.j2ee:jar=profileservice-secured.jar,name=SecureManagementView,service=EJB3
21:29:43,417 INFO [JBossASKernel] with dependencies:
21:29:43,417 INFO [JBossASKernel] and demands:
21:29:43,417 INFO [JBossASKernel] jboss.ejb:service=EJBTimerService
21:29:43,418 INFO [JBossASKernel] and supplies:
21:29:43,418 INFO [JBossASKernel] jndi:SecureManagementView/remote-org.jboss.deployers.spi.management.ManagementView
21:29:43,418 INFO [JBossASKernel] Class:org.jboss.deployers.spi.management.ManagementView
21:29:43,418 INFO [JBossASKernel] jndi:SecureManagementView/remote
21:29:43,418 INFO [JBossASKernel] Added bean(jboss.j2ee:jar=profileservice-secured.jar,name=SecureManagementView,service=EJB3) to KernelDeployment of: profileservice-secured.jar
21:29:43,430 INFO [EJB3EndpointDeployer] Deploy AbstractBeanMetaData@5b660d{name=jboss.j2ee:jar=profileservice-secured.jar,name=SecureProfileService,service=EJB3_endpoint bean=org.jboss.ejb3.endpoint.deployers.impl.EndpointImpl properties=[container] constructor=null autowireCandidate=true}
21:29:43,430 INFO [EJB3EndpointDeployer] Deploy AbstractBeanMetaData@639310{name=jboss.j2ee:jar=profileservice-secured.jar,name=SecureDeploymentManager,service=EJB3_endpoint bean=org.jboss.ejb3.endpoint.deployers.impl.EndpointImpl properties=[container] constructor=null autowireCandidate=true}
21:29:43,431 INFO [EJB3EndpointDeployer] Deploy AbstractBeanMetaData@1a970{name=jboss.j2ee:jar=profileservice-secured.jar,name=SecureManagementView,service=EJB3_endpoint bean=org.jboss.ejb3.endpoint.deployers.impl.EndpointImpl properties=[container] constructor=null autowireCandidate=true}
21:29:43,592 INFO [SessionSpecContainer] Starting jboss.j2ee:jar=profileservice-secured.jar,name=SecureDeploymentManager,service=EJB3
21:29:43,607 INFO [EJBContainer] STARTED EJB: org.jboss.profileservice.ejb.SecureDeploymentManager ejbName: SecureDeploymentManager
21:29:43,703 INFO [JndiSessionRegistrarBase] Binding the following Entries in Global JNDI:
SecureDeploymentManager/remote - EJB3.x Default Remote Business Interface
SecureDeploymentManager/remote-org.jboss.deployers.spi.management.deploy.DeploymentManager - EJB3.x Remote Business Interface
21:29:43,813 INFO [SessionSpecContainer] Starting jboss.j2ee:jar=profileservice-secured.jar,name=SecureManagementView,service=EJB3
21:29:43,814 INFO [EJBContainer] STARTED EJB: org.jboss.profileservice.ejb.SecureManagementView ejbName: SecureManagementView
21:29:43,840 INFO [JndiSessionRegistrarBase] Binding the following Entries in Global JNDI:
SecureManagementView/remote - EJB3.x Default Remote Business Interface
SecureManagementView/remote-org.jboss.deployers.spi.management.ManagementView - EJB3.x Remote Business Interface
21:29:43,931 INFO [SessionSpecContainer] Starting jboss.j2ee:jar=profileservice-secured.jar,name=SecureProfileService,service=EJB3
21:29:43,933 INFO [EJBContainer] STARTED EJB: org.jboss.profileservice.ejb.SecureProfileServiceBean ejbName: SecureProfileService
21:29:43,950 INFO [JndiSessionRegistrarBase] Binding the following Entries in Global JNDI:
SecureProfileService/remote - EJB3.x Default Remote Business Interface
SecureProfileService/remote-org.jboss.profileservice.spi.ProfileService - EJB3.x Remote Business Interface
21:29:44,318 INFO [TomcatDeployment] deploy, ctxPath=/admin-console
21:29:44,563 INFO [config] Initializing Mojarra (1.2_12-b01-FCS) for context '/admin-console’
21:29:49,506 INFO [TomcatDeployment] deploy, ctxPath=/
21:29:49,654 INFO [TomcatDeployment] deploy, ctxPath=/jmx-console
21:29:49,811 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-localhost%2F127.0.0.1-8080
21:29:49,843 INFO [AjpProtocol] Starting Coyote AJP/1.3 on ajp-localhost%2F127.0.0.1-8009
21:29:49,853 INFO [ServerImpl] JBoss (Microcontainer) [5.1.0.GA (build: SVNTag=JBoss_5_1_0_GA date=200905221053)] Started in 1m:11s:901ms[/code]
Em nenhum lugar vejo um registro JNDI , já fui pelo localhost ver os JNDI e nenhum está configurado para meu ejb, o que devo fazer?
Abraço e obrigado desde já.