|
|
|
해결방법
우선 회피책으로 제시되어 있는, Hibernate 라이브러리 및 참조관계가 있는 라이브러리를 모두 부트 클래스 패스로 옮기는 것이나, 쿼리 파서를 구버전으로 강제로 지정하는 것 모두 실제로 적용하기엔 문제가 있습니다. 웹로직에서는 두가지 방법으로 해당 문제점을 회피할 수 있습니다. 첫번째 : WAR 의 경우 WEB-INF/classes/weblogic.xml 을 다음과 같이 설정합니다. <?xml version="1.0" encoding="UTF-8"?> <wls:weblogic-web-app xmlns:wls="http://www.bea.com/ns/weblogic/90" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-web-app.xsd"> <wls:weblogic-version>10.0</wls:weblogic-version> <wls:jsp-descriptor> <wls:page-check-seconds>3</wls:page-check-seconds> <wls:precompile>false</wls:precompile> </wls:jsp-descriptor> <wls:container-descriptor> <wls:servlet-reload-check-secs>3</wls:servlet-reload-check-secs> <wls:resource-reload-check-secs>-1</wls:resource-reload-check-secs> <wls:prefer-web-inf-classes>true</wls:prefer-web-inf-classes> </wls:container-descriptor> <wls:context-root>anyframe-iam-admin-web</wls:context-root> <wls:charset-params> <wls:input-charset> <wls:resource-path>/*</wls:resource-path> <wls:java-charset-name>utf-8</wls:java-charset-name> </wls:input-charset> </wls:charset-params> </wls:weblogic-web-app> 두번째 : EAR 의 경우 위에 표기된 것처럼 특정 패키지로 시작하는 클래스를 별도로 지정합니다. EAR 패키지의 META-INF/weblogic-application.xml 을 다음과 같이 설정합니다. <?xml version="1.0" encoding="UTF-8"?> <wls:weblogic-application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wls="http://www.bea.com/ns/weblogic/90" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/j2ee_1_4.xsd http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-application.xsd"> <wls:prefer-application-packages> <wls:package-name>antlr.*</wls:package-name> </wls:prefer-application-packages> </wls:weblogic-application> 세번째, 클래스패스에 antlr 을 추가 %WL_HOME%\common\lib 디렉토리에 antlr-2.7.6.jar 을 복사한 후 setDomainEnv.cmd (또는 sh) 에 set PRE_CLASSPATH=%WL_HOME%\common\lib\antlr-2.7.6.jar 와 같이 추가해 주어도 정상적으로 동작합니다. Configuring BEA WebLogic with Hibernate 3.x Both of these apps use a version of ANTLR. Hibernate uses 2.7.6 while WebLogic use 2.7.1. In order for Hibernate 3 to run under WebLogic, a classpath change is required. The ANTLR code for WebLogic is part of the server\lib\weblogic.jar so it's impossible to replace just the ANTLR jar file. Instead you have to setup a PRE_CLASSPATH that puts the Hibernate jar in the classpath before the weblogic.jar. 1. Edit startWebLogic.cmd located in bea\user_projects\domains\mydomains. Change the line for the PRE_CLASSPATH to read: set PRE_CLASSPATH=%WL_HOME%\common\lib\antlr-2.7.6.jar 2. Copy the ANTLR jar from the Hibernate distro to WL_HOME\common\lib. For me, WL_HOME is C:\bea\wlserver_10.0, but you can find your setting in the startWebLogic.cmd file. Now when WebLogic starts an application that uses Hibernate3, you should not get any errors. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
https://www.hibernate.org/250.html
BEA Weblogic issues
Hibernate3 uses ANTLR for the new query parser. Unfortunately BEA Weblogic includes a version of ANTLR in the system classpath which will be loaded before any application libraries and, because Weblogic doesn't seem to support proper class loader isolation, will not see the Hibernate classes in the application's context.
BEA seems to solve this issue by prefixing package names, but the distributed ANTLR doesn't have this prefix. Another source for this issue is the usage of Class.forName() in ANTLR itself.
Until both parties have solved these issues we can only provide workarounds: Place all your Hibernate and dependent libraries on the application server's boot classpath or use the old query parser as described above.
The Hibernate Team has sent a fix for this issue to the ANTLR developers, and it should be included in the next release. We'll distribute this new version with a minor release of Hibernate in the next few weeks or months.
For now we distribute a patched version of ANTLR with Hibernate 3.0 which uses the context classloader instead of Class.forName().
<prefer-application-packages>
<package-name>antlr.*</package-name>
</prefer-application-packages>