This discussion is archived
7 Replies Latest reply: Jan 10, 2013 1:27 AM by 982678 RSS

Undefined variable or classname snpRef (when executing Java within a KM)

982678 Newbie
Currently Being Moderated
Hi there,

I'm looking into ODI, specifically customizing scripts using java functions and have hit a bit of a problem.

Does the following error ring any bells?

Attempt to resolve method: getobjectname() on undefined variable or class name: snpref

I find it quite weird and strange that it cannot find snpref?

The script is below - as you can see, I'm just having a play around

drop table <%=odiRef.getTable("L", "COLL_NAME", "A")%>
+<%String sTestString = odiRef.getFrom(); %>+
+<%sTestString = sTestString.toLowerCase();%>+
+<%out.print("/*"+sTestString+"*/");%>+

As you can see, I have no clue where snpref is being called from. It may be an internal translation of odiRef but I thought snpRef has been deprecated!? What's also weird is that without the last or penultimate line, everything works fine?

For example, this works:

drop table <%=odiRef.getTable("L", "COLL_NAME", "A")%>
+<%String sTestString = odiRef.getFrom(); %>+
+<%out.print("/*"+sTestString+"*/");%>+

it gives:

drop table ODI_TESTING."C$_0SmalldatetimeTable"

+/*Testing.dbo.SmalldatetimeTable as SMALLDATETIMETABLE*/+

Also this works:

drop table <%=odiRef.getTable("L", "COLL_NAME", "A")%>
+<%String sTestString = "TeSt"; %>+
+<%sTestString = sTestString.toLowerCase(); %>+
+<%out.print("/*"+sTestString+"*/");%>+

outputting (as totally expected):

drop table ODI_TESTING."C$_0SmalldatetimeTable"


+/*test*/+

What gives? I know this is a bit theoretical but I'd really love to know what's causing it to break so spectacularly? Could it be some sort of misconfiguration?

Here's the stack trace:


com.sunopsis.tools.core.exception.SnpsSimpleMessageException: ODI-17517: Error during task interpretation.
Task: 4
java.lang.Exception: BeanShell script error: Sourced file: inline evaluation of: ``out.print("drop table ") ; out.print(snpRef.getObjectName("L", "%COL_PRF0Smallda . . . '' : Attempt to resolve method: getobjectname() on undefined variable or class name: snpref : at Line: 4 : in file: inline evaluation of: ``out.print("drop table ") ; out.print(snpRef.getObjectName("L", "%COL_PRF0Smallda . . . '' : snpref .getobjectname ( "l" , "smalldatetimetable" , "testing" , "" , "d" )
BSF info: Drop work table at line: 0 column: columnNo
+     at com.sunopsis.dwg.codeinterpretor.SnpCodeInterpretor.transform(SnpCodeInterpretor.java:485)+
+     at com.sunopsis.dwg.dbobj.SnpSessStep.createTaskLogs(SnpSessStep.java:711)+
+     at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:461)+
+     at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:2093)+
+     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)+
Caused by: org.apache.bsf.BSFException: BeanShell script error: Sourced file: inline evaluation of: ``out.print("drop table ") ; out.print(snpRef.getObjectName("L", "%COL_PRF0Smallda . . . '' : Attempt to resolve method: getobjectname() on undefined variable or class name: snpref : at Line: 4 : in file: inline evaluation of: ``out.print("drop table ") ; out.print(snpRef.getObjectName("L", "%COL_PRF0Smallda . . . '' : snpref .getobjectname ( "l" , "smalldatetimetable" , "testing" , "" , "d" )
BSF info: Drop work table at line: 0 column: columnNo
+     at bsh.util.BeanShellBSFEngine.eval(Unknown Source)+
+     at bsh.util.BeanShellBSFEngine.exec(Unknown Source)+
+     at com.sunopsis.dwg.codeinterpretor.SnpCodeInterpretor.transform(SnpCodeInterpretor.java:471)+
+     ... 11 more+

Text: drop table <?=snpRef.getObjectName("L", "%COL_PRF0SmalldatetimeTable", "W") ?>


+/*<?=snpref.getobjectname("l", "smalldatetimetable", "testing", "", "d")?> as smalldatetimetable*/.+
+     at com.sunopsis.dwg.dbobj.SnpSessStep.createTaskLogs(SnpSessStep.java:738)+
+     at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:461)+
+     at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:2093)+
+     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)+


Thanks!

Matt

Edited by: 979675 on Jan 9, 2013 1:04 AM

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points