在ODI中的PreparedStatement上使用setObject()时抛出异常

时间:2014-01-02 09:05:24

标签: java oracle-data-integrator

我在ODI java.lang.IllegalAccessException上使用setObject()时会抛出{p> PreparedStatement

我在开发什么:在ODI(11.1.1)中编写知识模块,将数据从其他源加载到Oracle表。 代码在eclipse中运行时工作正常。但在ODI中运行时会出现以下错误。

- >从其他站点获取输入,我尝试用更新的版本11.2.0.2替换ucp.jar README.txt声明此版本解决了IllegalAccessException的已知错误, 但是在ODI中执行时我仍然面临同样的错误。

Error in method invocation: Cannot access method setObject( int, java.lang.Object ) in 'class oracle.jdbc.driver.OraclePreparedStatementWrapper' :java.lang.IllegalAccessException: Class bsh.Reflect can not access a member of class oracle.jdbc.driver.OraclePreparedStatementWrapper with modifiers "public" : at Line: 433 : in file: inline evaluation of: `` //********Start of OdiSfdcLogger class************** import java.io.File; impor . . . '' : pStatement .setObject ( i + 1 ,( ( Map ) iNotifications .get ( 0 ) ) .get ( sfdcColums .get ( i ) ) ) 
at bsh.BSHMethodInvocation.eval(Unknown Source)
at bsh.BSHPrimaryExpression.eval(Unknown Source)
at bsh.BSHPrimaryExpression.eval(Unknown Source)
at bsh.BSHBlock.evalBlock(Unknown Source)
at bsh.BSHBlock.eval(Unknown Source)
at bsh.BSHBlock.eval(Unknown Source)
at bsh.BSHForStatement.eval(Unknown Source)
at bsh.BSHSwitchStatement.eval(Unknown Source)
at bsh.BSHBlock.evalBlock(Unknown Source)
at bsh.BSHBlock.eval(Unknown Source)
at bsh.BshMethod.invokeImpl(Unknown Source)
at bsh.BshMethod.invoke(Unknown Source)
at bsh.BshMethod.invoke(Unknown Source)
at bsh.This.invokeMethod(Unknown Source)
at com.streaming.ck.ConnectOracle.renderData(BeanShell Generated via ASM (www.objectweb.org))
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at bsh.Reflect.invokeOnMethod(Unknown Source)
at bsh.Reflect.invokeObjectMethod(Unknown Source)
at bsh.Name.invokeMethod(Unknown Source)
at bsh.BSHMethodInvocation.eval(Unknown Source)
at bsh.BSHPrimaryExpression.eval(Unknown Source)
at bsh.BSHPrimaryExpression.eval(Unknown Source)
at bsh.BSHBlock.evalBlock(Unknown Source)
at bsh.BSHBlock.eval(Unknown Source)
at bsh.BSHBlock.eval(Unknown Source)
at bsh.BSHWhileStatement.eval(Unknown Source)
at bsh.BSHBlock.evalBlock(Unknown Source)
at bsh.BSHBlock.eval(Unknown Source)
at bsh.BSHBlock.eval(Unknown Source)
at bsh.BSHTryStatement.eval(Unknown Source)
at bsh.Interpreter.eval(Unknown Source)
at bsh.Interpreter.eval(Unknown Source)
at bsh.Interpreter.eval(Unknown Source)
at bsh.util.BeanShellBSFEngine.eval(Unknown Source)
at bsh.util.BeanShellBSFEngine.exec(Unknown Source)
at com.sunopsis.dwg.codeinterpretor.SnpScriptingInterpretor.execInBSFEngine(SnpScriptingInterpretor.java:322)
at com.sunopsis.dwg.codeinterpretor.SnpScriptingInterpretor.exec(SnpScriptingInterpretor.java:170)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.scripting(SnpSessTaskSql.java:2472)
at oracle.odi.runtime.agent.execution.cmd.ScriptingExecutor.execute(ScriptingExecutor.java:47)
at oracle.odi.runtime.agent.execution.cmd.ScriptingExecutor.execute(ScriptingExecutor.java:1)
at oracle.odi.runtime.agent.execution.TaskExecutionHandler.handleTask(TaskExecutionHandler.java:50)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.processTask(SnpSessTaskSql.java:2913)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2625)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:577)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:468)
at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:2128)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$2.doAction(StartSessRequestProcessor.java:366)
at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:216)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:300)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$0(StartSessRequestProcessor.java:292)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$StartSessTask.doExecute(StartSessRequestProcessor.java:855)
at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:126)
at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$2.run(DefaultAgentTaskExecutor.java:82)
at java.lang.Thread.run(Thread.java:662)

有什么建议吗?

PreparedStatement的代码:

public void renderData(ArrayList notifications, ArrayList sfdcColumnsList, String         oracleColumnsString, String tableName) 
        throws Exception {

    PreparedStatement pStatement = null;
    String eventType = (String)((Map) notifications.get(0)).get("eventType");
    String sql= null;

    switch (typeOfEvent(eventType)) {
    case CREATE:System.out.println("In Created case ---------->");

        sql = "INSERT INTO "+ tableName + "(" +oracleColumnsString+")" + " VALUES (";

            for(int i =0;i<sfdcColumnsList.size()-1;i++){
                sql = sql+"?,";
            }
            sql = sql + "?)";
            System.out.println("SQL QUERY ::::::: "+sql);

            pStatement =  conn.prepareStatement(sql);

            for(int i=0;i<sfdcColumnsList.size();i++){
                String sdfcData =(String) ((Map) notifications.get(0)).get(sfdcColumnsList.get(i));
                System.out.println("Check data :::::: " +sdfcData);
            pStatement.setObject(i+1,((Map)notifications.get(0)).get(sfdcColumnsList.get(i));
                    }

        break;

        //Rest of the cases : 
        }

        try {
        pStatement.setEscapeProcessing(true);
        boolean checkDataconn = pStatement.execute();
        System.out.println("Inserted/updated/deleted record : "+checkDataconn);

    } catch (SQLException e) {
        e.printStackTrace();
    }

0 个答案:

没有答案