In this post, I will try to explain the various issues/solutions which we have faced while migrating the applications to Weblogic (Oracle 11g) from OC4J.
The following post will detail out the various issues/solutions during our applications upgrade of weblogic.
<weblogic-application xmlns="http://www.bea.com/ns/weblogic/90"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<xml>
<parser-factory>
<saxparser-factory> org.apache.xerces.jaxp.SAXParserFactoryImpl
</saxparser-factory>
<document-builder-factory>
org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
</document-builder-factory>
<transformer-factory>
org.apache.xalan.processor.TransformerFactoryImpl
</transformer-factory>
</parser-factory>
</xml>
<application-param>
<param-name>webapp.encoding.default</param-name>
<param-value>UTF-8</param-value>
</application-param>
<prefer-application-packages>
<package-name>org.apache.xerces.*</package-name>
<package-name>org.apache.commons.*</package-name>
<package-name>org.apache.log4j.*</package-name>
</prefer-application-packages>
</weblogic-application>
The following post will detail out the various issues/solutions during our applications upgrade of weblogic.
Switching to Xerces Parser
In case the applications are using the Spring or webservices or JAXB or Hibernate libraries, the Xerces parse should be configured instead of weblogic default parser. Please follow the below steps to achieve this.
- Place the following jars under the
/library folder; xercesImpl-2.9.1.jar, xalan-2.7.1.jar, and serializer-2.7.1.jar - Once we have placed the file, we need to make sure that weblogic uses these while starting up. For that we need to change the follwing file.
/user_projects/domains/ setDomainEnv.cmd. Open this file identify all the places where we find the following code; set JAVA_OPTIONS ; this has to be updated with the follwing lines. - Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl -Djavax.xml.transform.TransformerFactory=org.apache.xalan.processor.TransformerFactoryImpl -Dorg.xml.sax.driver=org.apache.xerces.parsers.SAXParser/bin/
- In OC4J for EAR remove the orion-application.xml and add the weblogic-application.xml to
/META-INF folder with the follwing content.
<?xml version="1.0"?> <weblogic-application xmlns="http://www.bea.com/ns/weblogic/90"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<xml>
<parser-factory>
<saxparser-factory> org.apache.xerces.jaxp.SAXParserFactoryImpl
</saxparser-factory>
<document-builder-factory>
org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
</document-builder-factory>
<transformer-factory>
org.apache.xalan.processor.TransformerFactoryImpl
</transformer-factory>
</parser-factory>
</xml>
<application-param>
<param-name>webapp.encoding.default</param-name>
<param-value>UTF-8</param-value>
</application-param>
<prefer-application-packages>
<package-name>org.apache.xerces.*</package-name>
<package-name>org.apache.commons.*</package-name>
<package-name>org.apache.log4j.*</package-name>
</prefer-application-packages>
</weblogic-application>
- The following libraries were removed from the maven build. i.e; we removed the following jar files from pom.xml and no errors were observed during testing and deployment.
- javax.xml.soap:saaj-api
- xerces:xercesImpl
- xml-apis:xml-apis
- These were the oracle specific libraries which was removed.
- oracle.xml:xmlparserv2
- oracle.j2ee.ws:orasaaj
- oracle.j2ee.ws:soap
- oracle.j2ee.ws:wsa
- oracle.j2ee.ws:wsclient
- oracle.j2ee.ws:xsdlib
- oracle.j2ee.ws:relaxngDatatype
Application Libraries Loading Order
We need to load the application libraries first rather than the web-logic libraries for some of the libraries. Hibernate depends on different version of ANTLR jar than the default one weblogic libraries, to reolve this conflict and add weblogic.xml under the web application WEB-INF folder with the following details.
pre.CICodeFormatter{
font-family:arial;
font-size:12px;
border:1px dashed #CCCCCC;
width:99%;
height:auto;
overflow:auto;
background:#f0f0f0;
line-height:20px;
padding:0px;
color:#000000;
text-align:left;
}
pre.CICodeFormatter code{
color:#000000;
word-wrap:normal;
}
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/90"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-web-app.xsd">
<container-descriptor>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>
</weblogic-web-app>
This helps in configuring weblogic to load the right ANTLR library version from the application libraries rather than the server libraries.
External Configuration Files Loading
Most of the applications will have application configuration files. And most of our applications there is a different folder other than the one inside the EAR applications. Earlier we used this path in the orion.xml, but in weblogic we need to use a different mechanism namely using the Generic File loading which is available in weblogic.
We need to add a plan.xml as part of the deployment plan and then add the config-root element to it.
pre.CICodeFormatter{
font-family:arial;
font-size:12px;
border:1px dashed #CCCCCC;
width:99%;
height:auto;
overflow:auto;
background:#f0f0f0;
line-height:20px;
padding:0px;
color:#000000;
text-align:left;
}
pre.CICodeFormatter code{
color:#000000;
word-wrap:normal;
}
<?xml version="1.0" encoding="UTF-8"?>
<deployment-plan xmlns="http://xmlns.oracle.com/weblogic/deployment-plan" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/weblogic/deployment-plan http://xmlns.oracle.com/weblogic/deployment-plan/1.0/deployment-plan.xsd">
<config-root>D:\Users\testApp</config-root>
</deployment-plan>
After this we need to go the console application of weblogic. Under the Console/Deployment add the path for the new plan.xml.
Place all the configuration files under the directory
%config-root%\AppFileOverrides folder, this is a reserved weblogic folder name which is used to load configuration files
No comments:
Post a Comment