[EJB 3.0] - Re: Transactions Question: Subsequent calls the method fail
by lpmon
Thanks for the input. I have never heard that you must use the proxy in this scenario. I have seen this statement (from JBoss trailbalzer):
"In EJB 3.0 applications, transaction properties are most frequently declared for methods in session beans. If a method requires transaction, all operations in the method, including database updates, are only committed after the method exits normally."
If it is true that a proxy based call is required then it would be very important to include that in or near the above paragraph. Where is this documented? I would like to read up on this. I expect that reading has other useful info.
I made a change to use the proxy call and I still get the same exact result!
In other words I now, in a non SLSB class, lookup the interface and make a call in a loop. The called method has @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) .
FYI: If I call it passing a series of valid SQL all statements execute okay. I have some scenarios where some sql statements in a list will error (long story). I need to ignore those and continue.
I am guessing there is something else I need to do (like .. reset the em, whatever that means ) when the error occurs but I am not sure what. The fact that the same em is used between calls is probably the root cause.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4157751#4157751
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4157751
17 years, 10 months
[JBoss Messaging] - Re: ClusteredConnectionFactory vs JmsXA
by timfox
"ejb3workshop" wrote :
| However with ClusteredXAConnectionFactory it seems that message is sent outside the transactional context. Rather frequently it happens that the message arrives at the next bean, but the persistence has't finnished. The messages are however distributed evenly across both nodes.
|
This is a classic misconception with using XA.
If you do something like:
a) write a row in a DB
b) send a message
In an ejb and use XA to enlist both those operations in the same global tx, then on commit, you might expect a) to happen before b) right?
Wrong. The XA spec makes no guarantees of the order or concurrency of when the two things occur. All it says is they will both happen.
That's just the way XA works, nothing to do with JBM.
So if you're application expects to find the row in the db when it consumes the message , that won't be guaranteed to work.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4157747#4157747
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4157747
17 years, 10 months
[JBoss Messaging] - ClusteredConnectionFactory vs JmsXA
by ejb3workshop
My application consists of a number of EJB3 MDBs, which pull messages off a number of queues and topics. The application is deployed on a cluster of 2 identical nodes. I have installed JBM 1.4(SP3) on JB 4.2.2.
When I inject the ClusteredXAConnectionFactory the application work, but the messages are not treated i the same transaction as the rest of the work done in my MDB. For example, I would like to persist an Entity as well as forward a message to anther MDB. The other MDB is dependent on the entity being persistent and available in the database.
However with ClusteredXAConnectionFactory it seems that message is sent outside the transactional context. Rather frequently it happens that the message arrives at the next bean, but the persistence has't finnished. The messages are however distributed evenly across both nodes.
After a little research online, I found several posts suggestion to use JmsXA instead of ClusteredXAConnectionFactory. This resolved my transaction problem nicely, however since the switch the messages are no longer distributed evenly. It seems to only use the other node, when all MDBs in the pool on one node are exhausted.
I am wondering if this is by design, as clustered XA transactions must be quite expensive, surely. So maybe messages are only distributed to the other nodes when one nodes bean pool is exhausted.
Please let me know if this is the correct behaviour, or what I should look at to correct the distribution.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4157742#4157742
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4157742
17 years, 10 months
[Beginners Corner] - Seam and JSON
by froden
Hello,
I'm creating a web application with Seam that, in addition to serving web pages, will also provide JSON objects for some Ajax calls.
My first thought was to simply let an xhtml page return JSON, as follows:
| <html ...><head></head><body>
|
| <ui:composition>
| { "someKey": "someValue",
| "someOtherKey": "#{someBean.someValue}" }
| </ui:composition>
|
| </body></html>
|
This became cumbersome for a number of reasons, and I pressume this is not the most elegant way to do it.
My second thought was to create an old fashioned servlet to return the JSON data. I am, however, having some problems accessing Seam features, EntityManager etc in the servlet.
So, I am wondering, what is the best practice for doing this in a Seam web application? All suggestions are welcome.
~Frode
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4157741#4157741
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4157741
17 years, 10 months
[JBoss jBPM] - How to start a JBPM Work Flow remotely???
by cr3
Hi there,
Does anybody know how to start a JBPM Work Flow remotely?
What I want to do is Instance a new Process from a remote server (a Nagios server when an alarm appears).
The code that I think that could do this is:
JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
|
| ProcessInstance processInstance = jbpmContext.newProcessInstance("Gestion de Problemas");
|
| processInstance.signal("Enviar");
but I cannnot figure it out how to initialize the variable "jbpmConfiguration".
When I was in a Node of the JBpm I used:
JbpmContext jbpmContext =context.getJbpmContext();
where context is an object of the class ExecutionContext, but as you can see I don't have this class because I want to start the process remotely ;).
I tried as well to use this:
anonymous wrote : JbpmConfiguration jbpmConfiguration = JbpmConfiguration.parseXmlString(xml);
Where the String xml is:
anonymous wrote : String xml="<jbpm-configuration>"+
| "<jbpm-context>"+
| "<service name=\"persistence\" factory=\"org.jbpm.persistence.db.DbPersistenceServiceFactory\" />"+
| "<service name=\"tx\" factory=\"org.jbpm.tx.TxServiceFactory\" />"+
| "<service name=\"message\" factory=\"org.jbpm.msg.db.DbMessageServiceFactory\" />"+
| "<service name=\"scheduler\" factory=\"org.jbpm.scheduler.db.DbSchedulerServiceFactory\" />"+
| "<service name=\"logging\" factory=\"org.jbpm.logging.db.DbLoggingServiceFactory\" />"+
| "<service name=\"authentication\" factory=\"org.jbpm.security.authentication.DefaultAuthenticationServiceFactory\" />"+
| "</jbpm-context>"+
|
| "<string name=\"resource.hibernate.cfg.xml\" value=\"hibernate.cfg.xml\" />"+
|
|
| "<string name=\"resource.business.calendar\" value=\"org/jbpm/calendar/jbpm.business.calendar.properties\" />"+
| "<string name=\"resource.default.modules\" value=\"org/jbpm/graph/def/jbpm.default.modules.properties\" />"+
| "<string name=\"resource.converter\" value=\"org/jbpm/db/hibernate/jbpm.converter.properties\" />"+
| "<string name=\"resource.action.types\" value=\"org/jbpm/graph/action/action.types.xml\" />"+
| "<string name=\"resource.node.types\" value=\"org/jbpm/graph/node/node.types.xml\" />"+
| "<string name=\"resource.parsers\" value=\"org/jbpm/jpdl/par/jbpm.parsers.xml\" />"+
| "<string name=\"resource.varmapping\" value=\"org/jbpm/context/exe/jbpm.varmapping.xml\" />"+
| "<string name=\"resource.mail.templates\" value=\"jbpm.mail.templates.xml\" />"+
|
| "<int name=\"jbpm.byte.block.size\" value=\"1024\" singleton=\"true\" />"+
| "<bean name=\"jbpm.task.instance.factory\" class=\"org.jbpm.taskmgmt.impl.DefaultTaskInstanceFactoryImpl\" singleton=\"true\" />"+
| "<bean name=\"jbpm.variable.resolver\" class=\"org.jbpm.jpdl.el.impl.JbpmVariableResolver\" singleton=\"true\" />"+
| "<string name=\"jbpm.mail.smtp.host\" value=\"localhost\" />"+
| "<bean name=\"jbpm.mail.address.resolver\" class=\"org.jbpm.identity.mail.IdentityAddressResolver\" singleton=\"true\" />"+
| "<string name=\"jbpm.mail.from.address\" value=\"jbpm@noreply\" />"+
|
| "<bean name=\"jbpm.job.executor\" class=\"org.jbpm.job.executor.JobExecutor\">"+
| "<field name=\"jbpmConfiguration\"><ref bean=\"jbpmConfiguration\" />"+
| "<field name=\"name\"><string value=\"JbpmJobExector\" />"+
| "<field name=\"nbrOfThreads\"><int value=\"1\" />"+
| "<field name=\"idleInterval\"><int value=\"5000\" />"+
| "<field name=\"maxIdleInterval\"><int value=\"3600000\" /> <!-- 1 hour -->"+
| "<field name=\"historyMaxSize\"><int value=\"20\" />"+
| "<field name=\"maxLockTime\"><int value=\"600000\" /> <!-- 10 minutes -->"+
| "<field name=\"lockMonitorInterval\"><int value=\"60000\" /> <!-- 1 minute -->"+
| "<field name=\"lockBufferTime\"><int value=\"5000\" /> <!-- 5 seconds -->"+
| ""+
|
| "</jbpm-configuration>";
But as you guess it, it doesn't work as well.
Thanks in advance for your cooperation (If I got one hehe...)
Christian
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4157739#4157739
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4157739
17 years, 10 months
[JBoss Cache: Core Edition] - Exclusive lock is acquired on all nodes not one only
by dmary
Hi all,
I use TreeCache (JbossCache 1.4.1 SP3 with Jboss 4.0.5GA) with a cache configured in a clustered environnement.
I set in PESSIMISTIC/SERIALIZABLE mode and I want to lock only one node when I read or write to it.
For example, if I have /root/subroot/A and /root/subroot/B, I read node A, I want to have an exclusive lock on it , but I want also to read with another transaction node B.
But at this moment, the cache is entirely locked! I cannot read node B at all.
<?xml version="1.0" encoding="UTF-8" ?>
| <server>
| <classpath codebase="./lib" archives="jboss-cache.jar, jgroups.jar" />
| <mbean code="org.jboss.cache.TreeCache" name="jboss.cache:service=MyTreeCache">
| <depends>jboss:service=Naming</depends>
| <depends>jboss:service=TransactionManager</depends>
| <depends>jboss.jca:service=DataSourceBinding,name=my-ds</depends>
|
| <attribute name="TransactionManagerLookupClass">org.jboss.cache.JBossTransactionManagerLookup</attribute>
| <attribute name="NodeLockingScheme">PESSIMISTIC</attribute>
| <attribute name="IsolationLevel">READ_UNCOMMITTED</attribute>
|
| <attribute name="CacheMode">REPL_SYNC</attribute>
| <attribute name="ClusterName">
| master-${jboss.partition.name:Cluster}
| </attribute>
| <attribute name="ClusterConfig">
| <config>
| <UDP mcast_addr="${jboss.partition.udpGroup:228.2.2.14}"
| mcast_port="48252" ip_ttl="${jgroups.mcast.ip_ttl:2}"
| ip_mcast="true" mcast_send_buf_size="150000"
| mcast_recv_buf_size="80000" ucast_send_buf_size="150000"
| ucast_recv_buf_size="80000" loopback="false" />
| <PING timeout="2000" num_initial_members="3"
| up_thread="false" down_thread="false" />
| <MERGE2 min_interval="10000" max_interval="20000" />
| <FD shun="true" up_thread="true" down_thread="true" />
| <VERIFY_SUSPECT timeout="1500" up_thread="false"
| down_thread="false" />
| <pbcast.NAKACK gc_lag="50" max_xmit_size="8192"
| retransmit_timeout="600,1200,2400,4800" up_thread="false"
| down_thread="false" />
| <UNICAST timeout="600,1200,2400" window_size="100"
| min_threshold="10" down_thread="false" />
| <pbcast.STABLE desired_avg_gossip="20000"
| up_thread="false" down_thread="false" />
| <FRAG frag_size="8192" down_thread="false"
| up_thread="false" />
| <pbcast.GMS join_timeout="5000"
| join_retry_timeout="2000" shun="true" print_local_addr="true" />
| <pbcast.STATE_TRANSFER up_thread="false"
| down_thread="false" />
| </config>
| </attribute>
| <attribute name="InitialStateRetrievalTimeout">6000</attribute>
| <attribute name="SyncReplTimeout">10000</attribute>
| <attribute name="LockAcquisitionTimeout">4000</attribute>
|
| </mbean>
| </server>
How can achieve my use case ?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4157734#4157734
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4157734
17 years, 10 months
[Messaging, JMS & JBossMQ] - Re: org.jboss.mq.SpyJMSException: Cannot authenticate user
by ashish.abrol@gmail.com
Hi
I am trying to connect to JBoss MQ which is running on a remote unix box.
I am simulating a client from a windows machine. I am unable to connect because of a authentication issue. I am not exactly sure what is it that causes it. I am a newbie. Please see the exception below. I would much appreciate if somebody could solve my problem.
Note: I have tried "telnet 1099" and i do get a response back. So I assume there isnt a firewall problem.
thanks
Ashish
org.jboss.mq.SpyJMSException: Cannot authenticate user; - nested throwable: (java.net.ConnectException: Connection refused: connect)
at org.jboss.mq.SpyJMSException.getAsJMSException(SpyJMSException.java:66)
at org.jboss.mq.SpyJMSException.rethrowAsJMSException(SpyJMSException.java:51)
at org.jboss.mq.Connection.authenticate(Connection.java:1118)
at org.jboss.mq.Connection.(Connection.java:267)
at org.jboss.mq.Connection.(Connection.java:338)
at org.jboss.mq.SpyConnection.(SpyConnection.java:68)
at org.jboss.mq.SpyConnectionFactory.createConnection(SpyConnectionFactory.java:87)
at org.jboss.mq.SpyConnectionFactory.createQueueConnection(SpyConnectionFactory.java:124)
at JbossSample.runExample(JbossSample.java:104)
at JbossSample.main(JbossSample.java:159)
Caused by: java.net.ConnectException: Connection refused: connect
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4157728#4157728
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4157728
17 years, 10 months