Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
Hi,
I have written a utility class in windchill and trying to access the methods of that java class outside windchill application using the below code.
url=http://<xyz.com>/Windchill;
RemoteMethodServer remoteMethodServer = RemoteMethodServer.getInstance(url);
remoteMethodServer.setUserName(properties.getProperty(urladdress+".username"));
remoteMethodServer.setPassword(properties.getProperty(urladdress+".password"));
//accessing the method of a utility class which is in windchill codebase directory
remoteMethodServer.invoke("getICNDetails","ext.abb.util.CNPendingTasks", null,argTypes,argValues);
I am getting the below exception only in clustered environment .
wt.util.WTRemoteException: Unable to invoke remote method; nested exception is:
wt.util.WTRemoteException: Unable to locate method server; nested exception is:
wt.util.WTRemoteException: Unable to locate method server; nested exception is:
wt.util.WTRemoteException: Unable to get server; nested exception is:
wt.util.WTRemoteException: Unable to locate server manager; nested exception is:
java.rmi.ConnectException: Connection refused to host: <xyz.com>; nested exception is:
java.net.ConnectException: Connection refused: connect
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:619)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:216)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:202)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:342)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at wt.manager.RemoteServerManager.acquireServerManager(RemoteServerManager.java:590)
at wt.manager.RemoteServerManager.getServerManager(RemoteServerManager.java:564)
at wt.manager.RemoteServerManager.remoteInvoke(RemoteServerManager.java:500)
at wt.manager.RemoteServerManager.getServer(RemoteServerManager.java:281)
at wt.manager.RemoteServerManager.getServer(RemoteServerManager.java:265)
at wt.method.RemoteMethodServer.getMethodServer(RemoteMethodServer.java:1022)
at wt.method.RemoteMethodServer.invoke(RemoteMethodServer.java:620)
at ext.abb.dashboard.WindchillStatus.callRMI(WindchillStatus.java:135)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.apache.el.parser.AstValue.invoke(AstValue.java:245)
at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:267)
at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:87)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
at javax.faces.component.UICommand.broadcast(UICommand.java:315)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790)
Please do help me to fix my issue.
Regards,
Archana
Solved! Go to Solution.
Try creating a local hostfile mapping in the webapplication server directing the windchill URL to one of the slave nodes.
Thank you
Binesh Kumar
Barry Wehmiller
Hi Archana,
Could you let us know the Windchill version. Are you running this code from master server with only BGMS configured?
Regards,
Bhushan
Absolutely right, make sure you are running from a foreground node and also ensure that you have a cluster URL mapped to local IP in the hostfile so that the request won't get directed to loadbalancer.
Thank you
Binesh Kumar
Barry Wehmiller
Hi Bhushan,
Thanks for ur reply .
I am running this java class from another web application which is not in any node of the cluster.It is entirely out side of this cluster environment.
We are using Windchill 10 M030 version.
Regards,
Archana
Try creating a local hostfile mapping in the webapplication server directing the windchill URL to one of the slave nodes.
Thank you
Binesh Kumar
Barry Wehmiller
Hi Binesh,
Thanks for ur reply.
The above is working fine
Can u please let me know why cant I use the load balancer IP address(Mapping) itself as any request to load balancer redirects to any of the slave nodes.
Regards,
Archana
It looks like the load balancer is not forwarding the RMI requests to slave hosts. You can either have load balancer redirect requests hitting on those ports. You can also try whether RMI tunneling over http is an option.
Thank you
Binesh Kumar
Barry Wehmiller
Thank u Binesh Kumar for ur information.
Regards,
Archana