<BEA-000000> <java.lang.NegativeArraySizeException
If you get this error with WebLogic’s admin server
####<2015-12-17 14:30:14 EET> <Critical> <EmbeddedLDAP> <www.myserver.com> <AdminSOA> <VDE Replication Thread> <<anonymous>> <> <9f23d04b03212987:b0dda39:151a2d3b538:-8000-0000000000004207> <1450355414644> <BEA-000000> <java.lang.NegativeArraySizeException at com.octetstring.vde.EntryChanges.readBytes(EntryChanges.java:274) at com.octetstring.vde.EntryChanges.<init>(EntryChanges.java:72) at com.octetstring.vde.replication.BackendChangeLog.getChange(BackendChangeLog.java:548) at com.octetstring.vde.replication.Replicator.run(Replicator.java:180) at com.octetstring.vde.replication.Replication.run(Replication.java:339) > )
chances are that there are corrupted LDAP files in the <domain home>/servers/<server name>/data/ldap/ldapfiles
folder. One possible solution is to delete the changelog.data
and changelog.index
files (take a backup first of these two files) and restart the admin server.
java.lang.OutOfMemoryError: getNewTla
This is an error I was getting while trying to load a huge excel file with WebLogic. It seems that the TLA (Thread Local Area) was running out of memory. The TLA is the space reserved on the heap for use exclusively by a thread. Running out of memory means that there is no more space to use in the heap. Having said this, the solution is to increase the available heap space (with Xmx
) and not just to fiddle around with the XXtlaSize
switch.
javax.naming.OperationNotSupportedException: bind not allowed in a ReadOnlyContext; remaining name
I got this exception when i tried to define a mail session in WebLogic’s console. I defined the JNDI name to be java:/Mail
but it seems that WebLogic does not like the java:/
prefix, so I had to remove it (both from the console and the calling code), and it worked.
java.lang.ClassCastException: YOUR_REPORT_NAME_1290416522329_455758 cannot be cast to net.sf.jasperreports.engine.fill.JREvaluator
Another classloading issue. While jasper reports work fine on JBoss, on WebLogic they fail with the exception
net.sf.jasperreports.engine.JRException: Error loading expression class : MYREPORT_1290416522329_455758
...
Caused by: java.lang.ClassCastException: MYREPORT_1290416522329_455758 cannot be cast to net.sf.jasperreports.engine.fill.JREvaluator
at net.sf.jasperreports.engine.design.JRAbstractJavaCompiler.loadEvaluator(JRAbstractJavaCompiler.java:101)
This is easily resolved. In my configuration it was just a matter of moving my jasper jar file from the root of ear to the WEB-INF/lib
folder of my web app, in order to be picked up by a different classloader. If this does not work try moving the jasper jar file around in different locations, one of them will work.
ClassNotFoundException: org.hibernate.hql.ast.HqlToken
Another exception under WebLogic server. This exception occurs because the default query factory class in persistence.xml
is the org.hibernate.hql.ast.ASTQueryTranslatorFactory
. As the name suggests this is a classpath issue. You might be wondering why you get it since you have the hibernate jar file (the file that contains the HqlToken
class) in your classpath. The reason is that the weblogic.jar contains a version of antlr.jar
which is loaded by a classloader, while the hibernate stuff are loaded by another classloader. So when the server runs it’s using the version of antlr bundled with weblogic which cannot see the hibernate classes. There are two solutions to this problem
1) Use a
<property name="hibernate.query.factory_class" value="org.hibernate.hql.classic.ClassicQueryTranslatorFactory"/>
instead of a
<property name="hibernate.query.factory_class" value="org.hibernate.hql.ast.ASTQueryTranslatorFactory"/>
in your persistence.xml
. This will solve the problem but you will have additional issues if you use Enums
as parameters to queries (like I do) since I found out the the ClassicQueryTranslatorFactory
has problems translating Enum
data types to parameters (instead it translates them as bytes, unless you pass the actual value itself and not the Enum
object).
2)
Add Hibernate’s antlr jar file as first entry in the classpath (in your startWeblogic
script of your domain’s bin
folder) and force weblogic to use this instead. I copied it into the common/lib
folder and used
set CLASSPATH=%WL_HOME%\common\lib\antlr-2.7.6.jar;%SAVE_CLASSPATH%
There is another solution suggested, to add the following
<prefer-application-packages> <package-name>antlr.*</package-name> </prefer-application-packages>
in your weblogic-application.xml
, but for some reason this did not work for me.
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.
java.lang.UnsupportedOperationException: The user must supply a JDBC connection
If you get this with Hibernate it probably means that you have an error, or an incomplete persistence.xml
file. I got this while migrating from JBoss to WebLogic server and had forgotten to migrate the configuration from JBoss’ *-ds.xml
to persistence.xml
.
It happens because of this bit of code (Hibernate’s ConnectionProviderFactory.java
)
ConnectionProvider connections; String providerClass = properties.getProperty(Environment.CONNECTION_PROVIDER); if ( providerClass!=null ) { try { log.info("Initializing connection provider: " + providerClass); connections = (ConnectionProvider) ReflectHelper.classForName(providerClass).newInstance(); } catch ( Exception e ) { log.error( "Could not instantiate connection provider", e ); throw new HibernateException("Could not instantiate connection provider: " + providerClass); } } else if ( properties.getProperty(Environment.DATASOURCE)!=null ) { connections = new DatasourceConnectionProvider(); } else if ( properties.getProperty(Environment.URL)!=null ) { connections = new DriverManagerConnectionProvider(); } else { connections = new UserSuppliedConnectionProvider(); }
It tries to load several connection providers based on the Environment
properties, it can’t find any connection providers (since their corresponding properties are not defined in the persistence.xml
) and it just returns the default UserSuppliedConnectionProvider
which, alas, it’s getConnection
method is the following
public Connection getConnection() { throw new UnsupportedOperationException("The user must supply a JDBC connection"); }
After fixing the error, my persistence.xml
is the following
<?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="myUnit" transaction-type="JTA"> <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="org.hibernate.dialect.Oracle9Dialect"/> <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"/> <property name="hibernate.query.factory_class" value="org.hibernate.hql.ast.ASTQueryTranslatorFactory"/> </properties> </persistence-unit> </persistence>