[jboss-user] [EJB 3.0 Users] - Re: Client calls Timer only once

Fuchs do-not-reply at jboss.com
Tue Oct 20 06:28:23 EDT 2009


Excuse that I have not explained my post enough.
Now, I want to make up this.

build.xml:
The build.xml script generates an *.ejbjar file which is not deployed by my jboss 5.0.1.GA default server. So I changed the build-script to make a *.jar file.
I also changed the directories, where EJB is found, from "/server/default/deploy/ejb3.deployer" to "/server/default/deployers/ejb3.deployer".
The path to "jboss-aop-jdk50.deployer", I changed to "/server/default/deployers/jboss-aop-jboss5.deployer".
That was all what I changed on the server-side.

Client.java:
The client.java in the tutorial looks like this:

  | InitialContext ctx = new InitialContext();
  | ExampleTimer timer = (ExampleTimer)  ctx.lookup(ExampleTimer.class.getName());
  | timer.scheduleTimer(5000);
  | 

It use a "jndi.properties" which looks like this:
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
  | java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
  | java.naming.provider.url=localhost

With this Configuration, I get the following exception:
com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl <init>
  | WARNUNG: "IOP00410201: (COMM_FAILURE) Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: xxx.xx.xx.xxx; port: 900"
  | org.omg.CORBA.COMM_FAILURE:   vmcid: SUN  minor code: 201  completed: No
  | ...
  | Caused by: java.net.ConnectException: Connection refused: connect

900 is the wrong port, so I implemented the following in the client.java:
try {
  |     	  Properties p = new Properties();
  |     	  p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
  |     	  p.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
  |     	  p.put(Context.PROVIDER_URL, "jnp://localhost:1099");
  |     	  Context ctx = new InitialContext(p);
  |     	  Object ref = ctx.lookup("TimerBean/remote");
  |     	  ExampleTimer cbr =(ExampleTimer) PortableRemoteObject.narrow(ref, ExampleTimer.class);
  |     	  cbr.scheduleTimer(5000);
  |         
  |       } catch (NamingException e){
  |     	  e.printStackTrace();
  | }

The next exception was:
javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]
  | ...
  | Caused by: java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory

After I added the jbossall-client.jar it deployed.

I could not reproduce why I added these arguments (-Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory), so I removed them.

Client-Console:
HELLO FROM CLIENT !
  | log4j:WARN No appenders could be found for logger (org.jnp.interfaces.TimedSocketFactory).
  | log4j:WARN Please initialize the log4j system properly.


