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

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

wt.util.WTRemoteException: Unable to invoke remote method;

WhiteChen
8-Gravel

wt.util.WTRemoteException: Unable to invoke remote method;

Who can help me to solve this problem, my code is:

public class Test {

  /**

  * @param args

  */

  public static void main(String[] args) throws Exception {

  URL url= new URL("http://whichen-ws01.cisco.com/Windchill");

  RemoteMethodServer rms=RemoteMethodServer.getInstance(url);

  rms.setUserName("wcadmin");

  rms.setPassword("wcadmin");

  System.out.println("login succeed!");

  Class argTypes[]={String.class, String.class, String.class, String.class};

  Object argValues[]={

  "Whichen_demo_name2",

  "Whichen_demo_number2",

  "Whichen_demo_file2",

  "C:\temp\rule.xml"

  };


//accessing the method of a utility class which is in windchill codebase directory

  rms.invoke("createDoc", "com.cisco.whichen.DocManager", null, argTypes, argValues);

  System.out.println("Succeeded!");

  }

}

My local host file is:

127.0.0.1 localhost whichen-ws01.cisco.com # whichen-ws01

Looking forward to your kindly help.

ACCEPTED SOLUTION

Accepted Solutions
ChrisSpartz
13-Aquamarine
(To:WhiteChen)

The package of this class is 'com.cisco.whichen2'. That means the class file should be copied into Windchill/codebase/com/cisco/whichen2/

View solution in original post

9 REPLIES 9

Can you share the logs generated when executing the java file. Are you able to run it successfully if the file if executed from the server machine?

Regards,

Bhushan

I run it successfully in Linux environment, but my local test environment is WINDOWS7.

Below is the error info.

Exception in thread "main" 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:

       wt.util.WTRemoteException: Unable to locate server manager's registry; nested exception is:

       java.io.FileNotFoundException: http://whichen-ws01.cisco.com/wt.properties

       at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)

       at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)

       at wt.util.WTContext.getResourceAsStream(WTContext.java:3568)

       at wt.util.WTProperties.getServerProperties(WTProperties.java:965)

       at wt.manager.RemoteServerManager.getRegistry(RemoteServerManager.java:723)

       at wt.manager.RemoteServerManager.acquireServerManager(RemoteServerManager.java:587)

       at wt.manager.RemoteServerManager.getServerManager(RemoteServerManager.java:566)

       at wt.manager.RemoteServerManager.remoteInvoke(RemoteServerManager.java:502)

       at wt.manager.RemoteServerManager.getServer(RemoteServerManager.java:283)

       at wt.manager.RemoteServerManager.getServer(RemoteServerManager.java:267)

       at wt.method.RemoteMethodServer.getMethodServer(RemoteMethodServer.java:1022)

       at wt.method.RemoteMethodServer.invoke(RemoteMethodServer.java:620)

       at com.cisco.whichen.Test.main(Test.java:43)

The attachments is two method for remote method I got from the community, but both of them can't work in my test environment, please help me.

Thanks

ChrisSpartz
13-Aquamarine
(To:WhiteChen)

It's failing because of the below line:

java.io.FileNotFoundException: http://whichen-ws01.cisco.com/wt.properties

This error is saying that it can't find the wt.properties file for the server. But, the above URL isn't the right location for wt.properties. It should be looking for http://whichen-ws01.cisco.com/Windchill/wt.properties‌ instead. The fact that it is using the wrong location makes me think there is some misconfiguration in your properties. What is the current value of wt.server.codebase in your wt.properties file?

Thanks for your reply, in my wt.properties:

wt.server.codebase=$(wt.webserver.protocol)\://$(wt.rmi.server.hostname)/$(wt.webapp.name)

How can I solve this problem? The attachment is my wt.properties.

ChrisSpartz
13-Aquamarine
(To:WhiteChen)

All of your properties look correct to me.

