Solved

Servlet problem in CF7->CF8 move

Posted on 2007-11-19
9
334 Views
Last Modified: 2013-12-24
When trying to connect to an RMI Service from within a Java Servlet running on a Cold Fusion 8 server, our application is throwing an exception. The code is unchanged from what ran successfully on Cold Fusion 7. The interface that defines the RMI Service is:

public interface Request extends Remote, FsbConstants {
public Response handle(Datatable data) throws RemoteException;
}


the method where the RMI Call is being made and the problem is occuring is:

private Response getRequest(String service, Datatable data) {
try { return ((Request)Naming.lookup(service)).handle(data); }
catch (Exception excp) {
excp.printStackTrace();
return (new Response(Response.PAGE_NO_RMI_ERROR, data));
}
}


and the RMI method that is being called is:

public Response handle(Datatable data) throws RemoteException {
Processor processor = null;
Response result = null;
String action = null;
String page = null;
String sid = null;
Date fini, strt;
try {
sid = (String)data.get(SESSION_ID);
getSessionFromDb(sid, data);
action = getProcessorCode(INIData.get(((String)data.get(Processor.PROCESSOR)).trim()));
processor = getProcessor(action, data);
result = (Response)processor.process();
saveSessionToDb(sid, result);
}
catch(SQLException sqle) {
page = getPage(INIData.get(((String)data.get(PROCESSOR)).trim()));
sqle.printStackTrace();
return new Response(PAGE_SQL_ERROR, page, data);
}
catch(FsbException fsbe) {
page = getPage(INIData.get(((String)data.get(PROCESSOR)).trim()));
fsbe.printStackTrace();
return new Response(PAGE_RMI_ERROR, page, data);
}
return result;
}




Note that serveice is the name of the RMI service being connected to and data is an extension
of the standard Java Hash table. The exception that is thrown and its stack trace is as follows:

Exception: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.net.MalformedURLException: no protocol: of
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.net.MalformedURLException: no protocol: of
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:336)
at sun.rmi.transport.Transport$1.run(Transport.java:159)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)
at fsb.lib.request.RequestHandler_Stub.handle(Unknown Source)
at SingleSignOn.getRequest(SingleSignOn.java:320)
at SingleSignOn.doPost(SingleSignOn.java:569)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)
at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:284)
at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)
at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203)
at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
Caused by: java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.net.MalformedURLException: no protocol: of
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:293)
at sun.rmi.transport.Transport$1.run(Transport.java:159)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.net.MalformedURLException: no protocol: of
at java.net.URL.<init>(URL.java:567)
at java.net.URL.<init>(URL.java:464)
at java.net.URL.<init>(URL.java:413)
at sun.rmi.server.LoaderHandler.pathToURLs(LoaderHandler.java:751)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:147)
at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:620)
at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:247)
at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:197)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1575)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1732)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
at sun.rmi.server.UnicastRef.unmarshalValue(UnicastRef.java:306)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:290)
... 9 more


We've tried setting the ports we're using as reserved so Windows doesn't assign them from the random pool, doesn't seem to have any effect on the issue.

Is there a setting or property we need to change to allow for an RMI connection from within cold fusion? Or any other suggestions? Any help is much appreciated. Thanks!
0
Comment
Question by:kcmurphy1
  • 6
  • 3
9 Comments
 
LVL 35

Expert Comment

by:TimYates
ID: 20312756
Can you print out the service in:

private Response getRequest(String service, Datatable data) {

It looks like it's getting passed an incorrect value
0
 
LVL 1

Author Comment

by:kcmurphy1
ID: 20315933
The values the getRequest(String service, Datatable data) method is
receiving are correct as the following listing shows.  The service is
the name of the RMI service and the data is a hashtable of name/value
pair strings:

Service: //172.55.192.51:1098/RequestProcessor
Data: {fsbSessionId=4A7D4E0C6C4C426AB5AA625A95E8DE80,
      newSessionId=false,
      processor=IOBPW111,
      userNumber=JavaProf}
Naming:  RequestHandler_Stub[UnicastRef [liveRef: [endpoint:[172.55.192.51:1152](remote),objID:[-1b56c07f:11659df3130:-7fff, -1499502016227772353]]]]
0
 
LVL 35

Expert Comment

by:TimYates
ID: 20318442
The exception you are getting is because the service has no protocol...

And if you look at the URL passed as the service, it indeed has no protocol...

Shouldn't it be:

    rmi://172.55.192.51:1098/RequestProcessor
0
Manage your data center from practically anywhere

The KN8164V features HD resolution of 1920 x 1200, FIPS 140-2 with level 1 security standards and virtual media transmissions at twice the speed. Built for reliability, the KN series provides local console and remote over IP access, ensuring 24/7 availability to all servers.

 
LVL 1

Author Comment

by:kcmurphy1
ID: 20324184
Thank you TimYates:

We have tried it with and without the scheme and it still does not work.  Also the Java 1.4.2 documentation states that the scheme is unnecessary.  

The Naming class provides methods for storing and obtaining references to remote objects in a remote object registry. Each method of the Naming class takes as one of its arguments a name that is a java.lang.String in URL format (without the scheme component) of the form:

    //host:port/name
 
where host is the host (remote or local) where the registry is located, port is the port number on which the registry accepts calls, and where name is a simple string uninterpreted by the registry. Both host and port are optional.  If host is omitted, the host defaults to the local host. If port is omitted, then the port defaults to 1099, the "well-known" port that RMI's registry, rmiregistry, uses.
0
 
LVL 1

Author Comment

by:kcmurphy1
ID: 20324190
Thank you TimYates for your help.  We have tried it with and without the scheme and it still does not work.  Also the Java 1.4.2 documentation states that the scheme is unnecessary.  

The Naming class provides methods for storing and obtaining references to remote objects in a remote object registry. Each method of the Naming class takes as one of its arguments a name that is a java.lang.String in URL format (without the scheme component) of the form:

    //host:port/name
 
where host is the host (remote or local) where the registry is located, port is the port number on which the registry accepts calls, and where name is a simple string uninterpreted by the registry. Both host and port are optional.  If host is omitted, the host defaults to the local host. If port is omitted, then the port defaults to 1099, the "well-known" port that RMI's registry, rmiregistry, uses.
0
 
LVL 35

Expert Comment

by:TimYates
ID: 20326406
Is it still on Java 1.4.2 after the upgrade?

(just checking) ;-)
0
 
LVL 1

Author Comment

by:kcmurphy1
ID: 20332850
Sorry for the delay Tim.

I will be running Java 1.6.0_01 and CF 8,0,0,176276 coming from Java 1.4.2_09  and CF 7,0,2,142559  

Your assistance is greatly appreciated!
0
 
LVL 1

Author Comment

by:kcmurphy1
ID: 20364357
If anyone could provide further assistance with this matter, it would be greatly appreciated. We need to complete the upgrade by mid-december in support of a separate project.

The removal of the protocol is correct for Java 1.6:
http://java.sun.com/javase/6/docs/api/java/rmi/Naming.html
0
 
LVL 1

Accepted Solution

by:
kcmurphy1 earned 0 total points
ID: 20825439
Reinstalling from scratch fixed the problem.
0

Featured Post

Connect further...control easier

With the ATEN CE624, you can now enjoy a high-quality visual experience powered by HDBaseT technology and the convenience of a single Cat6 cable to transmit uncompressed video with zero latency and multi-streaming for dual-view applications where remote access is required.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question