Showing results for 
Search instead for 
Do you mean 
Reply

Java remote application

[ Edited ]

Hi,

 I wrote a remote java application based on the sample NXOpen application.

The application starts a TeamCenter session, opens NX part and updates drawings, then it saves the part, and terminate the session.

The problem is that it works fine only once...

The second atempt results in a java.rmi.UnmarshalException: Error unmarshaling return header

When I tested it against a Linux server the Error message was: nxopen.NXException: internal error

at nxopen.uf.UFUgmgr_impl.initialize(Native Method)

If the session is not terminated in the application, it works fine but you get a seesion that is opend all the time with the same user account.

I'll be glad to get any suggesstions...

 

Moti Eitan
10 REPLIES

Re: Java remote application

in NXRemoteServerImpl.java in method getUnloadOption replace BaseSession.LibraryUnloadOption.EXPLICITLY with BaseSession.LibraryUnloadOption.IMMEDIATELY

 

e.g:

 

public static int getUnloadOption()
    {
        return  BaseSession.LibraryUnloadOption.IMMEDIATELY;
    }

 

Re: Java remote application

Thanks for the reply, but - sorry it didn't work for me...

I'm getting the same messages.

Moti Eitan

Re: Java remote application

Moti Eitan

I am facing the same problem. Did you find any solution for this?

Thanks

Anshu

 

Re: Java remote application


Hello AnshuD

 Sorry couldn't find any solution yet.

Moti Eitan

Re: Java remote application

 

Are you trying to initialize from the client program that is running externally?

 

If so, you can only successfully initialize one time.  Once you terminate, there is no way to initialize again.  This is documented in the Open C Reference Guide, and I am not sure offhand whether we also mention it in any of the Programmer's Guides, but if we don't we probably should.

 

 

 

Re: Java remote application

Hello SteveLabout,

 Yes, I'm trying to initialize from the client program that is running externally.

The Idea is to let users use the Linux server's memory and cpu resources. I understand that it will not work this way...

So the only way is to use the remote application as a kind of a rsh command that will run the application on the server using java ProcessBuilder Class. Is that correct?

Moti Eitan

Re: Java remote application

Moti,

 

I'm afraid I don't have enough of a picture of what you are trying to do to answer that with confidence.  I'm always a little hesitant to say that there is only one way to do something in NX.

 

Regards,

 

Steve

Re: Java remote application

[ Edited ]

Steve

Let me explain you what we are trying to do:

 

I have a RMI NX server running and I am connecting a RMI client to that. To work with NX in managed mode, I am using "theUfSession.ugmgr().initialize(args.length, args)". When client is done with all operation like query, creation etc with a NX part, I am finally disconnecting the NX from TC using "theUfSession.ugmgr().terminate()". Problem is using this terminate method because once I am disconnecting the NX TC connection and trying to again connect using "theUfSession.ugmgr().initialize", it gives error: "java.rmi.UnmarshalException: Error unmarshaling return header; nested exception is: java.net.SocketException: Connection reset".

 

 I see that RMI client is able to find the server and connect it but once it reached at theUfSession.ugmgr().initialize it throws above exception. So using disconnect method I am able to connect NX and TC only one time. If I want to run again, I have to restart the RMI server.

 

Interestingly If I donot disconnect, things work fine i.e I can connect NX and TC many times.

 

Further I verified one more thing: If I donot use RMI NX Server and use "theUfSession.ugmgr().terminate()", I can run program as many as times I want.

 

Also document for  ugmgr().terminate says: "Obsolete from v12.0: just call UF_terminate" but for UF_terminate document says: "Once UF_terminate
is called in an external Open C API program, the program will
exit. You will not be able to call UF_initialize again and continue
operation.". Moreover there is no wrapper function in theUFSession.UF() for UF_Terminate in java.

Re: Java remote application

 

Hi Anshu,

 

Once you call UF_UGMGR_terminate() - or the wrapper for it - it calls UF_terminate(), so that is why you are seeing the behavior that you described.

 

Regards,

 

Steve