I tried running your Test class on my system (after changing the url to the url of my system) and I got the same issue as you. So, I looked through the code that is constructing this incorrect wt.properties URL, and I found that the issue is with the java.net.URL class. The way the wt.properties URL is generated is by using the below constructor:

new URL(<serverUrl>,"wt.properties")

This should append 'wt.properties' to the end of the server URL. But, what I've found is that if the server URL does not include a trailing slash, then the URL constructor will replace the path in the server URL with "wt.properties", resulting in the incorrect url. But, if you put a trailing slash at the end of your server URL, it correctly appends 'wt.properties' to the end of the server URL. So, try updating your Test class to use a trailing slash at the end of the server URL, and let us know if you still get the same error.

I added the trailing slash, error of " java.io.FileNotFoundException: http://whichen-ws01.cisco.com/wt.properties" disappeared. Thanks a lot.

But a new error come out:

1.7.0_72-b14

login succeed!

Exception in thread "main" wt.util.WTRemoteException: Unable to invoke remote method; nested exception is:

  java.rmi.ServerError: Server exception; nested exception is:

  java.lang.UnsupportedClassVersionError: com/cisco/whichen/Test : Unsupported major.minor version 52.0

  at wt.method.RemoteMethodServer.invoke(RemoteMethodServer.java:814)

  at com.cisco.whichen.Test.main(Test.java:46)

Caused by: java.lang.UnsupportedClassVersionError: com/cisco/whichen/Test : Unsupported major.minor version 52.0

  ... 2 more

By google it, it's means my build path and compiler use different JAVA version. But I checked my Build Path and JAVA Compiler are both 1.7.

Tomcat also use JVM 1.7. I don't why this error will appear. Please help.

I changed eclipse version from neon to indigo, the error message is below:

1.7.0_72-b14

login succeed!

Exception in thread "main" wt.util.WTRemoteException: Unable to invoke remote method; nested exception is:

  java.lang.ClassNotFoundException: com.cisco.whichen2.Test0818

  at java.net.URLClassLoader$1.run(URLClassLoader.java:366)

  at java.net.URLClassLoader$1.run(URLClassLoader.java:355)

  at java.security.AccessController.doPrivileged(Native Method)

  at java.net.URLClassLoader.findClass(URLClassLoader.java:354)

  at java.lang.ClassLoader.loadClass(ClassLoader.java:425)

  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)

  at java.lang.ClassLoader.loadClass(ClassLoader.java:358)

  at java.lang.Class.forName0(Native Method)

  at java.lang.Class.forName(Class.java:191)

  at wt.method.MethodServerImpl.getTargetClass(MethodServerImpl.java:442)

  at wt.method.MethodServerImpl.invoke(MethodServerImpl.java:362)

  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

  at java.lang.reflect.Method.invoke(Method.java:606)

  at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322)

  at sun.rmi.transport.Transport$1.run(Transport.java:177)

  at sun.rmi.transport.Transport$1.run(Transport.java:174)

  at java.security.AccessController.doPrivileged(Native Method)

  at sun.rmi.transport.Transport.serviceCall(Transport.java:173)

  at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:556)

  at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:811)

  at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:670)

  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

  at java.lang.Thread.run(Thread.java:745)

  at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:275)

  at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:252)

  at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:161)

  at wt.method.MethodServerImpl_Stub.invoke(Unknown Source)

  at wt.method.RemoteMethodServer.invoke(RemoteMethodServer.java:646)

  at com.cisco.whichen2.Test0818.main(Test0818.java:46)

The attachment is my source file. I have copied the .class into Windchill/codebase .

Thanks.

White

ChrisSpartz
13-Aquamarine
(To:WhiteChen)

The package of this class is 'com.cisco.whichen2'. That means the class file should be copied into Windchill/codebase/com/cisco/whichen2/

Thank you very much, all problems were solved. Have a good day.

Announcements


Top Tags