[JBoss Messaging Development] - Message redelivery not working on rolling back of transaction in MDB
by Samba Siva Rao Kolusu
Samba Siva Rao Kolusu [http://community.jboss.org/people/saasira] created the discussion
"Message redelivery not working on rolling back of transaction in MDB"
To view the discussion, visit: http://community.jboss.org/message/620536#620536
--------------------------------------------------------------
Hi all,
We have a system that relies heavily on JMS for its functionality, and we are seeing some odd behaviour from JBM.
Here is a brief explanation of our system;
0.1. An event processor periodically scans the database for interested events and notifies appropriate components in the system about the new event
0.2. The relevant component does some processing of the data that is available at that instant and sends back the SUCCESS or FAILURE message to the event processor.
0.3. In case any exception occurred while processing the event in a particular component of the system, that component signals rolling back of the whole transaction, and sends a RETRY (after some preconfigured time) message to the event processor.
0.4. The event processor retries to notify the respective component for a few times (preconfigured) and if the event is still not processed successfully, it finally marks that event as FAILED.
We are seeing strange behaviour with respect to the point number 3 that is mentioned above. While the spec says that rolling back a container managed transaction in MDB's onMessage method ( by invoking mdbContext.setRollbackOnly(true) ) would ensure that the message gets redelivered by the JMS engine, we are observing that no message redelivery is attempted by JBM and instead the additional message that our component sends to the event manager is also successfully devliered (from the rolled back transactional MDB instance).
I have to mention that at the time when the respective component was coded, we did not reallize that we need to span a nested transaction (possibly bean mabaged) if we want to roll back just those changes made with in the component and ensure that the actual JMS message gets successfully processed from teh JBM engine perspective. So, we have relied on the behaviour that sending a new JMS message to back to the event processor works even after rolling back the transaction from onMessage() method of MDB.
Things have been working fine like this for quite some time but occasionally we see that the JMS message being redevliered by JBM at very quick succession and that particular event which had suffered this fate would end up with no state, i.e. neither SUCCESS, nor FAILURE; the RETRY message would not reach the event processor and hence retry was also not attempted-- thus in an indeterminate state.
I have a few questions here:
** Why is JBM behaving different from what is defined in spec, i.e. why is the message not redelivered when the transaction is rolled back?
** Why is the additioanal message being sent from the respective component to the event processor successfully even from within a rolledback transaction?
** Why does the JBM attempt to redelvier the message, on transaction rollback, only occassionally?
** Is the analysis made so far correct?
** If so, can i change my code to spawn a nested (bean managed) transaction within the MDB so that the rolling back of that transaction will not have nay impact on the global transaction?
Please give me some advice and direction...
Thanks and Regards,
Samba
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/620536#620536]
Start a new discussion in JBoss Messaging Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
12 years, 10 months
[JBoss AS7 Development] - Intermittent JSF bootstrapping bug?
by Nicklas Karlsson
Nicklas Karlsson [http://community.jboss.org/people/nickarls] created the discussion
"Intermittent JSF bootstrapping bug?"
To view the discussion, visit: http://community.jboss.org/message/619568#619568
--------------------------------------------------------------
Anyone seen the issue of JSF applications sometimes not starting up with an exception
10:10:24,371 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/LTK]] (http--127.0.0.1-8080-2) StandardWrapper.Throwable: java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.context.FacesContextFactory
at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:804) [jboss-jsf-api_2.0_spec-1.0.0.Final.jar:1.0.0.Final]
at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:306) [jboss-jsf-api_2.0_spec-1.0.0.Final.jar:1.0.0.Final]
at javax.faces.webapp.FacesServlet.init(FacesServlet.java:166) [jboss-jsf-api_2.0_spec-1.0.0.Final.jar:1.0.0.Final]
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1202) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:952) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:188) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
at org.jboss.as.web.NamingValve.invoke(NamingValve.java:57) [jboss-as-web-7.1.0.Alpha1-SNAPSHOT.jar:7.1.0.Alpha1-SNAPSHOT]
at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:49) [jboss-as-jpa-7.1.0.Alpha1-SNAPSHOT.jar:7.1.0.Alpha1-SNAPSHOT]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:154) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:667) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:952) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
at java.lang.Thread.run(Thread.java:722) [:1.7.0]
10:10:24,374 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/LTK].[FacesServlet]] (http--127.0.0.1-8080-2) Allocate exception for servlet FacesServlet: java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.context.FacesContextFactory
at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:804) [jboss-jsf-api_2.0_spec-1.0.0.Final.jar:1.0.0.Final]
at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:306) [jboss-jsf-api_2.0_spec-1.0.0.Final.jar:1.0.0.Final]
at javax.faces.webapp.FacesServlet.init(FacesServlet.java:166) [jboss-jsf-api_2.0_spec-1.0.0.Final.jar:1.0.0.Final]
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1202) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:952) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:188) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
at org.jboss.as.web.NamingValve.invoke(NamingValve.java:57) [jboss-as-web-7.1.0.Alpha1-SNAPSHOT.jar:7.1.0.Alpha1-SNAPSHOT]
at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:49) [jboss-as-jpa-7.1.0.Alpha1-SNAPSHOT.jar:7.1.0.Alpha1-SNAPSHOT]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:154) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:667) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:952) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
at java.lang.Thread.run(Thread.java:722) [:1.7.0]
Sometimes restarting the server helps, sometimes redeploying the application helps. This is usually something you see when you accidently put too much stuff in the deployment lib but this is not the case here. If there are other exceptions, they are swallowed because this is all I see.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/619568#619568]
Start a new discussion in JBoss AS7 Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
12 years, 10 months
[JBoss Tools Development] - How to Make Your JUnit Tests Run Faster in Eclipse
by Denis Golovin
Denis Golovin [http://community.jboss.org/people/dgolovin] modified the document:
"How to Make Your JUnit Tests Run Faster in Eclipse"
To view the document, visit: http://community.jboss.org/docs/DOC-15108
--------------------------------------------------------------
TBD: more tips and examples are comming (work is still in progress)
1. Consider mocking for eclipse interfaces rather trying to obtain real one from eclipse
2. Consider using core tests instead of ui tests, which is required to start eclipse workbench
3. If you need test project during test execution try to make it as simpler as it possible:* remove all unused jars and remove all unused classes from jars you need to make java indexing faster
* remove all builders from .project file that doesn't required in your test or disable them during runtime
* disable validation if your tests are not for validation issues
* disable java indexing if you cannot create test project without jars
* disable auto builder if you do not need to test incremental builder functionality
* disable decoration calculation (not sure if that possible)
4. Try to reuse test projects between several tests to import it only ones during test execution. Use TestSetup wrapper to achieve this, because setUp and tearDown methods are executed before and after each test* methods in class.
5. Try to fit all tests in one eclipse session, because eclipse start takes time
6. Add missing xml schemas and dtd's into exml catalog and map them to local resources in test/runtime plugins to avoid downloading them from internet during test execution
--------------------------------------------------------------
Comment by going to Community
[http://community.jboss.org/docs/DOC-15108]
Create a new document in JBoss Tools Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=102&co...]
12 years, 10 months
[JBoss AS7 Development] - Services with missing/unavailable dependencies EntityManager
by Raphael Ferreira
Raphael Ferreira [http://community.jboss.org/people/raphael_pf] created the discussion
"Services with missing/unavailable dependencies EntityManager"
To view the discussion, visit: http://community.jboss.org/message/619237#619237
--------------------------------------------------------------
Hello, we have an application running on glassfish jee6 and want to migrate to jboss7. The application is a war and uses two persistence to access two separate base.
The persistence:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0"
xmlns=" http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="siscoex-persistence-unit">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>jdbc/siscoex</jta-data-source>
<jar-file>lib/siscoex-core-0.3.0-SNAPSHOT.jar</jar-file>-->
<jar-file>lib/seta-jee-core-0.0.2.jar</jar-file>
<properties>
<property name="hibernate.default_schema" value="siscoex" />
<property name="hibernate.ejb.use_class_enhancer" value="true" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.bytecode.provider" value="javassist" />
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
<property name="LC_MESSAGES" value="en_us" />
<!-- <property name="hibernate.hbm2ddl.auto" value="update" /> -->
</properties>
</persistence-unit>
<persistence-unit name="seta-persistence-unit">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>jdbc/seta_jee</jta-data-source>
<jar-file>lib/seta-jee-core-0.0.2.jar</jar-file>
<properties>
<property name="hibernate.default_schema" value="seta" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
<property name="LC_MESSAGES" value="en_us" />
<property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
<property name = "hibernate.query.factory_class" value="org.hibernate.hql.classic.ClassicQueryTranslatorFactory"/>
<property name="hibernate.archive.autodetection" value="class"/>
</properties>
</persistence-unit>
</persistence>
The EJB:
@Stateless
public class PaisManagerBean implements PaisManager {
@PersistenceContext(unitName = "seta-persistence-unit")
private EntityManager ems;
@Override
public Pais buscarPorCodigoSiscomex(Integer codigoSiscomex) {
try {
return ems.createQuery("from Pais where codigoSiscomex = :c", Pais.class).setParameter("c", codigoSiscomex)
.getSingleResult();
} catch (NoResultException e) {
return null;
}
}
}
**
The Error:
Can anyone give any clues?
thk regards,
Raphael
10:14:44,929 ERROR [org.jboss.as.deployment] (DeploymentScanner-threads - 1) {"Composite operation failed and was rolled back. Steps that failed:" =>
{"Operation step-2" => {"Services with missing/unavailable dependencies" =>
["jboss.deployment.unit.\"siscoex-internet.war\".component.PaisManagerBean.START missing
[ jboss.naming.context.java.module.siscoex-internet.siscoex-internet.\"env/br.gov.ce.sefaz.seta.jee.core.manager.bean.PaisManagerBean/ems\" ]",
"jboss.deployment.unit.\"siscoex-internet.war\".jndiDependencyService missing
[ jboss.naming.context.java.module.siscoex-internet.siscoex-internet.\"env/br.gov.ce.sefaz.seta.jee.core.manager.bean.UnidadeFederacaoManagerBean/ems\",
jboss.naming.context.java.module.siscoex-internet.siscoex-internet.\"env/br.gov.ce.sefaz.seta.jee.core.manager.bean.PaisManagerBean/ems\" ]",
"jboss.deployment.unit.\"siscoex-internet.war\".component.UnidadeFederacaoManagerBean.START missing
[ jboss.naming.context.java.module.siscoex-internet.siscoex-internet.\"env/br.gov.ce.sefaz.seta.jee.core.manager.bean.UnidadeFederacaoManagerBean/ems\" ]"]}}}
The Datasource:
<datasource jndi-name="jdbc/siscoex" pool-name="siscoex_pool_Pool" enabled="true" jta="true" use-java-context="true" use-ccm="true">
<connection-url>
jdbc:postgresql://localhost:5432/siscoex
</connection-url>
<driver>
postgresql-8.4-701.jdbc4.jar
</driver>
<security>
<user-name>
postgres
</user-name>
<password>
postgres
</password>
</security>
</datasource>
<datasource jndi-name="jdbc/seta_jee" pool-name="seta_jee_pool_Pool" enabled="true" jta="true" use-java-context="true" use-ccm="true">
<connection-url>
jdbc:postgresql://localhost:5432/siscoex
</connection-url>
<driver>
postgresql-8.4-701.jdbc4.jar
</driver>
<security>
<user-name>
postgres
</user-name>
<password>
postgres
</password>
</security>
</datasource>
#####
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/619237#619237]
Start a new discussion in JBoss AS7 Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
12 years, 10 months