Page 1 of 1

Java TM1 API : need help

Posted: Thu Sep 20, 2018 3:30 pm
by djuste
Hello,

I would like building a Java prototype, I aim sending MDX requests to data cubes.

I just joined this new project, I had never worked on Planning Analytics TM1 before. I installed PA on my computer, I reach SData server by using Architect. It perfectly works.

Look at tm1s.cfg :
[TM1S]
ServerLogging=F
SecurityPackageName=Kerberos
IntegratedSecurityMode=2
UseSSL=F
ServerName=SData
DataBaseDirectory=.
AdminHost=
PortNumber=12346
ClientMessagePortNumber=12398
Savetime=
Downtime=
LicenseMetricTime=
ProgressMessage=True
AuditLogOn=F
AuditLogMaxFileSize= 100 MB
AuditLogUpdateInterval=60
PersistentFeeders=F
ParallelInteraction=T
IPVersion=ipv4
ServerCAMIPVersion=ipv4
AllowSeparateNandCRules=T
ForceReevaluationOfFeedersForFedCellsOnDataChange=T
EnableNewHierarchyCreation=T
HTTPPortNumber=8010
EnableTIDebugging=T

Then I try accessing cubes, but I fail. Here's my sample Java code :

import com.applix.tm1.TM1Bean;
import com.applix.tm1.TM1Server;

public class TM1Try {

public static void main(String[] args) {
//String adminHostName = "VVD-TM1ANA.solano.alize";
String adminHostName = "localhost";
String serverName = "SData";
String userName = "admin";
String password = "apple";
TM1Bean aBean = new TM1Bean();
TM1Bean.setDebugMode(true);
aBean.setAdminHost(adminHostName);
TM1Server aServer = null;
try {
aServer = aBean.openConnection1001(serverName, userName, password);
System.out.println("Connected to: " + aServer.getName().getString());
} catch (Exception e) {
System.out.println("Could not connect to the server! : " + aServer.getErrorMessage() + " : Error Code: " + aServer.getErrorCode());
}
}
}

WHen executing, an exception occures :

TM1 Error-> Error creating socket - java.net.ConnectException: Connection refused: connect
java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:673)
at sun.security.ssl.SSLSocketImpl.<init>(SSLSocketImpl.java:432)
at sun.security.ssl.SSLSocketFactoryImpl.createSocket(SSLSocketFactoryImpl.java:88)
at com.applix.tm1.TM1NetClass.ConnectToHost(TM1NetClass.java:264)
at com.applix.tm1.TM1NetClass.ConnectUsingIPv6(TM1NetClass.java:213)
at com.applix.tm1.TM1NetClass.Connect(TM1NetClass.java:179)
at com.applix.tm1.TM1Bean.getAdmEntryList(TM1Bean.java:544)
at com.applix.tm1.TM1Bean.getNumberOfServers(TM1Bean.java:374)
at com.applix.tm1.TM1Bean.findEntryByServerName(TM1Bean.java:634)
at com.applix.tm1.TM1Bean.openConnection1001(TM1Bean.java:311)
at ca_essai2.TM1Try.main(TM1Try.java:22)
Exception in thread "main" java.lang.NullPointerException
at ca_essai2.TM1Try.main(TM1Try.java:25)

I don't understand what's happening. Did I forget setting a port ? Everything else ?

Hence I'm looking for some help and I thank anyone bringing me a hand.

Hope someone will answer soon. I'm stumped... :)

Re: Java TM1 API : need help

Posted: Thu Sep 20, 2018 3:39 pm
by bgregs
Probably better that I respond before an admin shuts it down ;) . Try looking on the forum first before submitting a question.

http://www.tm1forum.com/viewtopic.php?t=1981

Re: Java TM1 API : need help

Posted: Thu Sep 20, 2018 8:16 pm
by paulsimon
Hi

I would also suggest that you use the TM1 Rest API instead of the Java API. It is a much more modern API and the Java API never had that much take up, so you are unlikely to get much help with it

Paul Simon

Re: Java TM1 API : need help

Posted: Thu Sep 20, 2018 9:25 pm
by macsir
As I said before, rest api is the future. It can execute MDX as well and do more. Forget about all these old api.

Re: Java TM1 API : need help

Posted: Fri Sep 21, 2018 7:30 am
by djuste
Hello,

Thanks for your replies. So, I should leave Java API and use API REST instead.
bgregs wrote: Thu Sep 20, 2018 3:39 pm Probably better that I respond before an admin shuts it down ;) . Try looking on the forum first before submitting a question.
bgregs,

As I'm new on this forum, I looked into it and seached for informations... but I did not find. I'm probably not skilled :D Thanks for your tip.

Have a nice day !

Re: Java TM1 API : need help

Posted: Sat Sep 22, 2018 10:03 am
by Alan Kirk
bgregs wrote: Thu Sep 20, 2018 3:39 pm Probably better that I respond before an admin shuts it down ;) . Try looking on the forum first before submitting a question.

http://www.tm1forum.com/viewtopic.php?t=1981
You're confusing us with the jackbooted, mother's cellar-dwelling keyboard thugs that pass for moderators on Stack Overflow.

Here someone may get a terse reply if they don't do a bit of research first, but we don't shut down threads because of it.

Re: Java TM1 API : need help

Posted: Wed Sep 26, 2018 11:53 am
by bgregs
Thanks Alan! Glad to know I'm finally safe from the SO community! Yet another reason to embrace my transition from C to TM1 ;)

Re: Java TM1 API : need help

Posted: Wed Sep 26, 2018 7:06 pm
by djuste
Hello,

I finally changed to API REST, it looks better and more efficient. I discovered Postman, it helps a lot... but I have so much to learn. :D

I will let you know as soon as possible.