Java EE Application porting - Oracle 10g AS to Oracle 11g Weblogic server
I am porting a Java EE application from Oracle 10g Application Server to Oracle 11g Weblogic Server.
I have a common.jar which contains Connection related classes and present inside war/web-inf/lib. The application is deployed as an EAR and the ejbs also refer to classes inside the common.jar to get DB Connection. The EJB is 开发者_如何学Cnot able to get reference to these classes at runtime. I copied the common.jar inside APP-INF/lib directory, In that case what happens is the JSP’s are unable to get reference to the Connection related classes. I have jsp’s which has sql code embedded in it. This application was developed way back and do not have the business knowledge change these code now.
How can I solve this issue? How the ejb can get reference to the classes located inside war/web-inf/lib.
You cannot have the EJB look into the WAR WEB-INF/lib for classes. That goes against the Classloader Hierarchy for Weblogic.
Putting the common jar in the APP-INF/lib is the correct way to go
WebLogic Server provides a location within an EAR file where you can store shared utility classes. Place utility JAR files in the APP-INF/lib directory and individual classes in the APP-INF/classes directory. (Do not place JAR files in the /classes directory or classes in the /lib directory.) These classes are loaded into the root classloader for the application.
Can you also post the errors JSPs get when they are unable to load these? Are these ClassNotFoundException
or NoClassDefFoundError
or something else ?
Also see the Best practices for using Shared Java EE Libraries
精彩评论