Java TM1 API : need help

Post Reply
djuste
Posts: 10
Joined: Mon Sep 17, 2018 2:12 pm
OLAP Product: Don't know...
Version: 11.0.6
Excel Version: 2013

Java TM1 API : need help

Post 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... :)
bgregs
Posts: 77
Joined: Wed Sep 12, 2018 11:19 am
OLAP Product: TM1 / Planning Analytics
Version: 2.0
Excel Version: 2016

Re: Java TM1 API : need help

Post 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
User avatar
paulsimon
MVP
Posts: 808
Joined: Sat Sep 03, 2011 11:10 pm
OLAP Product: TM1
Version: PA 2.0.5
Excel Version: 2016
Contact:

Re: Java TM1 API : need help

Post 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
User avatar
macsir
MVP
Posts: 782
Joined: Wed May 30, 2012 6:50 am
OLAP Product: TM1
Version: PAL 2.0.9
Excel Version: Office 365
Contact:

Re: Java TM1 API : need help

Post 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.
In TM1,the answer is always yes though sometimes with a but....
http://tm1sir.blogspot.com.au/
djuste
Posts: 10
Joined: Mon Sep 17, 2018 2:12 pm
OLAP Product: Don't know...
Version: 11.0.6
Excel Version: 2013

Re: Java TM1 API : need help

Post 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 !
User avatar
Alan Kirk
Site Admin
Posts: 6606
Joined: Sun May 11, 2008 2:30 am
OLAP Product: TM1
Version: PA2.0.9.18 Classic NO PAW!
Excel Version: 2013 and Office 365
Location: Sydney, Australia
Contact:

Re: Java TM1 API : need help

Post 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.
"To them, equipment failure is terrifying. To me, it’s 'Tuesday.' "
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
bgregs
Posts: 77
Joined: Wed Sep 12, 2018 11:19 am
OLAP Product: TM1 / Planning Analytics
Version: 2.0
Excel Version: 2016

Re: Java TM1 API : need help

Post 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 ;)
djuste
Posts: 10
Joined: Mon Sep 17, 2018 2:12 pm
OLAP Product: Don't know...
Version: 11.0.6
Excel Version: 2013

Re: Java TM1 API : need help

Post 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.
Post Reply