Skip to main content
1-Visitor
April 20, 2020
Solved

cann't cast WSession

  • April 20, 2020
  • 1 reply
  • 2860 views

dear All,

 

why i cannt cast WSession from Session?

 

class CommandConvertTolerances extends DefaultUICommandActionListener {
	public void OnCommand() {

		try {

			WSession session = (WSession) pfcSession.GetCurrentSession ();
			
//			WSession wSession = null;	
//						
//			if (wSession instanceof WSession)
//				wSession = (WSession)session;

			Model model = session.GetCurrentModel();
//			WModel wm = (WModel)model;

 

java.lang.ClassCastException: com.ptc.wfc.Implementation.pfcSession$Session cannot be cast to com.ptc.wfc.wfcSession.WSession

 

Thanks!

Robert

 

Best answer by Robert_K_299164

I have changed in registry protk.dat two lines to:

 

startup otk_java
toolkit object

1 reply

15-Moonstone
April 21, 2020

wfcWSession_ptr wsession = wfcWsession::cast(pfcGetProESession());

 

They use their own Smart Pointer implementation.

 

Br,

Eike

1-Visitor
April 21, 2020

WSession.PNGHow i can access this Type (Pointer description)
Thank you very much!

15-Moonstone
April 21, 2020

Oh I'm sorry haven't done it in Java right now.

 

AFAIK it should be in the licensed OJava path. So you should need a Java OTK License for this (but I could be wrong / not sure about this ...).

 

Br,

Eike