Jboss7.1.1发布的web项目数据库类型转换失败,求帮助

我喜欢吃包子 2017-01-17 01:56:01
最近公司要将jboss4.2升级到jboss7.1.1,现在其他问题都解决,系统正常启动,功能正常使用,但是有一个功能人员清单导入,这个是调用数据库pkg,pkg的入参包含了数据库数组,java在获取数据库原始连接,并将arrayList类型转换为oracle数据库数组类型时就报错了。具体代码和报错内容如下,请高手帮忙解决。ps:这个数据类型转换在jboss4和tomcat下都是正常使用的。
代码如下:
sql.xml中的语句:
<!-- 保存被保人临时信息 参数映射 -->
<parameterMap id="callProcedureSaveTempMap" class="java.util.Map">
<parameter property="prtNo" javaType="java.lang.String" jdbcType="VARCHAR" mode="IN" />
<parameter property="user" javaType="java.lang.String" jdbcType="VARCHAR" mode="IN" />
<parameter property="sourceModule" javaType="java.lang.String" jdbcType="VARCHAR" mode="IN" />
<parameter property="masterContNo" javaType="java.lang.String" jdbcType="VARCHAR" mode="IN" />
<parameter property="mode" javaType="java.lang.String" jdbcType="VARCHAR" mode="IN" />
<parameter property="insuredTempList" javaType="java.util.List" jdbcType="ARRAY" mode="IN" typeName="TYPE_IM_INSURED_TEMP_ARRAY" typeHandler="com.sunshine.cis.common.typehandler.InsuredTempArrayHandler" />
<parameter property="dutyTempList" javaType="java.util.List" jdbcType="ARRAY" mode="IN" typeName="TYPE_IM_DUTY_TEMP_ARRAY" typeHandler="com.sunshine.cis.common.typehandler.DutyTempArrayHandler" />
<parameter property="bnfTempList" javaType="java.util.List" jdbcType="ARRAY" mode="IN" typeName="TYPE_IM_BNF_TEMP_ARRAY" typeHandler="com.sunshine.cis.common.typehandler.BnfTempArrayHandler" />
<parameter property="batchNo" javaType="java.lang.Integer" jdbcType="INTEGER" mode="OUT" />
<parameter property="resultCode" javaType="java.lang.String" jdbcType="VARCHAR" mode="OUT" />
<parameter property="message" javaType="java.lang.String" jdbcType="CLOB" mode="OUT" />
</parameterMap>

<!-- 保存被保人临时信息 -->
<procedure id="callProcedureSaveTemp" parameterMap="callProcedureSaveTempMap">
{call pkg_cis_insured_manage.p_save_insured(?,?,?,?,?,?,?,?,?,?,?)}
</procedure>

java代码数据类型转换:
public void setParameter(PreparedStatement ps, int i, Object parameter, String jdbcType) throws SQLException {
// 获取原始连接
System.out.println("开始获取数据库连接池原始链接==============");
Connection conn = ConnectionUtil.getNativeConnection(ps.getConnection());
System.out.println("获取数据库连接池原始链接==============:"+conn);
@SuppressWarnings("unchecked")
List<InsuredTempVO> insuredTempList = (List<InsuredTempVO>) parameter;
System.out.println("开始转换被保人数组,讲list转换为oracle数组=======");
ARRAY insuredTempArray = getInsuredTempArray(conn, insuredTempList);
System.out.println("转换被保人数组,讲list转换为oracle数组=======:"+insuredTempArray.length());
ps.setArray(i, insuredTempArray);

}

private ARRAY getInsuredTempArray(Connection con, List<InsuredTempVO> insuredTempList) throws SQLException {
ARRAY insuredTempArray = null;
System.out.println("================1=============:"+insuredTempList.size());
if (insuredTempList != null && insuredTempList.size() > 0) {
System.out.println("==================2===============");
StructDescriptor structdesc = new StructDescriptor(TYPE_IM_INSURED_TEMP, con);
System.out.println("==================3===============");
STRUCT[] structs = new STRUCT[insuredTempList.size()];
System.out.println("==================4===============");
ArrayDescriptor desc = ArrayDescriptor.createDescriptor(TYPE_IM_INSURED_TEMP_ARRAY, con);
System.out.println("==================5===============");
Object[] result = new Object[4];
InsuredTempVO insuredTempVO = null;
for (int i = 0; i < insuredTempList.size(); i++) {
insuredTempVO = insuredTempList.get(i);
result[0] = insuredTempVO.getSerialNo();
result[1] = insuredTempVO.getPrtNo();
result[2] = insuredTempVO.getBatchNo();
result[3] = insuredTempVO.getProposalContNo();
STRUCT item = new STRUCT(structdesc, con, result);
structs[i] = item;
}
insuredTempArray = new ARRAY(desc, con, structs);
} else {
ArrayDescriptor desc = ArrayDescriptor.createDescriptor(TYPE_IM_INSURED_TEMP_ARRAY, con);
STRUCT[] structs = new STRUCT[0];
insuredTempArray = new ARRAY(desc, con, structs);
}
System.out.println("==================6===============:"+insuredTempArray.length());
return insuredTempArray;
}

