Archive
Unknown runtime error Line: 120 Char: 1 Code: 0 URI: 3_3_3.Finalorg.ajax4jsf.javascript.AjaxScript
Not strictly Java related but I thought I could post it here. I was getting the error
Unknown runtime error Line: 120 Char: 1 Code: 0 URI: 3_3_3.Finalorg.ajax4jsf.javascript.AjaxScript
on I.E. (FF and Chrome worked fine) when I included a form within a form in RichFaces. As soon as I got rid of the second form (in the included file) the problem went away.
Caused by javax.persistence.TransactionRequiredException with message: “no transaction is in progress”
This is weird, I am not sure why I am getting it. I have an application that makes some calculations that take some considerable time, and I persist the results. I run my application with 100 records from the database and everything works fine. I run my application with 60.000 records from the database and I am getting the above error message. The exception happens when the flush()
method is called on the EntityManager
. If I am to have a wild guess I’d say that there is a transaction time out (it is set to 30 seconds in the weblogic console) and therefore when the flush()
method is called there is no active transaction.
Anyway I managed to overcome this issue by explicitly defining a user transaction
import org.jboss.seam.transaction.Transaction; import org.jboss.seam.transaction.UserTransaction; ... ... UserTransaction ut = Transaction.instance(); ut.begin(); ... ... ut.commit();
If you have any idea why this is happening please leave a comment.
UPDATE: Now the first transaction (the one with 100 records) fails. It complains that there is already one transaction active when I try to start a new one. I guess I need to revert my code and to increase the transaction timeout on the weblogic console, this would solve both issues.
Error loading element Identity with component name null and component class null
This error is related to this post, and is solved by the exact same manner.
1) Edit your application.xml
and move the jboss-seam.jar
module to the top.
2) Edit each MANIFEST.MF
file of the rest of your modules defined in the application.xml
and remove the jboss-seam.jar
entry.
3) Rebuild and redeploy your ear.
No phase id bound to current thread (make sure you do not have two SeamPhaseListener instances installed)
Caused by java.lang.IllegalStateException with message: "No phase id bound to current thread (make sure you do not have two SeamPhaseListener instances installed)
”
Another JBoss to WebLogic migration issue. This error is caused by having the jboss-seam.jar
file twice in the classpath or by loading it more than once. This link explains the problem for JBoss in more details, but the same solution can be applied to WebLogic. Move the loading of the jboss-seam.jar
first in the application.xml
and remove any reference of it in all the MANIFEST.MF
files in the rest of the modules declared in application.xml
.
application.xml
<?xml version="1.0" encoding="UTF-8"?> <application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:application="http://java.sun.com/xml/ns/javaee/application_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd" version="5"> <display-name>store-ear</display-name> <module> <ejb>jboss-seam.jar</ejb> </module> <module> <web> <web-uri>store.war</web-uri> <context-root>/store</context-root> </web> </module> <module> <ejb>storeModel-ejb.jar</ejb> </module> <module> <ejb>storeCommon-ejb.jar</ejb> </module> <module> <ejb>store-ejb.jar</ejb> </module> <module> <ejb>store-products.jar</ejb> </module> </application>
MANIFEST.MF
in store-ejb.jar
, before jboss-seam.jar
removal
Manifest-Version: 1.0 Class-Path: storeCommon-ejb.jar antlr-runtime.jar jboss-seam.jar drools-compiler.jar drools-core.jar jboss-el.jar jbpm-jpdl.jar mvel14.jar richfaces-api.jar
MANIFEST.MF
in store-ejb.jar
, after jboss-seam.jar
removal
Manifest-Version: 1.0 Class-Path: storeCommon-ejb.jar antlr-runtime.jar drools-compiler.jar drools-core.jar jboss-el.jar jbpm-jpdl.jar mvel14.jar richfaces-api.jar
Error loading element EntityTransaction with component name null and component class null
The exception java.lang.RuntimeException: Error loading element EntityTransaction with component name null and component class null
is caused by this line
<transaction:entity-transaction entity-manager="#{entityManager}"/>
in the components.xml
file. In order to fix the error you have to replace the
<persistence:managed-persistence-context name="entityManager" auto-create="true" persistence-unit-jndi-name="java:/myManagerFactory"/>
with
<persistence:entity-manager-factory name="entityManagerFactory" persistence-unit-name="myPersistenceUnit"/> <persistence:managed-persistence-context name="entityManager" auto-create="true" entity-manager-factory="#{entityManagerFactory}" />
and remove the
<transaction:entity-transaction entity-manager="#{entityManager}"/>
line.
The myPersistenceUnit
is the name of the persistence unit in persistence.xml
<?xml version="1.0" encoding="UTF-8"?> <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0"> <persistence-unit name="myPersistenceUnit" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <jta-data-source>myDatasource</jta-data-source> <properties> <property name="hibernate.connection.provider_class" value="org.hibernate.connection.DatasourceConnectionProvider"/> <property name="hibernate.connection.datasource" value="myDatasource"/> <property name="transaction.factory_class" value="org.hibernate.transaction.JTATransactionFactory"/> <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/> <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.WeblogicTransactionManagerLookup"/> <property name="hibernate.dialect" value="gr.my.company.util.MyAS400Dialect"/> <property name="hibernate.hbm2ddl.auto" value="validate"/> <property name="hibernate.show_sql" value="true"/> <property name="hibernate.format_sql" value="true"/> <property name="hibernate.default_schema" value="MYSCHEMA"/> </properties> </persistence-unit> </persistence>
No EJBs found in the ejb-jar file ‘MyApplication.jar’. Please ensure the ejb-jar contains EJB declarations via an ejb-jar.xml deployment descriptor or at least one class annotated with the @Stateless, @Stateful or @MessageDriven EJB annotation
Another migration error. In my application.xml
I have defined an <ejb>
module but my ejb project only contains EJB 3.0 @Entity
annotated beans. WebLogic (10.3) doesn’t like this and expects a @Stateless
, @Stateful
or @MessageDriven
annotated bean. It doesn’t find any and throws a
No EJBs found in the ejb-jar file ‘MyApplication.jar’. Please ensure the ejb-jar contains EJB declarations via an ejb-jar.xml
deployment descriptor or at least one class annotated with the @Stateless, @Stateful or @MessageDriven EJB annotation
exception. The exact same jar file works fine on JBoss and WebSphere though. Not sure which one is right but I had to add a dummy @Stateless
EJB in the jar file order to make it work.