[Beginners Corner] - Re: MDB cannot be created when running in
by jaikiran
I just tried a similar thing on my setups. I created a MDB pointing to a non-existent queue (queue/ABC) and placed that EAR file in the farm folder of "all".
@MessageDriven(activationConfig =
| {
| @ActivationConfigProperty(propertyName="destinationType",
| propertyValue="javax.jms.Queue"),
| @ActivationConfigProperty(propertyName="destination",
| propertyValue="queue/ABC")
| })
| public class MyMDB implements MessageListener {
|
The queue was non-existent so it created a temporary queue:
| 2008-08-28 16:46:11,191 DEBUG [org.jboss.system.ServiceController] starting service jboss.j2ee:ear=EJB3Persistence.ear,jar=myapp_ejb3.jar,name=MyMDB,service=EJB3
| 2008-08-28 16:46:11,191 DEBUG [org.jboss.ejb3.mdb.MdbDelegateWrapper] Starting jboss.j2ee:ear=EJB3Persistence.ear,jar=myapp_ejb3.jar,name=MyMDB,service=EJB3
| 2008-08-28 16:46:11,222 DEBUG [org.jboss.ejb3.tx.UserTransactionImpl] new UserTx: org.jboss.ejb3.tx.UserTransactionImpl@1eb424b
| 2008-08-28 16:46:11,238 DEBUG [org.jboss.ejb3.interceptor.EJB3InterceptorsFactory] Bound interceptors for joinpoint: public void org.myapp.ejb.impl.MyMDB.onMessage(javax.jms.Message) - [Lorg.jboss.ejb3.interceptor.InterceptorInfo;@e26ae7
| 2008-08-28 16:46:11,238 INFO [org.jboss.ejb3.EJBContainer] STARTED EJB: org.myapp.ejb.impl.MyMDB ejbName: MyMDB
| 2008-08-28 16:46:11,254 DEBUG [org.jboss.ejb3.mdb.MessagingContainer] Initializing
| 2008-08-28 16:46:11,254 DEBUG [org.jboss.ejb3.mdb.MessagingContainer] Looking up provider adapter: java:/DefaultJMSProvider
| 2008-08-28 16:46:11,254 DEBUG [org.jboss.ejb3.mdb.MessagingContainer] Provider adapter: org.jboss.jms.jndi.JNDIProviderAdapter@1cbc39b
| 2008-08-28 16:46:11,254 DEBUG [org.jboss.ejb3.mdb.MessagingContainer] context: javax.naming.InitialContext@1059849
| 2008-08-28 16:46:11,254 DEBUG [org.jboss.ejb3.mdb.MessagingContainer] Got destination type Queue for MyMDB
| 2008-08-28 16:46:11,254 DEBUG [org.jboss.ejb3.mdb.MessagingContainer] jndiSuffix: ABC
| 2008-08-28 16:46:11,332 WARN [org.jboss.ejb3.mdb.MessagingContainer] Could not find the queue destination-jndi-name=queue/ABC
| 2008-08-28 16:46:11,332 WARN [org.jboss.ejb3.mdb.MessagingContainer] destination not found: queue/ABC reason: javax.naming.NameNotFoundException: queue/ABC
| 2008-08-28 16:46:11,332 WARN [org.jboss.ejb3.mdb.MessagingContainer] creating a new temporary destination: queue/ABC
| 2008-08-28 16:46:11,347 DEBUG [org.jboss.mq.server.jmx.DestinationManager] Attempting to create destination: jboss.mq.destination:service=Queue,name=ABC; type=org.jboss.mq.server.jmx.Queue
| 2008-08-28 16:46:11,347 DEBUG [org.jboss.system.ServiceController] Creating service jboss.mq.destination:service=Queue,name=ABC
| 2008-08-28 16:46:11,347 DEBUG [org.jboss.system.ServiceController] adding depends in ServiceController.register: [jboss.mq:service=DestinationManager]
| 2008-08-28 16:46:11,347 DEBUG [org.jboss.system.ServiceController] recording that jboss.mq.destination:service=Queue,name=ABC depends on jboss.mq:service=DestinationManager
| 2008-08-28 16:46:11,347 DEBUG [org.jboss.mq.server.jmx.Queue.ABC] Creating jboss.mq.destination:service=Queue,name=ABC
| 2008-08-28 16:46:11,347 DEBUG [org.jboss.mq.server.jmx.Queue.ABC] Created jboss.mq.destination:service=Queue,name=ABC
| 2008-08-28 16:46:11,347 DEBUG [org.jboss.system.ServiceController] Creating dependent components for: jboss.mq.destination:service=Queue,name=ABC dependents are: []
| 2008-08-28 16:46:11,347 DEBUG [org.jboss.system.ServiceController] starting service jboss.mq.destination:service=Queue,name=ABC
| 2008-08-28 16:46:11,347 DEBUG [org.jboss.mq.server.jmx.Queue.ABC] Starting jboss.mq.destination:service=Queue,name=ABC
| 2008-08-28 16:46:11,347 DEBUG [org.jboss.mq.pm.jdbc2.PersistenceManager] Restored 0 message(s) to: QUEUE.ABC 0 need recovery.
| 2008-08-28 16:46:11,347 INFO [org.jboss.mq.server.jmx.Queue.ABC] Bound to JNDI name: queue/ABC
|
Then i started another node in the cluster and the EAR was picked up by the farm service. When the MDB was being deployed, the queue was not created again because the node found it already existing in the cluster:
2008-08-28 16:48:40,177 DEBUG [org.jboss.ejb3.mdb.MdbDelegateWrapper] Creating jboss.j2ee:ear=EJB3Persistence.ear,jar=myapp_ejb3.jar,name=MyMDB,service=EJB3
| 2008-08-28 16:48:40,177 DEBUG [org.jboss.ejb3.mdb.MdbDelegateWrapper] Created jboss.j2ee:ear=EJB3Persistence.ear,jar=myapp_ejb3.jar,name=MyMDB,service=EJB3
| 2008-08-28 16:48:40,193 DEBUG [org.jboss.system.ServiceController] Creating dependent components for: jboss.j2ee:ear=EJB3Persistence.ear,jar=myapp_ejb3.jar,name=MyMDB,service=EJB3 dependents are: []
| 2008-08-28 16:48:40,193 DEBUG [org.jboss.system.ServiceController] starting service jboss.j2ee:ear=EJB3Persistence.ear,jar=myapp_ejb3.jar,name=MyMDB,service=EJB3
| 2008-08-28 16:48:40,193 DEBUG [org.jboss.ejb3.mdb.MdbDelegateWrapper] Starting jboss.j2ee:ear=EJB3Persistence.ear,jar=myapp_ejb3.jar,name=MyMDB,service=EJB3
| 2008-08-28 16:48:40,209 DEBUG [org.jboss.ejb3.tx.UserTransactionImpl] new UserTx: org.jboss.ejb3.tx.UserTransactionImpl@5ec940
| 2008-08-28 16:48:40,224 DEBUG [org.jboss.ejb3.interceptor.EJB3InterceptorsFactory] Bound interceptors for joinpoint: public void org.myapp.ejb.impl.MyMDB.onMessage(javax.jms.Message) - [Lorg.jboss.ejb3.interceptor.InterceptorInfo;@d16610
| 2008-08-28 16:48:40,224 INFO [org.jboss.ejb3.EJBContainer] STARTED EJB: org.myapp.ejb.impl.MyMDB ejbName: MyMDB
| 2008-08-28 16:48:40,240 DEBUG [org.jboss.ejb3.mdb.MessagingContainer] Initializing
| 2008-08-28 16:48:40,240 DEBUG [org.jboss.ejb3.mdb.MessagingContainer] Looking up provider adapter: java:/DefaultJMSProvider
| 2008-08-28 16:48:40,240 DEBUG [org.jboss.ejb3.mdb.MessagingContainer] Provider adapter: org.jboss.jms.jndi.JNDIProviderAdapter@1d29ee4
| 2008-08-28 16:48:40,240 DEBUG [org.jboss.ejb3.mdb.MessagingContainer] context: javax.naming.InitialContext@1945696
| 2008-08-28 16:48:40,240 DEBUG [org.jboss.ejb3.mdb.MessagingContainer] Got destination type Queue for MyMDB
| 2008-08-28 16:48:40,240 DEBUG [org.jboss.ejb3.mdb.MessagingContainer] jndiSuffix: ABC
| 2008-08-28 16:48:40,302 DEBUG [org.jboss.mq.referenceable.SpyDestinationObjectFactory] SpyDestinationObjectFactory->getObjectInstance()
| 2008-08-28 16:48:40,302 DEBUG [org.jboss.ejb3.mdb.MessagingContainer] Initialized with config org.jboss.ejb3.mdb.MDB@114a707
|
The MDB was deployed properly.
I even tried removing the deployments from the farm folder and placing them in the "deploy" folder of the individual nodes. Even that worked without any errors.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4173029#4173029
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4173029
17 years, 7 months
[Security & JAAS/JBoss] - Accessing multiple EJBs on different JBoss AS instances
by dkrizic
Hello,
I would to access two independent EJBs on two different JBoss instances, each is secured with a uniquely named SecurityDomain. Here is my authentication configuration:
| darko {
| org.jboss.security.ClientLoginModule required debug=true;
| };
|
| jochen {
| org.jboss.security.ClientLoginModule required debug=true;
| };
|
Then I login to the first one (login 1)
| log.info("LoginContext [darko]");
| UsernamePasswordHandler uph = new UsernamePasswordHandler("darko",
| "test");
| LoginContext loginContext = new LoginContext("darko", uph);
| loginContext.login();
|
|
Then I access the session bean (access 1):
| log.info("PersonService [darko]");
| PersonService ps = (PersonService) getService(PersonService.REMOTE_NAME);
| Person p = new Person(null, "Darko", "Krizic");
| p = ps.add(p);
| assertNotNull(p.getId());
| assertEquals(1, ps.listPersons().size());
| ps.update(p);
| ps.remove(p.getId());
| assertEquals(0, ps.listPersons().size());
|
Then I login to the second JBoss instance (login 2)
| log.info("LoginContext [jochen]");
| UsernamePasswordHandler uph2 = new UsernamePasswordHandler(
| "jochen", "test2");
| LoginContext loginContext2 = new LoginContext("jochen", uph2);
| loginContext2.login();
|
and then I access the second (technically identical) session bean (access 2)::
| log.info("PersonService [jochen]");
| PersonService ps2 = (PersonService) getService2(PersonService.REMOTE_NAME);
| Person p2 = new Person(null, "Jochen", "Grau");
| p2 = ps2.add(p2);
| assertNotNull(p2.getId());
| assertEquals(1, ps2.listPersons().size());
| ps2.update(p2);
| ps2.remove(p2.getId());
| assertEquals(0, ps2.listPersons().size());
|
This works so far, but when I change the order from
| login 1
| access 1
| login 2
| access 2
|
|
| to
|
| login 1
| | login 2
| | access 1
| | access 2
| |
|
| The code does not work anymore. Obviously the login module is not able to handle this. What could I do? Would a separation in different classloaders work?
|
| Regards,
|
| Darko
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4173028#4173028
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4173028
17 years, 7 months
[Beginners Corner] - Application gives exception when left idle for a few hours
by sultan.noori
Hi,
We have been facing an exception for some time now where an exception is raised at the time of login if the application is left idle for a few hours. This especially happens if the JBoss AS 3.2.7 is left running over night. The next day, on login attempt the following exception is raised
Caused by: javax.faces.FacesException: #{index.validateUser}: javax.faces.el.EvaluationException: java.lang.NullPointerException
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:78)
at com.sun.rave.web.ui.appbase.faces.ActionListenerImpl.processAction(ActionListenerImpl.java:57)
at javax.faces.component.UICommand.broadcast(UICommand.java:312)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:266)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:380)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:75)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
... 37 more
Caused by: javax.faces.el.EvaluationException: java.lang.NullPointerException
at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:130)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:72)
... 45 more
Caused by: java.lang.NullPointerException
at com.tabaq.edocument.login.jsf.LoginValidator.validateUserPassword(LoginValidator.java:110)
at edocument.index.validateFields(index.java:480)
at edocument.index.validateUser(index.java:437)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
We have not been able to narrow down the root cause of this problem. I am also not sure of the exact time period which causes problem.
I will appreciate if someone can help me find a solution to this.
Thanks in advance.
regards,
Sultan
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4173024#4173024
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4173024
17 years, 7 months