Server-Console:

  | Jboss start
  | ...
  | 10:58:20,775 INFO  [JndiSessionRegistrarBase] Binding the following Entries in G
  | lobal JNDI:
  | 
  |         SecureDeploymentManager/remote - EJB3.x Default Remote Business Interfac
  | e
  |         SecureDeploymentManager/remote-org.jboss.deployers.spi.management.deploy
  | .DeploymentManager - EJB3.x Remote Business Interface
  | 
  | 10:58:20,934 INFO  [SessionSpecContainer] Starting jboss.j2ee:jar=profileservice
  | -secured.jar,name=SecureManagementView,service=EJB3
  | 10:58:20,934 INFO  [EJBContainer] STARTED EJB: org.jboss.profileservice.ejb.Secu
  | reManagementView ejbName: SecureManagementView
  | 10:58:20,966 INFO  [JndiSessionRegistrarBase] Binding the following Entries in G
  | lobal JNDI:
  | 
  |         SecureManagementView/remote - EJB3.x Default Remote Business Interface
  |         SecureManagementView/remote-org.jboss.deployers.spi.management.Managemen
  | tView - EJB3.x Remote Business Interface
  | 
  | 10:58:21,156 INFO  [SessionSpecContainer] Starting jboss.j2ee:jar=profileservice
  | -secured.jar,name=SecureProfileService,service=EJB3
  | 10:58:21,156 INFO  [EJBContainer] STARTED EJB: org.jboss.profileservice.ejb.Secu
  | reProfileServiceBean ejbName: SecureProfileService
  | 10:58:21,204 INFO  [JndiSessionRegistrarBase] Binding the following Entries in G
  | lobal JNDI:
  | 
  |         SecureProfileService/remote - EJB3.x Default Remote Business Interface
  |         SecureProfileService/remote-org.jboss.profileservice.spi.ProfileService
  | - EJB3.x Remote Business Interface
  | 
  | 10:58:21,744 INFO  [TomcatDeployment] deploy, ctxPath=/admin-console
  | 10:58:22,649 INFO  [config] Initializing Mojarra (1.2_12-b01-FCS) for context '/
  | admin-console'
  | 10:58:29,398 INFO  [TomcatDeployment] deploy, ctxPath=/
  | 10:58:29,763 INFO  [TomcatDeployment] deploy, ctxPath=/jmx-console
  | 10:58:30,001 INFO  [Http11Protocol] Starting Coyote HTTP/1.1 on http-127.0.0.1-8
  | 080
  | 10:58:30,112 INFO  [AjpProtocol] Starting Coyote AJP/1.3 on ajp-127.0.0.1-8009
  | 10:58:30,128 INFO  [ServerImpl] JBoss (Microcontainer) [5.1.0.GA (build: SVNTag=
  | JBoss_5_1_0_GA date=200905221053)] Started in 1m:55s:949ms
  | 
  | 
  | After deploy:
  | 11:01:13,169 INFO  [Ejb3DependenciesDeployer] Encountered deployment AbstractVFS
  | DeploymentContext at 16634496{vfszip:/D:/server/exp-server/jboss-5.1.0.GA/server/de
  | fault/deploy/tutorial.jar/}
  | 11:01:13,201 INFO  [Ejb3DependenciesDeployer] Encountered deployment AbstractVFS
  | DeploymentContext at 16634496{vfszip:/D:/server/exp-server/jboss-5.1.0.GA/server/de
  | fault/deploy/tutorial.jar/}
  | 11:01:13,421 INFO  [JBossASKernel] Created KernelDeployment for: tutorial.jar
  | 11:01:13,421 INFO  [JBossASKernel] installing bean: jboss.j2ee:jar=tutorial.jar,
  | name=TimerBean,service=EJB3
  | 11:01:13,421 INFO  [JBossASKernel]   with dependencies:
  | 11:01:13,421 INFO  [JBossASKernel]   and demands:
  | 11:01:13,421 INFO  [JBossASKernel]      jboss.ejb:service=EJBTimerService
  | 11:01:13,421 INFO  [JBossASKernel]   and supplies:
  | 11:01:13,421 INFO  [JBossASKernel]      jndi:TimerBean/remote
  | 11:01:13,421 INFO  [JBossASKernel]      jndi:TimerBean/remote-ejb.timer.createbi
  | ll.ExampleTimer
  | 11:01:13,421 INFO  [JBossASKernel]      Class:ejb.timer.createbill.ExampleTimer
  | 11:01:13,421 INFO  [JBossASKernel] Added bean(jboss.j2ee:jar=tutorial.jar,name=T
  | imerBean,service=EJB3) to KernelDeployment of: tutorial.jar
  | 11:01:13,421 INFO  [EJB3EndpointDeployer] Deploy AbstractBeanMetaData at 150f2ec{na
  | me=jboss.j2ee:jar=tutorial.jar,name=TimerBean,service=EJB3_endpoint bean=org.jbo
  | ss.ejb3.endpoint.deployers.impl.EndpointImpl properties=[container] constructor=
  | null autowireCandidate=true}
  | 11:01:13,499 INFO  [SessionSpecContainer] Starting jboss.j2ee:jar=tutorial.jar,n
  | ame=TimerBean,service=EJB3
  | 11:01:13,499 INFO  [EJBContainer] STARTED EJB: ejb.timer.createbill.TimerBean ej
  | bName: TimerBean
  | 11:01:13,515 INFO  [JndiSessionRegistrarBase] Binding the following Entries in G
  | lobal JNDI:
  | 
  |         TimerBean/remote - EJB3.x Default Remote Business Interface
  |         TimerBean/remote-ejb.timer.createbill.ExampleTimer - EJB3.x Remote Busin
  | ess Interface
  | 
  | After start
  | 11:13:50,323 WARN  [InterceptorsFactory] EJBTHREE-1246: Do not use InterceptorsF
  | actory with a ManagedObjectAdvisor, InterceptorRegistry should be used via the b
  | ean container
  | 11:13:50,323 WARN  [InterceptorsFactory] EJBTHREE-1246: Do not use InterceptorsF
  | actory with a ManagedObjectAdvisor, InterceptorRegistry should be used via the b
  | ean container
  | 11:13:55,497 INFO  [STDOUT] ---------------------
  | 11:13:55,497 INFO  [STDOUT] * Received Timer event: Hello World
  | 11:13:55,497 INFO  [STDOUT] ---------------------

But the receiving of the timer event appears only once.

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4261215#4261215

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4261215



More information about the jboss-user mailing list