TM1 java api error

Product:

IBM Cognos TM1 10.2.2

PLANANALYTICS_Update_version=PLANANALYTICS-AW64-ML-RTM-10.2.5250.191-0

Windows 2012 R2 server

Symptom:

When try to run the test script to call a Java code from a TI process outlined here

http://www.ibm.com/support/knowledgecenter/en/SS9RXT_10.3.0

/com.ibm.swg.ba.cognos.tm1_turb.10.3.0.doc/t_ti_configure_eclipse_java_ee_ide.html

get an error in the TI process.

Error message:

Error:
Prolog procedure line (11): Errors occurred during execution of process "my.scripts.MyTestTI".

Check error log file for that process for more details

…java.lang.ClassNotFoundException…




Solution:

Check the tm1serverlog file for text like this:

2472  []   INFO   2016-07-25 13:30:30.643   TM1.Process  
[com.ibm.cognos.tm1.jos.extensions.ExtensionManager] - Insert new extension:
C:\Program Files\ibm\cognos\tm1_64\bin64\javaextensions\user\myextension.jar

2472  []   ERROR   2016-07-25 13:30:31.018   TM1.Process  
[com.ibm.cognos.tm1.jos.extensions.JarFileExtensionRecord] -Extension has
invalid extension.xml: C:\Program Files\ibm\cognos\tm1_64\bin64\javaextensions\user\myextension.jar

org.xml.sax.SAXParseException: Premature end of file.

	at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)

	at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)

	at javax.xml.parsers.DocumentBuilder.parse(Unknown Source)

	at com.ibm.cognos.tm1.jos.extensions.ExtensionXml.parseFromXML(ExtensionXml.java:86)

	at com.ibm.cognos.tm1.jos.extensions.JarFileExtensionRecord.load(JarFileExtensionRecord.java:83)

	at com.ibm.cognos.tm1.jos.extensions.ExtensionManager.insertExtension(ExtensionManager.java:96)

	at com.ibm.cognos.tm1.jos.extensions.LocalJarRepository.scan(LocalJarRepository.java:72)

 	at com.ibm.cognos.tm1.jos.extensions.ExtensionManager.addRepository(ExtensionManager.java:51)

	at com.ibm.cognos.tm1.jos.Main.addLocalRepository(Main.java:156)

	at com.ibm.cognos.tm1.jos.Main.main(Main.java:127)

This mean that the jar file is corrupt.

Stop your TM1 application and then from the JAVA IDE recompile the file with ANT.

This is done by save the project after a small change.

Remember to stop the TM1 application service before any change to the jar file.

It is good to only have the jar file in one folder, in the example it should be in folder for your Tm1 application, can be like this:

C:\Tm1apps\Tm1Beginner\data\}javaextensions\user

More information:

https://www.ibm.com/developerworks/community/forums/html/forum?id=9cd3aebf-c4bb-4059-91f1-9f0925b6b959&ps=25#topicsPg=1