cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

NullPointer Exception when getting current session

abasRyan
4-Participant

NullPointer Exception when getting current session

Hello, I have been demoing the otk java examples and decided to create my own project.
My custom action listener class is working fine within the otkexamples project.

Now that I created my own project, I am having issues in my main class. I practically copied and pasted the structure of otkExamplesmain.java but removed all the example methods.

The exception is throwing when trying to get the current session on launch when setting up the ribbon commands. I must have missed something when setting up my project but cannot figure out what that is.

Exception caught: java.lang.NullPointerException
com.ptc.cipjava.CIPRemoteApp.getTransport(CIPRemoteApp.java:40)

 private void SetupRibbonCommands()
{
try
{
System.out.println("Get Session");
session = pfcSession.GetCurrentSession();
wSession = (WSession)session;

wSession.RibbonDefinitionfileLoad(ribbonFile);

//startCreoson();
addAbasCommands();

}
1 ACCEPTED SOLUTION

Accepted Solutions
abasRyan
4-Participant
(To:abasRyan)

After playing around, and comparing the contents of each jar, there was something off in my artifacts settings. I noticed it was packaging the external otk libraries in with the jar, I'm not sure why. It's runnning correctly now that the otk library is not packaged in the jar. I'm not sure what the main issues were in intellij and if someone could comment on that it would be great.


Library settings.
Artifact settings
etc

View solution in original post

2 REPLIES 2
abasRyan
4-Participant
(To:abasRyan)

After playing around, and comparing the contents of each jar, there was something off in my artifacts settings. I noticed it was packaging the external otk libraries in with the jar, I'm not sure why. It's runnning correctly now that the otk library is not packaged in the jar. I'm not sure what the main issues were in intellij and if someone could comment on that it would be great.


Library settings.
Artifact settings
etc

sjuraj
13-Aquamarine
(To:abasRyan)

session = pfcGlobal.GetProESession();

Top Tags