This content has been marked as final. Show 6 replies
Hi,1 person found this helpful
It is necessary to use antlr 2.7.6 (this version works, however more details of which version should be checked with Hibernate as being a third party tool). There are 4 possible workarounds for this classloading issue:
Package antlr.jar into WEB-INF/lib and add the following tag to weblogic.xml (this works for war alone or packaged into an ear).
If it is an ear file then put antlr.jar at APP-INF/lib (or at web application level: WEB-INF/lib) and modify weblogic-application.xml adding the following tag:
Change property hibernate.query.factory_class from hibernate configuration file (hibernate.cfg.xml) (if hibernate.query.factory_class doesn't exist then this value is assigned by default):
<property name="hibernate.query.factory_class" value="org.hibernate.hql.ast.ASTQueryTranslatorFactory"/>
to a different parser (classic):
<property name="hibernate.query.factory_class" value="org.hibernate.hql.classic.ClassicQueryTranslatorFactory"/>
Set at server classpath level antlr library before WLS classpath (warning: this is the less recommended option because it impacts the whole WLS and may affect another modules).
In setDomainEnv.cmd (or any of the start-up scripts) set the next value at the end of the file, referring to antlr library's location:
This is useful Kal. I understand there is no J2EE way out and the best way is weblogic.xml.
I have implemented all the three strategies together. I did not do the fourth one as you don't recommend jeopardising the server's classpath. I have other problems classloading the xml apis. I hope to solve that.
show me the error once.
The error I recieved for introducing weblogic.xml was
java.lang.ClassCastException: weblogic.xml.jaxp.RegistryDocumentBuilderFactory cannot be cast to javax.xml.parsers.DocumentBuilderFactory
I read in another forum that weblogic.xml cannot be read because I had xmlParserAPIs-2.0.2 in my ear, but weblogic has another of XML version. So i was asked to remove my jar.
I did so and kept recieving similar errors like the following:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/wls1211_dev/modules/org.slf4j.jdk14_22.214.171.124.jar!/org/slf4j/impl/StaticLoggerBinder.class]
So, I added the following in the weblogic-application.xml
This did not help as well. So I am trying to upgrade my application to what weblogic uses and remove the jars from my package. Is that the right direction ?
Hi,1 person found this helpful
You can resolve this issue by taking the below actions:
1. Ordering the web application in the weblogic-application.xml by using below tag.
2. Use of Prefer-application-packages in 'weblogic-application.xml' file
3. Add required jars in WEB-INF/lib (version specific to the web application) and in the weblogic.xml file, use
<prefer-web-inf-classes> to true.
I undid the changes and followed your suggestion except the first one on classloader-structure.
The error is
Caused By: java.lang.ClassCastException: weblogic.xml.jaxp.RegistryDocumentBuilderFactory cannot be cast to javax.xml.parsers.DocumentBuilderFactory
So, I added the following in weblogic-application.xml
My expectation was to request weblogic to load the javax.xml from the jar called xmlParserAPIs-2.0.2.jar, which is packaged inside the war. But that request is not honored by weblogic. I believe I am not communicating with weblogic correctly. Can you please rescue.