Solved

Servlet problem in CF7->CF8 move

Posted on 2007-11-19
9
332 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 1

Author Comment

by:kcmurphy1
Comment Utility
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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 1

Author Comment

by:kcmurphy1
Comment Utility
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
Comment Utility
Is it still on Java 1.4.2 after the upgrade?

(just checking) ;-)
0
 
LVL 1

Author Comment

by:kcmurphy1
Comment Utility
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
Comment Utility
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
Comment Utility
Reinstalling from scratch fixed the problem.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

771 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now