Erro ao chamar o ejb

Bom dia senhores.

Tenho uma aplicação que usar ejb3, quando ela chama o ejb na minha maquina windows funciona sem problemas, mas quando eu coloco a mesma aplicação em uma maquina linux, não funciona, será que é necessario fazer alguma configueração adcional para o ejb funcionar no linux ?

Object home = context.lookup("ConsultaCEPBean/remote");  
javax.naming.NameNotFoundException: ConsultaCEPBean not bound

Att

Como assim, “chamar” o EJB? Sua aplicação está no mesmo contêiner que o AS, ou está fora? Aliás, qual AS você está usando? Quais as configurações de JNDI você está usando? Você verificou os IP’s (da máquina Windows e da Linux?)

[]'s

Bom dia

Estou usando jboss as 6,

Na realidade o erro e esse

2011-12-28 08:59:47,261 ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] (ResourceContainer.invoker.nonDaemon-3) Error installing to Create: name=jboss.j2ee:jar=saaejb.jar,name=ConsultaCEPBean,service=EJB3 state=Configured: java.lang.IllegalArgumentException: EntityManagerFactory cannot be null

[quote=claudemir ramos]Bom dia

Estou usando jboss as 6,

Na realidade o erro e esse

[code]
2011-12-28 08:59:47,261 ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] (ResourceContainer.invoker.nonDaemon-3) Error installing to Create: name=jboss.j2ee:jar=saaejb.jar,name=ConsultaCEPBean,service=EJB3 state=Configured: java.lang.IllegalArgumentException: EntityManagerFactory cannot be null

[/code][/quote]

Então, na realidade, ele não está instalando o EntityManager. Qual a configuração do seu persistence.xml ?

Boa tarde asaudate

Na realidade eu nao to usando persistence.xml, eu uso datasource que fica na pasta deploy de jboss utilizando o metodo abaixo.


private synchronized DataSource getDataSource() {
	java.util.Properties env = new java.util.Properties();
	DataSource ds = null;
	try {
		//Produção
	  env.setProperty("java.naming.factory.initial",
					  "org.jnp.interfaces.NamingContextFactory");
	  env.setProperty("java.naming.provider.url", "jnp://localhost:1099");
	  env.setProperty("java.naming.factory.url.pkgs",
					  "org.jboss.naming:org.jnp.interfaces");
		//Produção
	  Context ctx = new InitialContext();
	  
	  ds = (DataSource) ctx.lookup("java:/testeDS");
	  
	}
	catch (NamingException ex) {
	  System.out.println("NamingException\n" + ex.getExplanation());
	}
	return ds;
  }

No meu codigo não faço referencia a class EntityManagerFactory, o estranho e que quando eu rodo na minha maquina (windows) funciona, quando eu coloco no servidor (linux) da erro.

Valeuu…

Estranho, ele está dando falta da EntityManagerFactory para fazer algum deploy. Está utilizando alguma coisa de JPA (@Entity, EntityManager (sem ser factory), etc.?). Outra coisa, o código que está fazendo lookup está na mesma máquina (localhost) ? A porta 1099 está liberada pelo firewall? E o protocolo RMI?

[]'s

Boa tarde asaudate

Segui abaixo as notações que estou utilizando:

@Remote
public interface ConsultaCEP{

public void buscarCep(String numero);
@Singleton
@Startup
public class ConsultaCEPBean implements ConsultaCEP{

	private RepositorioCep repositorioCep;

	@PostConstruct
	public void init() {
		repositorioCep= new RepositorioCep ();
	}

	@Lock(LockType.READ)
	@Override
	public void buscarCep(String numero) throws PortalException {
		return repositorioCep
				.buscarCep(numero);
	}
}
public class DelegateCep {

	private ConsultaCEP consultaCEP ;

	public DelegateCep () throws PortalException {
		try {
			consultaCEP = (consultaCEP ) EJBUtil
					.getSessionBean(ConsultaCEPBean.class
							.getSimpleName());
		} catch (NamingException ex) {
			throw new PortalException(ex);
		}
	}