在把项目发布到jboss7上后,老是在这里就报错了:
StructDescriptor structdesc = new StructDescriptor(TYPE_IM_INSURED_TEMP, con);

错误信息:
13:53:29,879 INFO [com.sunshine.cis.insuredmanagement.service.impl.InsuredManageServiceImpl] (http--0.0.0.0-8888-5) [1484632407160] user=cis 1002201612301218调用存储过程保存被保人临时信息。
13:53:29,989 INFO [stdout] (http--0.0.0.0-8888-5) 开始获取数据库连接池原始链接============== 13:53:30,090 INFO [stdout] (http--0.0.0.0-8888-5) 获取数据库连接池原始链接==============:oracle.jdbc.driver.T4CConnection@1981115 13:53:30,173 INFO [stdout] (http--0.0.0.0-8888-5) 开始转换被保人数组,讲list转换为oracle数组======= 13:53:30,233 INFO [stdout] (http--0.0.0.0-8888-5) ================1=============:5 13:53:30,282 INFO [stdout] (http--0.0.0.0-8888-5) ==================2=============== 13:53:30,395 INFO [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] (http--0.0.0.0-8888-5) Loading XML bean definitions from class path resource [org/springframework/jdbc/support/sql-error-codes.xml]
13:53:30,552 INFO [org.springframework.jdbc.support.SQLErrorCodesFactory] (http--0.0.0.0-8888-5) SQLErrorCodes loaded: [DB2, Derby, H2, HSQL, Informix, MS-SQL, MySQL, Oracle, PostgreSQL, Sybase]
13:53:30,666 ERROR [com.sunshine.cis.insuredmanagement.service.impl.InsuredManageServiceImpl] (http--0.0.0.0-8888-5) [1484632407160] user=cis 1002201612301218保存被保人信息异常!org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null]; error code [0];
--- The error occurred in /com/sunshine/cis/insuredmanagement/xml/sql/sql-map-insuredmanagement.xml.
--- The error occurred while applying a parameter map.
--- Check the insuredmanagement.callProcedureSaveTempMap.
--- Check the parameter mapping for the 'insuredTempList' property.
--- Cause: java.lang.ClassCastException: oracle.jdbc.driver.T4CConnection cannot be cast to oracle.jdbc.OracleConnection; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in /com/sunshine/cis/insuredmanagement/xml/sql/sql-map-insuredmanagement.xml.
--- The error occurred while applying a parameter map.
--- Check the insuredmanagement.callProcedureSaveTempMap.
--- Check the parameter mapping for the 'insuredTempList' property.
--- Cause: java.lang.ClassCastException: oracle.jdbc.driver.T4CConnection cannot be cast to oracle.jdbc.OracleConnection
13:53:31,341 INFO [com.sunshine.cis.insuredmanagement.service.impl.InsuredManageServiceImpl] (http--0.0.0.0-8888-5) [1484632407160]execute SERVICE complatelly, quit [com.sunshine.cis.insuredmanagement.service.impl.InsuredManageServiceImpl.uploadFileTx]
13:53:31,478 ERROR [com.sunshine.cis.insuredmanagement.web.InsuredManageAction] (http--0.0.0.0-8888-5) [1484632407160] user=cis 文件上传异常,1002201612301218保存被保人信息异常!org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null]; error code [0];
--- The error occurred in /com/sunshine/cis/insuredmanagement/xml/sql/sql-map-insuredmanagement.xml.
--- The error occurred while applying a parameter map.
--- Check the insuredmanagement.callProcedureSaveTempMap.
--- Check the parameter mapping for the 'insuredTempList' property.
--- Cause: java.lang.ClassCastException: oracle.jdbc.driver.T4CConnection cannot be cast to oracle.jdbc.OracleConnection; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in /com/sunshine/cis/insuredmanagement/xml/sql/sql-map-insuredmanagement.xml.
--- The error occurred while applying a parameter map.
--- Check the insuredmanagement.callProcedureSaveTempMap.
--- Check the parameter mapping for the 'insuredTempList' property.
--- Cause: java.lang.ClassCastException: oracle.jdbc.driver.T4CConnection cannot be cast to oracle.jdbc.OracleConnection


求大神支招解决办法,困扰几天了
...全文
1337 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
我喜欢吃包子 2017-01-22
  • 打赏
  • 举报
回复
没人吗
我喜欢吃包子 2017-01-19
  • 打赏
  • 举报
回复
有人遇到过类似的问题的吗,求助呀!!!!!!!!!!!!!!!!!!!!!!!!!!!
我喜欢吃包子 2017-01-17
  • 打赏
  • 举报
回复
补充一下这个list集合是个对象集合,如果是字符是可以转换成数据库数组,不报错的。

6,787

社区成员

发帖
与我相关
我的任务
社区描述
JBoss技术交流
社区管理员
  • JBoss技术交流社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