[JBoss Messaging] - Sending Messages from EJB using container transaction
by eontech
Hello Everyone,
We have a requirement to send thousands of messages using EJB in a day. Thus every time a need arises to send a message, we have a dedicated session bean which will post message to the queue as part of EJB (container) transaction. We are using JBoss EAP 4.3.0.
Our question is what will be the right connection factories to use. Currently we are using /ConnectionFactory to send messages but it seems that it does not uses container transaction. If we use session transacted session it sends message only if we explicitly commit the transaction and it seems to have two transactions running in parallel i.e. container transaction & JMS transaction which are independent of each other. Thus we used session transacted as false and AUTO_ACK true but with this we face another problem that messages are delivered to consumer even before the EJB i.e. container transaction finishes. Thus regardless the originating transaction was successful, complete or failed, the message is delivered to consumer which gives unreliable results
Our requirement is that message should be delivered to consumer only if the originating EJB transaction was successful else the message posted should be de-queued. The whole infrastructure should be fast to process the message.
We want to know what will be the most appropriate approach to get best performance and reliability
1. Which connection factory to use so that JMS uses Container transaction? Currently we are using /ConnectionFactory
2. Do we need to open connection every time we send a message or we can have a connection object initialized in post construct of Session bean. Currently we create it at post construct of session EJB
3. Do we need to create session every time we send a message or we can have a session object initialized in post construct of Session bean. Currently we create it every time.
4. What all points should we take care from performance tuning perspective. We are using MS-SQL Server 2005.
Best Regards,
Abhishek
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4223867#4223867
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4223867
17 years
[Installation, Configuration & DEPLOYMENT] - Jboss 4.2.3 Start Problem
by higkoo
jboss-4.2.3.GA-jdk6
jdk1.6.0_12
CentOS 5.2
/etc/hosts :
anonymous wrote : ::1 localhost.localdomain localhost vmlincn80ce5
/etc/sysconfig/network
anonymous wrote : NETWORKING=yes
| NETWORKING_IPV6=no
| HOSTNAME=vmlincn80ce5
error:
anonymous wrote :
| [root@vmlincn80ce5 local]# /usr/local/jboss-4.2.3.GA/bin/run.sh
| =========================================================================
|
| JBoss Bootstrap Environment
|
| JBOSS_HOME: /usr/local/jboss-4.2.3.GA
|
| JAVA: /usr/local/jdk1.6.0_12/bin/java
|
| JAVA_OPTS: -Dprogram.name=run.sh -server -Xms128m -Xmx512m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djava.net.preferIPv4Stack=true
|
| CLASSPATH: /usr/local/jboss-4.2.3.GA/bin/run.jar:/usr/local/jdk1.6.0_12/lib/tools.jar
|
| =========================================================================
|
| 15:58:12,528 INFO [Server] Starting JBoss (MX MicroKernel)...
| 15:58:12,530 INFO [Server] Release ID: JBoss [Trinity] 4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181439)
| 15:58:12,532 INFO [Server] Home Dir: /usr/local/jboss-4.2.3.GA
| 15:58:12,532 INFO [Server] Home URL: file:/usr/local/jboss-4.2.3.GA/
| 15:58:12,533 INFO [Server] Patch URL: null
| 15:58:12,534 INFO [Server] Server Name: default
| 15:58:12,534 INFO [Server] Server Home Dir: /usr/local/jboss-4.2.3.GA/server/default
| 15:58:12,534 INFO [Server] Server Home URL: file:/usr/local/jboss-4.2.3.GA/server/default/
| 15:58:12,535 INFO [Server] Server Log Dir: /usr/local/jboss-4.2.3.GA/server/default/log
| 15:58:12,535 INFO [Server] Server Temp Dir: /usr/local/jboss-4.2.3.GA/server/default/tmp
| 15:58:12,536 INFO [Server] Root Deployment Filename: jboss-service.xml
| 15:58:12,975 INFO [ServerInfo] Java version: 1.6.0_12,Sun Microsystems Inc.
| 15:58:12,976 INFO [ServerInfo] Java VM: Java HotSpot(TM) 64-Bit Server VM 11.2-b01,Sun Microsystems Inc.
| 15:58:12,976 INFO [ServerInfo] OS-System: Linux 2.6.18-92.el5,amd64
| 15:58:13,694 INFO [Server] Core system initialized
| 15:58:16,399 WARN [BasicMBeanRegistry] javax.management.MBeanRegistrationException: preRegister() failed: [ObjectName='jboss.remoting:service=NetworkRegistry', Class=org.jboss.remoting.network.NetworkRegistry (org.jboss.remoting.network.NetworkRegistry@5c435a3a)]
| 15:58:16,420 ERROR [MainDeployer] Could not create deployment: file:/usr/local/jboss-4.2.3.GA/server/default/conf/jboss-service.xml
| org.jboss.deployment.DeploymentException: - nested throwable: (java.lang.reflect.InvocationTargetException)
| at org.jboss.system.ServiceConfigurator.install(ServiceConfigurator.java:196)
| at org.jboss.system.ServiceController.install(ServiceController.java:226)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:597)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
| at $Proxy4.install(Unknown Source)
| at org.jboss.deployment.SARDeployer.create(SARDeployer.java:251)
| at org.jboss.deployment.MainDeployer.create(MainDeployer.java:969)
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:818)
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:766)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:597)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
| at $Proxy5.deploy(Unknown Source)
| at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
| at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
| at org.jboss.Main.boot(Main.java:200)
| at org.jboss.Main$1.run(Main.java:508)
| at java.lang.Thread.run(Thread.java:619)
| Caused by: java.lang.reflect.InvocationTargetException
| at org.jboss.mx.server.MBeanServerImpl.registerMBean(MBeanServerImpl.java:1451)
| at org.jboss.mx.server.MBeanServerImpl.registerMBean(MBeanServerImpl.java:1350)
| at org.jboss.mx.server.MBeanServerImpl.createMBean(MBeanServerImpl.java:345)
| at org.jboss.system.ServiceCreator.install(ServiceCreator.java:157)
| at org.jboss.system.ServiceConfigurator.internalInstall(ServiceConfigurator.java:451)
| at org.jboss.system.ServiceConfigurator.install(ServiceConfigurator.java:171)
| ... 36 more
| Caused by: javax.management.MBeanException
| at org.jboss.mx.interceptor.ReflectedDispatcher.handleInvocationExceptions(ReflectedDispatcher.java:180)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:163)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| at org.jboss.mx.server.MBeanServerImpl$3.run(MBeanServerImpl.java:1422)
| at java.security.AccessController.doPrivileged(Native Method)
| at org.jboss.mx.server.MBeanServerImpl.registerMBean(MBeanServerImpl.java:1417)
| ... 41 more
| Caused by: javax.management.MBeanRegistrationException: preRegister() failed: [ObjectName='jboss.remoting:service=NetworkRegistry', Class=org.jboss.remoting.network.NetworkRegistry (org.jboss.remoting.network.NetworkRegistry@5c435a3a)]
| at org.jboss.mx.server.registry.BasicMBeanRegistry.invokePreRegister(BasicMBeanRegistry.java:713)
| at org.jboss.mx.server.registry.BasicMBeanRegistry.registerMBean(BasicMBeanRegistry.java:211)
| at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:597)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| ... 51 more
| Caused by: java.lang.RuntimeException: Exception creating identity: vmlincn80ce5: vmlincn80ce5
| at org.jboss.remoting.ident.Identity.get(Identity.java:211)
| at org.jboss.remoting.network.NetworkRegistry.preRegister(NetworkRegistry.java:268)
| at org.jboss.mx.server.AbstractMBeanInvoker.invokePreRegister(AbstractMBeanInvoker.java:966)
| at org.jboss.mx.modelmbean.ModelMBeanInvoker.invokePreRegister(ModelMBeanInvoker.java:489)
| at org.jboss.mx.server.AbstractMBeanInvoker.preRegister(AbstractMBeanInvoker.java:654)
| at org.jboss.mx.server.registry.BasicMBeanRegistry.invokePreRegister(BasicMBeanRegistry.java:697)
| ... 56 more
| Failed to boot JBoss:
| org.jboss.deployment.DeploymentException: - nested throwable: (java.lang.reflect.InvocationTargetException)
| at org.jboss.system.ServiceConfigurator.install(ServiceConfigurator.java:196)
| at org.jboss.system.ServiceController.install(ServiceController.java:226)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:597)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
| at $Proxy4.install(Unknown Source)
| at org.jboss.deployment.SARDeployer.create(SARDeployer.java:251)
| at org.jboss.deployment.MainDeployer.create(MainDeployer.java:969)
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:818)
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:766)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:597)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
| at $Proxy5.deploy(Unknown Source)
| at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
| at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
| at org.jboss.Main.boot(Main.java:200)
| at org.jboss.Main$1.run(Main.java:508)
| at java.lang.Thread.run(Thread.java:619)
| Caused by: java.lang.reflect.InvocationTargetException
| at org.jboss.mx.server.MBeanServerImpl.registerMBean(MBeanServerImpl.java:1451)
| at org.jboss.mx.server.MBeanServerImpl.registerMBean(MBeanServerImpl.java:1350)
| at org.jboss.mx.server.MBeanServerImpl.createMBean(MBeanServerImpl.java:345)
| at org.jboss.system.ServiceCreator.install(ServiceCreator.java:157)
| at org.jboss.system.ServiceConfigurator.internalInstall(ServiceConfigurator.java:451)
| at org.jboss.system.ServiceConfigurator.install(ServiceConfigurator.java:171)
| ... 36 more
| Caused by: javax.management.MBeanException
| at org.jboss.mx.interceptor.ReflectedDispatcher.handleInvocationExceptions(ReflectedDispatcher.java:180)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:163)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| at org.jboss.mx.server.MBeanServerImpl$3.run(MBeanServerImpl.java:1422)
| at java.security.AccessController.doPrivileged(Native Method)
| at org.jboss.mx.server.MBeanServerImpl.registerMBean(MBeanServerImpl.java:1417)
| ... 41 more
| Caused by: javax.management.MBeanRegistrationException: preRegister() failed: [ObjectName='jboss.remoting:service=NetworkRegistry', Class=org.jboss.remoting.network.NetworkRegistry (org.jboss.remoting.network.NetworkRegistry@5c435a3a)]
| at org.jboss.mx.server.registry.BasicMBeanRegistry.invokePreRegister(BasicMBeanRegistry.java:713)
| at org.jboss.mx.server.registry.BasicMBeanRegistry.registerMBean(BasicMBeanRegistry.java:211)
| at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:597)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| ... 51 more
| Caused by: java.lang.RuntimeException: Exception creating identity: vmlincn80ce5: vmlincn80ce5
| at org.jboss.remoting.ident.Identity.get(Identity.java:211)
| at org.jboss.remoting.network.NetworkRegistry.preRegister(NetworkRegistry.java:268)
| at org.jboss.mx.server.AbstractMBeanInvoker.invokePreRegister(AbstractMBeanInvoker.java:966)
| at org.jboss.mx.modelmbean.ModelMBeanInvoker.invokePreRegister(ModelMBeanInvoker.java:489)
| at org.jboss.mx.server.AbstractMBeanInvoker.preRegister(AbstractMBeanInvoker.java:654)
| at org.jboss.mx.server.registry.BasicMBeanRegistry.invokePreRegister(BasicMBeanRegistry.java:697)
| ... 56 more
| 15:58:16,442 INFO [Server] Runtime shutdown hook called, forceHalt: true
| 15:58:16,442 INFO [Server] JBoss SHUTDOWN: Undeploying all packages
| 15:58:16,459 INFO [Server] Shutdown complete
| Shutdown complete
| Halting VM
|
how can i do ?
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4223866#4223866
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4223866
17 years
[EJB/JBoss] - Initializing log4j in standalone EJB client
by Ralph_
I'm accessing an EJB 3 business interface on jboss from a standalone client by
Properties props = new Properties();
| props.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
| props.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming.client");
| props.setProperty(Context.PROVIDER_URL, "jnp://localhost:1099");
| Context ctx = new InitialContext(props);
|
| Test test = (Test) ctx.lookup("TestBean/remote");
This works, but the lookup produces the warning:
log4j: WARN No appenders could be found for logger (org.jnp.interfaces.TimedSocketFactory)
| log4j: WARN Please initialze the log4j system properly
Has anybody an idea what I have to do in order to get rid of these warnings ?
Any help is appreciated. Thanks.
Ralph
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4223833#4223833
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4223833
17 years