[JBoss Cache: Core Edition] - attach()detach() can transaction, but find() can not?
by wj.king
I'm sorry ask the same here,- -, no answer in the pojo-edition:)
hi all,
when i use as the below ,i can rollback the cache:
| clientDao.insertClient(client);
| Client clientCache = clientDao
| .getClientByName(client.getName());
| //cacheManager.insertClientToCache use pojocache.attach(id,client)
| cacheManager.insertClientToCache(clientCache);
| throw new RuntimeException();
|
or
| clientDao.deleteClientByTid(tid);
| //cacheManager.deleteClientByTid use pojocache.detach(id)
| cacheManager.deleteClientByTid(tid);
| throw new RuntimeException();
|
they work fine, but when i use pojocache.find(...) to get a pojo,then i modified the name field, it can't rollback,
| clientDao.updateClient(client);
| Client cInCache = cacheManager
| .getClientFromCacheByTid(client.getTid());
| cInCache.setName(client.getName());
| throw new RuntimeException();
|
when the up is done,clientDao.updateClient rollbacked,but the client in cache ,it's Name field not rollback,
i've placed jboss-aop.jar to my web/WEB-INF/lib,and copyed one pojocache-aop.xml(from jbosscache-pojo.jar/METE-INF/) to web/WEB-INF/classes,
i've read the userguide doc,
from the Chapter6.Instrumentation , i don't know how i do the below in a web application server, e.g.; tomcat
|
| The jboss.aop.path system property set to the location of pojocache-aop.xml
|
| A javaagent argument which includes jboss-aop-jdk50.jar
|
| These requirements lead to the following example ant task:
|
|
| <java classname="Foo" fork="yes">
| <jvmarg value="-javaagent:lib/jboss-aop.jar"/>
| <jvmarg value="-Djboss.aop.path=etc/META-INF/pojocache-aop.xml"/>
| <classpath refid="test.classpath"/>
| </java>
|
| There is also a pojo-run command line script in the POJO Cache distribution that passes the proper a
| rguments to the JVM for you.
|
|
| $ pojo-run -classpath myclasses org.foo.Bar
|
| Once the JVM is executed in this manner, any class with the @Replicable annotation will be instrumen
| ted when it is loaded.
|
then in 5.3 AOP Configuration
| POJO Cache supplies a pojocache-aop.xml that is required to be set via a system property: jboss.aop.
| path during compile- or load-time, or
| placed in the user's classpath
| . The file now consists of the interceptor stack specification, as well as annotations for POJO inst
| rumentation. It is listed fully in the Appendix section. Note that the file should not normally need
| to be modified. Only an advanced use-case would require changes.
|
so, in web server ,if i placed jbosscache-aop.jar(and other requied jar) to WEB-INF/lib and pojocache-aop.xml to WEB-INF/classes, then pojocache can work fine?
i've done this,but ,use find() to get a object from cache,i can't rollback the field,
Have i forgot something important?
how can i now to do?Any advice would great appreciate
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4146011#4146011
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4146011
18 years
[EJB 3.0] - Re: Problem with TimerService
by agenttokyo
"hasc" wrote : Hi,
|
| i posted this question already in the seam forum, but i was told I should post the question here again...
|
| I wrote a simple stateless bean to test the TimerService. i am using jboss 4.2.0GA
|
|
I hope you long ago solved your issue =) Bit since I saw this problem a number of places w/out a solution I'm commenting here.
I ran into this moving from Jboss 4.0.5 to 4.2.2 using Postgresql 8.1
Your DS doesn't support the XA interface. I assume there is a way to do this in HSQL as well but found no answer (I saw no XA DataSource in the hsqldb.jar)? But... here is my solution.
In my postgres-dx.xml I had the usual local-tx-datasource, which was used for my entities. I then added the xa-datasource
| <datasources>
| <local-tx-datasource>
| <jndi-name>PostGresDS</jndi-name>
| <connection-url>jdbc:postgresql://localhost:5432/blah</connection-url>
| <driver-class>org.postgresql.Driver</driver-class>
| <user-name>user</user-name>
| <password>password</password>
| </local-tx-datasource>
|
| <xa-datasource>
| <jndi-name>XAPostGresDS</jndi-name>
| <xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
| <xa-datasource-property name="ServerName">localhost</xa-datasource-property>
| <xa-datasource-property name="DatabaseName">blah</xa-datasource-property>
| <xa-datasource-property name="PortNumber">5432</xa-datasource-property>
|
| <xa-datasource-property name="User">user</xa-datasource-property>
| <xa-datasource-property name="Password">password</xa-datasource-property>
|
| <metadata>
| <type-mapping>PostgreSQL</type-mapping>
| </metadata>
| </xa-datasource>
| </datasources>
|
The type-mapping is from standardjbosscmp-jdbc.xml
The configuration parameters were identifed in http://wiki.jboss.org/wiki/ConfigDataSources the wiki
And in your ejb-deployer, you should use your newly configured datasource (in my case XAPostGresDS)
| <mbean code="org.jboss.ejb.txtimer.DatabasePersistencePolicy" name="jboss.ejb:service=EJBTimerService,persistencePolicy=database">
| <!-- DataSourceBinding ObjectName -->
| <depends optional-attribute-name="DataSource">jboss.jca:service=DataSourceBinding,name=XAPostGresDS</depends>
| <!-- The plugin that handles database persistence -->
| <attribute name="DatabasePersistencePlugin">org.jboss.ejb.txtimer.GeneralPurposeDatabasePersistencePlugin</attribute>
| <!-- The timers table name -->
| <attribute name="TimersTable">TIMERS</attribute>
| </mbean>
|
I think thats about it.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4146006#4146006
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4146006
18 years
[JBoss Messaging] - Re: MQ migration help
by tnine
One last quick question before I start. I want to make sure I'm not misunderstanding the J2EE 1.4 implementation details of an MDB.
What I expect
My MDB reads from the StatementInput queue. It fails to process the message, and the transaction is rolled back. After 2 failed read attempts on a message, it should go into the dead letter queue. In my configuration, this will be the StatementDLQ
What's happening
My MDB reads from StatementInput queue. It processes 2 messages, and 2 messages fail. However, with a clean system, the message count of StatementDLQ is 0, but the message count of DLQ is 2. This is equal to the number of failed messages.
Should all failures of MDB's end up in default queue/DLQ regardless of configuration? I read the J2EE 1.4 and JMS 1.1 spec, but I couldn't find anything in the exception documentation that outlines DLQ requirements.
Thanks,
Todd
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4145992#4145992
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4145992
18 years