	public boolean buscarCep(String numero) throws PortalException {
		try {
			return consultaCEP.buscarCep(numero);
		} catch (RemoteException e) {
			throw new PortalException(e);
		}
	}

Com relação as perguntas porta 1099 está liberada pelo firewall? E o protocolo RMI?

Vou verificar com o administrador de rede.

Boa tarde

Segui abaixo o log e erro + detalhado

2011-12-28 09:03:15,405 INFO  [org.jboss.ejb3.singleton.deployer.SingletonContainerDeployer] (ResourceContainer.invoker.nonDaemon-4) Installing container for EJB ConsultarCepBean
2011-12-28 09:03:15,405 INFO  [org.jboss.ejb3.singleton.deployer.SingletonContainerDeployer] (ResourceContainer.invoker.nonDaemon-4) with dependencies: 
2011-12-28 09:03:15,405 INFO  [org.jboss.ejb3.singleton.deployer.SingletonContainerDeployer] (ResourceContainer.invoker.nonDaemon-4) with demands: 
2011-12-28 09:03:15,405 INFO  [org.jboss.ejb3.singleton.deployer.SingletonContainerDeployer] (ResourceContainer.invoker.nonDaemon-4) with supplies: 
2011-12-28 09:03:15,405 INFO  [org.jboss.ejb3.singleton.deployer.SingletonContainerDeployer] (ResourceContainer.invoker.nonDaemon-4) Class:br.com.teste.fachada.ConsultarCep
2011-12-28 09:03:15,408 INFO  [org.jboss.ejb3.singleton.deployer.SingletonBeanJNDIBinderDeployer] (ResourceContainer.invoker.nonDaemon-4) Binding the following entries in JNDI for singleton bean: ConsultarCepBean

ConsultarCepBean/remote		->EJB3.x Default Remote Business Interface
ConsultarCepBean/remote-br.com.teste.fachada.ConsultarCep        ->EJB3.x Remote Business Interface
2011-12-28 08:59:47,279 ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] (ResourceContainer.invoker.nonDaemon-3) Error installing to Create: name=jboss.j2ee:jar=saaejb.jar,name=ConsultarCepBean,service=EJB3 state=Configured: java.lang.IllegalArgumentException: EntityManagerFactory cannot be null
	at org.jboss.ejb3.timerservice.mk2.TimerServiceImpl.<init>(TimerServiceImpl.java:139) [:1.0.0-alpha-13]
	at org.jboss.ejb3.timerservice.mk2.TimerServiceFactoryImpl.createTimerService(TimerServiceFactoryImpl.java:79) [:1.0.0-alpha-13]
	at org.jboss.ejb3.TimerServiceContainer.createTimerService(TimerServiceContainer.java:234) [:1.7.21]
	at org.jboss.ejb3.TimerServiceContainer.create(TimerServiceContainer.java:107) [:1.7.21]
	at org.jboss.ejb3.singleton.aop.impl.AOPBasedSingletonContainer.create(AOPBasedSingletonContainer.java:214) [:1.0.2]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_26]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) [:1.6.0_26]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [:1.6.0_26]
	at java.lang.reflect.Method.invoke(Unknown Source) [:1.6.0_26]
	at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:60) [jboss-reflect.jar:2.2.1.SP1]
	at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:168) [jboss-reflect.jar:2.2.1.SP1]
	at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66) [jboss-reflect.jar:2.2.1.SP1]
	at org.jboss.kernel.plugins.dependency.KernelControllerContextAction$JoinpointDispatchWrapper.execute(KernelControllerContextAction.java:257) [jboss-kernel.jar:2.2.0.SP2]
	at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:47) [jboss-kernel.jar:2.2.0.SP2]
	at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:125) [jboss-kernel.jar:2.2.0.SP2]
	at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:72) [jboss-kernel.jar:2.2.0.SP2]
	at org.jboss.kernel.plugins.dependency.LifecycleAction.installActionInternal(LifecycleAction.java:202) [jboss-kernel.jar:2.2.0.SP2]
	at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54) [jboss-kernel.jar:2.2.0.SP2]
	at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:42) [jboss-kernel.jar:2.2.0.SP2]
	at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62) [jboss-dependency.jar:2.2.0.SP2]
	at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71) [jboss-dependency.jar:2.2.0.SP2]
	at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51) [jboss-dependency.jar:2.2.0.SP2]
	at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:379) [jboss-dependency.jar:2.2.0.SP2]
	at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:2044) [jboss-dependency.jar:2.2.0.SP2]
	at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:1083) [jboss-dependency.jar:2.2.0.SP2]
	at org.jboss.dependency.plugins.AbstractController.executeOrIncrementStateDirectly(AbstractController.java:1322) [jboss-dependency.jar:2.2.0.SP2]
	at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1246) [jboss-dependency.jar:2.2.0.SP2]
	at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1139) [jboss-dependency.jar:2.2.0.SP2]
	at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:894) [jboss-dependency.jar:2.2.0.SP2]
	at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:641) [jboss-dependency.jar:2.2.0.SP2]
	at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:182) [:2.2.2.GA]
	at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:58) [:2.2.2.GA]
	at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:63) [:2.2.2.GA]
	at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:55) [:2.2.2.GA]
	at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:179) [:2.2.2.GA]
	at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1832) [:2.2.2.GA]
	at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1550) [:2.2.2.GA]
	at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1571) [:2.2.2.GA]
	at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1491) [:2.2.2.GA]
	at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:379) [jboss-dependency.jar:2.2.0.SP2]
	at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:2044) [jboss-dependency.jar:2.2.0.SP2]
	at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:1083) [jboss-dependency.jar:2.2.0.SP2]
	at org.jboss.dependency.plugins.AbstractController.executeOrIncrementStateDirectly(AbstractController.java:1322) [jboss-dependency.jar:2.2.0.SP2]
	at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1246) [jboss-dependency.jar:2.2.0.SP2]
	at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1139) [jboss-dependency.jar:2.2.0.SP2]
	at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:939) [jboss-dependency.jar:2.2.0.SP2]
	at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:654) [jboss-dependency.jar:2.2.0.SP2]
	at org.jboss.deployers.plugins.deployers.DeployersImpl.change(DeployersImpl.java:1983) [:2.2.2.GA]
	at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:1076) [:2.2.2.GA]
	at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:679) [:2.2.2.GA]
	at org.jboss.system.server.profileservice.deployers.MainDeployerPlugin.process(MainDeployerPlugin.java:106) [:6.1.0.Final]
	at org.jboss.profileservice.dependency.ProfileControllerContext$DelegateDeployer.process(ProfileControllerContext.java:143) [:0.2.2]
	at org.jboss.profileservice.plugins.deploy.actions.DeploymentStartAction.doPrepare(DeploymentStartAction.java:98) [:0.2.2]
	at org.jboss.profileservice.management.actions.AbstractTwoPhaseModificationAction.prepare(AbstractTwoPhaseModificationAction.java:101) [:0.2.2]
	at org.jboss.profileservice.management.ModificationSession.prepare(ModificationSession.java:87) [:0.2.2]
	at org.jboss.profileservice.management.AbstractActionController.internalPerfom(AbstractActionController.java:234) [:0.2.2]
	at org.jboss.profileservice.management.AbstractActionController.performWrite(AbstractActionController.java:213) [:0.2.2]
	at org.jboss.profileservice.management.AbstractActionController.perform(AbstractActionController.java:150) [:0.2.2]
	at org.jboss.profileservice.plugins.deploy.AbstractDeployHandler.startDeployments(AbstractDeployHandler.java:168) [:0.2.2]
	at org.jboss.profileservice.management.upload.remoting.DeployHandlerDelegate.startDeployments(DeployHandlerDelegate.java:74) [:6.1.0.Final]
	at org.jboss.profileservice.management.upload.remoting.DeployHandler.invoke(DeployHandler.java:156) [:6.1.0.Final]
	at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:967) [:6.1.0.Final]
	at org.jboss.remoting.transport.local.LocalClientInvoker.invoke(LocalClientInvoker.java:106) [:6.1.0.Final]
	at org.jboss.remoting.Client.invoke(Client.java:2070) [:6.1.0.Final]
	at org.jboss.remoting.Client.invoke(Client.java:879) [:6.1.0.Final]
	at org.jboss.profileservice.management.client.upload.StreamingDeploymentTarget.invoke(StreamingDeploymentTarget.java:312) [:6.1.0.Final]
	at org.jboss.profileservice.management.client.upload.StreamingDeploymentTarget.start(StreamingDeploymentTarget.java:197) [:6.1.0.Final]
	at org.jboss.profileservice.management.client.upload.DeploymentProgressImpl.start(DeploymentProgressImpl.java:232) [:6.1.0.Final]
	at org.jboss.profileservice.management.client.upload.DeploymentProgressImpl.run(DeploymentProgressImpl.java:89) [:6.1.0.Final]
	at org.rhq.plugins.jbossas5.util.DeploymentUtils.run(DeploymentUtils.java:155)
	at org.rhq.plugins.jbossas5.AbstractManagedDeploymentComponent.invokeOperation(AbstractManagedDeploymentComponent.java:162)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_26]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) [:1.6.0_26]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [:1.6.0_26]
	at java.lang.reflect.Method.invoke(Unknown Source) [:1.6.0_26]
	at org.rhq.core.pc.inventory.ResourceContainer$ComponentInvocationThread.call(ResourceContainer.java:525)
	at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) [:1.6.0_26]
	at java.util.concurrent.FutureTask.run(Unknown Source) [:1.6.0_26]
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) [:1.6.0_26]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [:1.6.0_26]
	at java.lang.Thread.run(Unknown Source) [:1.6.0_26]

Diz no stack trace que esse problema está no TimerService, que usa a persistência para manter o estado dos timers. Você está usando Timer Service? Ou removeu algum datasource nativo do JBoss para colocar o seu?