在CallableStatement上调用registerOutputParamater时出现NullPointerException

时间:2013-09-16 13:07:07

标签: java mysql jdbc ejb weblogic

在我的应用程序中,我使用名为SearchSubscriptionData的存储过程来查找两个不同订阅表中的数字。

通过WebLogic 10.3.3上的JDBC配置(MySQL驱动程序)访问数据库。我只使用一个用户(root,没有密码)。

我使用的代码段是:

Connection con = getConnection(); // perform lookup on JDBC Driver
CallableStatement cst = con.prepareCall("{CALL SearchSubscriptionData(?,?,?,?,?,?,?)}");
cst.setString("numTel", aBnumber); // input param (B-Number)
cst.registerOutParameter("numberFoundFlag", Types.INTEGER); 
cst.registerOutParameter("radixFound", Types.VARCHAR); // <-- this instruction generates a NullPointerException
cst.registerOutParameter("outRoutingId", Types.VARCHAR);
...// plus three more parameters, not important now

例外是:

[#|2013-09-16T14:35:51.340+0200|SEVERE|ece|com.ericsson.core.db.DBManager|_ThreadID=451;_ThreadName=[ACTIVE] ExecuteThread: '19' for queue: 'weblogic.kernel.Default(self-tuning)';ClassName=com.ericsson.core.db.DBManager;MethodName=searchSubscriptionData;_RequestID=<unavailable>|Exception: java.lang.NullPointerException
    at com.mysql.jdbc.CallableStatement.getNamedParamIndex(CallableStatement.java:1250)
    at com.mysql.jdbc.CallableStatement.registerOutParameter(CallableStatement.java:1668)
    at weblogic.jdbc.wrapper.CallableStatement_com_mysql_jdbc_CallableStatement.registerOutParameter(Unknown Source)    
    at com.ericsson.core.db.DBManager.searchSubscriptionData(DBManager.java:139)
    at com.ericsson.jee.ngin.services.screening.service.Screening.getSubscriptionDataWithStoreProcedure(Screening.java:2481)
    at com.ericsson.jee.ngin.services.screening.service.Screening.onInitialDP(Screening.java:1463)
    at com.ericsson.jee.ngin.services.screening.service.Screening.handleMessage(Screening.java:384)
    at com.ericsson.cba.cs1plus.traffic.impl.CallSession.dispatchEvent(CallSession.java:1303)
    at com.ericsson.cba.cs1plus.traffic.impl.CallSession.doInitialDpEvent(CallSession.java:537)
    at com.ericsson.cba.cs1plus.traffic.impl.CallSession.doHandleNetworkEvent(CallSession.java:331)
    at com.ericsson.cba.cs1plus.traffic.impl.CallSession.handleMessage(CallSession.java:234)
    at com.ericsson.jee.ngin.services.screening.service.Screening.handleEvent(Screening.java:327)
    at com.ericsson.jee.ngin.services.screening.service.Screening.onCreate(Screening.java:236)
    at com.ericsson.ngin.session.mdb.DefaultServiceMDB.onCreate(DefaultServiceMDB.java:56)
    at sun.reflect.GeneratedMethodAccessor677.invoke(Unknown Source) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
[...more stack trace here...]

有人看到这里熟悉的东西吗?重要的是要强调,如果从MySQL DB中删除存储过程,则会发生相同的错误,例如错误是存储过程本身的访问错误:但是哪种错误?

对我来说真正奇怪的是NullPointerException适用于&#34;第二&#34; registerOutParameter已拨打电话,而不是第一个电话。

有什么建议吗?

0 个答案:

没有答案