Migrating J2EE Applications from OC4J to Weblogic Part -3
Please refer to Previous post for the earlier steps. Lets move on with the migration.
JAX-RPC Web-services upgrade
- Regenerate the webservice from WSDL in a new JDeveloper Project.
- Copy the weblogic-webservices.xml to the WEB-INF.
- Remove oracle-webservices.xml from the project.
- Regenerate the webservice client proxy in JDeveloper and replace the existing one.
JSP Related Issues
Error Directive Issue
All the error pages had issues when any run-time exception were happening. Instead of the proper messages a blank page was displayed.
Root Cause
The existing Error page jsp includes a import of tag-libs-defs.jsp that has an attribute
errorPage="/WEB-INF/jsp/common/Error.jsp" defined in the page directive. This seems to be incompatible in Weblogic but worked fine in OC4J
Existing Error.jsp code Snippet
<%@ page isErrorPage="true" import="org.apache.commons.logging.*"%>
<%@ include file="/WEB-INF/jsp/common/tag-libs-defs.jsp"%>
Existing tag-libs-defs.jsp code snippet
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8" errorPage="/WEB-INF/jsp/common/Error.jsp"%>
Solution
A new jsp similar to tag-libs-defs.jsp was created but with the difference that the errorPage attribute was not defined in the page directive of this jsp. This new JSP was then included in the Error.jsp.
The new JSP Code snippet
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8" %>
Stored Procedure Calls
All the stored procedure calls which return Oracle Array Type had issues. We are using oracle.sql.ARRAY type in all our DAO methods. This was giving ClassCastException in the Oracle.sql.ARRAY's constructor.
Root Cause
After probing further we identified that, the ARRAY class internally trying to explicitly cast a Connection to oracle.jdbc.Connection. But this Connection is the weblogic wrapper on the the underlying oracle.jdbc.Connection.
This is the exception log
java.lang.ClassCastException: weblogic.jdbc.wrapper.PoolConnection_weblogic_jdbc_oracle_OracleConnection to oracle.jdbc.OracleConnection”
This error can be resolved by adding ojdbc6.jar dependency and removing the ojdbc14.jar.
The pooled connection instance returned from the datasource is an instance of type weblogic.jdbc.extensions.WLConnection, which wraps the Oracle thin driver connection of type oracle.jdbc.OracleConnection. This wrapped connection can be retrieved using weblogic.jdbc.extensions.WLConnection.getVendorConnection(). The following code should be used to retrieve OracleConnection needed by the ARRAY class.
Find the code snippet
oracle.sql.ARRAY: oracle.jdbc.OracleConnection connection = (oracle.jdbc.OracleConnection) ((WLConnection) conn).getVendorConnection();
ARRAY oracleArray = new ARRAY(ArrayDescriptor.createDescriptor( TYP_NUMBER, connection), connection, statusArr);
This resolution is Weblogic specific and non-portable to any other application server environment.
No comments:
Post a Comment