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

NullPointer Exception when getting current session

SOLVED
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
Highlighted

Re: NullPointer Exception when getting current session

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
Highlighted

Re: NullPointer Exception when getting current session

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

Highlighted

Re: NullPointer Exception when getting current session

session = pfcGlobal.GetProESession();

Announcements
Message from Brian Thompson (PTC General Manager and DVP) regarding Creo Business Continuity plans.