Re: RMI in Tomcat - last try
hihi Nikola, where are you placing your JAR files? are any in TC/commons/lib or TC/shared/lib? try placing everything together, just as a test. put *all* your classes and JAR files under TC/commons for example and give it a try... they should be able to see each other if they are at the same classloading hierarchy level... this is what i suspect your problem is http://struts.apache.org/userGuide/configuration.html#config_add hth, woodchuck --- Nikola Milutinovic [EMAIL PROTECTED] wrote: Hi all. Me and the team have given up on RMI and went to RPC, but I thought I'd make one last educational attempt. Is anyone using RMI in TC where TC is acting as a RMI client to a remote RMI, general-purpose, server? I have seen tons of (rather old) examples of Applet being a RMI client and they do not help me one bit. To remind the group of my problems, I'll recap. I have a working RMI client and server packages, plus command line test client application which uses RMI client lib successfully against the server. When the same lib is used in Tomcat from a servlet, it throws ClassCastException. Further investigation has shown that the class that Servlet gets from RMI subsystem implements the desired interface, to which it is being cast. It also showed that the classloader of the class was RMI ClassLoader, while other classes in the servlet, including servlet itself werefrom TC's ClassLoader. It lead me to believe that *that* is the source of the problem. It has occured to me that, since TC web application has several classloaders, bound into a hierarchy, maybe RMI classloader should be somehow introduced into it. QUESTIONS Am I on the right track? If yes, how do I bind in RMI ClassLoader into TC's ClassLoader hierarchy? And, lastly, who should do it - Servlet or RMI client? The last question is more a design question, but it could also be a feasibility question, too. Can RMI client detect a classloader it should bind into? It could be dome from the Servlet, but I would like to have a general purpose Servlet that would be oblivious of underlying implementation. I thought that at least JBoss developers would have something to say on this question, since, as I recall, JBoss uses or has been using a lot of RMI. There was one article or was it JBoss docs, which explained some problems of classloading, which were very similar to mine. I don't recall those docs saying anything to solve the problem in TC. Nix. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Discover Yahoo! Stay in touch with email, IM, photo sharing and more. Check it out! http://discover.yahoo.com/stayintouch.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: RMI in Tomcat - last try
Woodchuck wrote: hihi Nikola, where are you placing your JAR files? are any in TC/commons/lib or TC/shared/lib? try placing everything together, just as a test. put *all* your classes and JAR files under TC/commons for example and give it a try... they should be able to see each other if they are at the same classloading hierarchy level... this is what i suspect your problem is http://struts.apache.org/userGuide/configuration.html#config_add Hi Woodchuck. I forgot to mention that, when I place ALL classes inside WEB-INF/classes, including the *_Stub classes, then it works. I guess in that case TC's classloader picks up the classes before RMI classloader and, since it is teh same CL, it works. This solution is a patch, as far as I am concerned, since copying all those classes to clients classpath (TC's webapp WEB-INF/classes) is actually what RMI is supposed to root out. If I cannot have server classes in RMI codebase (one place), then I can as well go use RPC or pure sockets/serialization. All of this still makes me believe that somehow RMI classloader should be introduced into TC's CL hierarchy. Or maybe install JBoss altogehter? Nix. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: RMI Problem
Hi Yoav, thank you very much for this reference. As pointed out there, the solution was to unexport the registry itself with: UnicastRemoteObject.unexportObject(registry, force); Chris On Tue, 25 May 2004, Shapira, Yoav wrote: Hi, I think you're doing the right thing. See also http://archives.java.sun.com/cgi-bin/wa?A2=ind0104L=rmi-usersP=R25414; I= Yoav Shapira Millennium Research Informatics -Original Message- From: Christoph Mangold [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 25, 2004 1:55 PM To: Tomcat Users List Subject: RE: RMI Problem Thanks for your reply. Unfortunately shutting down the registry seems not to work (although I tried hard I could not find a way to do this). Instead, on shutdown (i.e. in my ServletContextListener.contextDestroyed()-method), I unexport my remote objects and unbind them in the registry. Does anyone know of a better way to do this? Chris On Tue, 25 May 2004, Shapira, Yoav wrote: Hi, You have to shutdown your RMI registery properly during the webapp's shutdown (the first part of the reload is a shutdown). Use a ServletContextListener's contextDestroyed method for this. Yoav Shapira Millennium Research Informatics -Original Message- From: Christoph Mangold [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 25, 2004 3:22 AM To: [EMAIL PROTECTED] Subject: RMI Problem I am trying to run an rmi registry as part of a servlet context in tomcat 5.0.19. When I startup tomcat the first time everything works fine. However, if I redeploy my application using tomcat's ant-reload-target I get the following exception (server side) when trying to connect from the (RMI) client: Exception dispatching call to [0:0:0, 0] in thread RMI TCP Connection(7)-129.69.216.97 at Wed May 19 15:45:06 CEST 2004: java.lang.NullPointerException at org.apache.catalina.loader.WebappClassLoader.getURLs(WebappClassLoader. java :1431) at sun.rmi.server.LoaderHandler.getClassAnnotation(LoaderHandler.java:221) at java.rmi.server.RMIClassLoader$2.getClassAnnotation(RMIClassLoader.java :650 ) at java.rmi.server.RMIClassLoader.getClassAnnotation(RMIClassLoader.java:3 80) at sun.rmi.server.MarshalOutputStream.annotateClass(MarshalOutputStream.ja va:7 8) at java.io.ObjectOutputStream.writeNonProxyDesc(ObjectOutputStream.java:11 47) at java.io.ObjectOutputStream.writeClassDesc(ObjectOutputStream.java:1100) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java: 1241 ) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278) at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source) at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:342) at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:207) at sun.rmi.transport.Transport$1.run(Transport.java:148) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:144) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460 ) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.j ava: 701) at java.lang.Thread.run(Thread.java:534) Exception dispatching call to [0:0:0, 0] in thread RMI TCP Connection(7)-129.69.216.97 at Wed May 19 15:45:06 CEST 2004: java.rmi.UnmarshalException: error unmarshalling call header; nested exception is: java.io.StreamCorruptedException: result already in progress at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:217) at sun.rmi.transport.Transport$1.run(Transport.java:148) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:144) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460 ) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.j ava: 701) at java.lang.Thread.run(Thread.java:534) Caused by: java.io.StreamCorruptedException: result already in progress at sun.rmi.transport.StreamRemoteCall.getResultStream(StreamRemoteCall.jav a:16 1) at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:347) at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:207) ... 6 more Any idea how I can deal with this? Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any
RE: RMI Problem
Hi, You have to shutdown your RMI registery properly during the webapp's shutdown (the first part of the reload is a shutdown). Use a ServletContextListener's contextDestroyed method for this. Yoav Shapira Millennium Research Informatics -Original Message- From: Christoph Mangold [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 25, 2004 3:22 AM To: [EMAIL PROTECTED] Subject: RMI Problem I am trying to run an rmi registry as part of a servlet context in tomcat 5.0.19. When I startup tomcat the first time everything works fine. However, if I redeploy my application using tomcat's ant-reload-target I get the following exception (server side) when trying to connect from the (RMI) client: Exception dispatching call to [0:0:0, 0] in thread RMI TCP Connection(7)-129.69.216.97 at Wed May 19 15:45:06 CEST 2004: java.lang.NullPointerException at org.apache.catalina.loader.WebappClassLoader.getURLs(WebappClassLoader. java :1431) at sun.rmi.server.LoaderHandler.getClassAnnotation(LoaderHandler.java:221) at java.rmi.server.RMIClassLoader$2.getClassAnnotation(RMIClassLoader.java :650 ) at java.rmi.server.RMIClassLoader.getClassAnnotation(RMIClassLoader.java:3 80) at sun.rmi.server.MarshalOutputStream.annotateClass(MarshalOutputStream.ja va:7 8) at java.io.ObjectOutputStream.writeNonProxyDesc(ObjectOutputStream.java:11 47) at java.io.ObjectOutputStream.writeClassDesc(ObjectOutputStream.java:1100) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java: 1241 ) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278) at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source) at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:342) at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:207) at sun.rmi.transport.Transport$1.run(Transport.java:148) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:144) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460 ) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.j ava: 701) at java.lang.Thread.run(Thread.java:534) Exception dispatching call to [0:0:0, 0] in thread RMI TCP Connection(7)-129.69.216.97 at Wed May 19 15:45:06 CEST 2004: java.rmi.UnmarshalException: error unmarshalling call header; nested exception is: java.io.StreamCorruptedException: result already in progress at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:217) at sun.rmi.transport.Transport$1.run(Transport.java:148) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:144) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460 ) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.j ava: 701) at java.lang.Thread.run(Thread.java:534) Caused by: java.io.StreamCorruptedException: result already in progress at sun.rmi.transport.StreamRemoteCall.getResultStream(StreamRemoteCall.jav a:16 1) at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:347) at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:207) ... 6 more Any idea how I can deal with this? Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: RMI Problem
Thanks for your reply. Unfortunately shutting down the registry seems not to work (although I tried hard I could not find a way to do this). Instead, on shutdown (i.e. in my ServletContextListener.contextDestroyed()-method), I unexport my remote objects and unbind them in the registry. Does anyone know of a better way to do this? Chris On Tue, 25 May 2004, Shapira, Yoav wrote: Hi, You have to shutdown your RMI registery properly during the webapp's shutdown (the first part of the reload is a shutdown). Use a ServletContextListener's contextDestroyed method for this. Yoav Shapira Millennium Research Informatics -Original Message- From: Christoph Mangold [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 25, 2004 3:22 AM To: [EMAIL PROTECTED] Subject: RMI Problem I am trying to run an rmi registry as part of a servlet context in tomcat 5.0.19. When I startup tomcat the first time everything works fine. However, if I redeploy my application using tomcat's ant-reload-target I get the following exception (server side) when trying to connect from the (RMI) client: Exception dispatching call to [0:0:0, 0] in thread RMI TCP Connection(7)-129.69.216.97 at Wed May 19 15:45:06 CEST 2004: java.lang.NullPointerException at org.apache.catalina.loader.WebappClassLoader.getURLs(WebappClassLoader. java :1431) at sun.rmi.server.LoaderHandler.getClassAnnotation(LoaderHandler.java:221) at java.rmi.server.RMIClassLoader$2.getClassAnnotation(RMIClassLoader.java :650 ) at java.rmi.server.RMIClassLoader.getClassAnnotation(RMIClassLoader.java:3 80) at sun.rmi.server.MarshalOutputStream.annotateClass(MarshalOutputStream.ja va:7 8) at java.io.ObjectOutputStream.writeNonProxyDesc(ObjectOutputStream.java:11 47) at java.io.ObjectOutputStream.writeClassDesc(ObjectOutputStream.java:1100) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java: 1241 ) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278) at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source) at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:342) at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:207) at sun.rmi.transport.Transport$1.run(Transport.java:148) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:144) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460 ) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.j ava: 701) at java.lang.Thread.run(Thread.java:534) Exception dispatching call to [0:0:0, 0] in thread RMI TCP Connection(7)-129.69.216.97 at Wed May 19 15:45:06 CEST 2004: java.rmi.UnmarshalException: error unmarshalling call header; nested exception is: java.io.StreamCorruptedException: result already in progress at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:217) at sun.rmi.transport.Transport$1.run(Transport.java:148) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:144) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460 ) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.j ava: 701) at java.lang.Thread.run(Thread.java:534) Caused by: java.io.StreamCorruptedException: result already in progress at sun.rmi.transport.StreamRemoteCall.getResultStream(StreamRemoteCall.jav a:16 1) at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:347) at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:207) ... 6 more Any idea how I can deal with this? Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Christoph Mangold - To unsubscribe, e-mail:
RE: RMI Problem
Hi, I think you're doing the right thing. See also http://archives.java.sun.com/cgi-bin/wa?A2=ind0104L=rmi-usersP=R25414; I= Yoav Shapira Millennium Research Informatics -Original Message- From: Christoph Mangold [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 25, 2004 1:55 PM To: Tomcat Users List Subject: RE: RMI Problem Thanks for your reply. Unfortunately shutting down the registry seems not to work (although I tried hard I could not find a way to do this). Instead, on shutdown (i.e. in my ServletContextListener.contextDestroyed()-method), I unexport my remote objects and unbind them in the registry. Does anyone know of a better way to do this? Chris On Tue, 25 May 2004, Shapira, Yoav wrote: Hi, You have to shutdown your RMI registery properly during the webapp's shutdown (the first part of the reload is a shutdown). Use a ServletContextListener's contextDestroyed method for this. Yoav Shapira Millennium Research Informatics -Original Message- From: Christoph Mangold [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 25, 2004 3:22 AM To: [EMAIL PROTECTED] Subject: RMI Problem I am trying to run an rmi registry as part of a servlet context in tomcat 5.0.19. When I startup tomcat the first time everything works fine. However, if I redeploy my application using tomcat's ant-reload-target I get the following exception (server side) when trying to connect from the (RMI) client: Exception dispatching call to [0:0:0, 0] in thread RMI TCP Connection(7)-129.69.216.97 at Wed May 19 15:45:06 CEST 2004: java.lang.NullPointerException at org.apache.catalina.loader.WebappClassLoader.getURLs(WebappClassLoader. java :1431) at sun.rmi.server.LoaderHandler.getClassAnnotation(LoaderHandler.java:221) at java.rmi.server.RMIClassLoader$2.getClassAnnotation(RMIClassLoader.java :650 ) at java.rmi.server.RMIClassLoader.getClassAnnotation(RMIClassLoader.java:3 80) at sun.rmi.server.MarshalOutputStream.annotateClass(MarshalOutputStream.ja va:7 8) at java.io.ObjectOutputStream.writeNonProxyDesc(ObjectOutputStream.java:11 47) at java.io.ObjectOutputStream.writeClassDesc(ObjectOutputStream.java:1100) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java: 1241 ) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278) at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source) at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:342) at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:207) at sun.rmi.transport.Transport$1.run(Transport.java:148) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:144) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460 ) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.j ava: 701) at java.lang.Thread.run(Thread.java:534) Exception dispatching call to [0:0:0, 0] in thread RMI TCP Connection(7)-129.69.216.97 at Wed May 19 15:45:06 CEST 2004: java.rmi.UnmarshalException: error unmarshalling call header; nested exception is: java.io.StreamCorruptedException: result already in progress at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:217) at sun.rmi.transport.Transport$1.run(Transport.java:148) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:144) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460 ) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.j ava: 701) at java.lang.Thread.run(Thread.java:534) Caused by: java.io.StreamCorruptedException: result already in progress at sun.rmi.transport.StreamRemoteCall.getResultStream(StreamRemoteCall.jav a:16 1) at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:347) at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:207) ... 6 more Any idea how I can deal with this? Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify
RE: rmi performance under tomcat
Howdy, Why do you think tomcat has its own RMI implementation? Was there anything tomcat-specific that showed up in your profiler? Yoav Shapira Millennium ChemInformatics -Original Message- From: Johan Coens [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 28, 2004 11:24 AM To: Tomcat Users List Subject: rmi performance under tomcat Hello all, I have an application which heavily uses rmi. Because the poor performance under tomcat, i tried some other app servers to compare. I came up with the following results: - tomcat 4.0.6 - websphere 5.0 - orion 2.0.2 - jetty 4.2.15 orion 1.2 sec websphere 1.2 sec tomcat 8.4 sec jetty 1.1 sec All tests ran under the same jdk (1.3.1_06), same machine, same configuration, default install etc. I know I use old jdk's and old tomcat version, but I have tried newer tomcat (4.1.28, 5.0) and newer jdk's (1.4.2), but that only showed slight performance gain. I used JProbe to find out what the bottleneck would be, it showed that 67% off all method time goes to java.rmi.server.RemoteRef.invoke and 20% goes to java.rmi.Registry.Lookup. Is it a known issue or known configuration issue, is there a way to speed up this performance? The test machine running is WinXp 1.8Ghz, 512Mb mem. Cheers, Johan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: rmi performance under tomcat
There was a bugzilla report about this in 4.1.??. It turned out there was a lot of calls to something or lack of caching or something else. (Or maybe is was a tomcat-dev discussion) In either case - it was many months ago. I don't know if this got fixed in 4.1 or if the root cause was just exposed. Whatever it was, it won't be fixed in 4.0.X Thats all the details I can remember. -Tim Johan Coens wrote: Hello all, I have an application which heavily uses rmi. Because the poor performance under tomcat, i tried some other app servers to compare. I came up with the following results: - tomcat 4.0.6 - websphere 5.0 - orion 2.0.2 - jetty 4.2.15 orion 1.2 sec websphere 1.2 sec tomcat 8.4 sec jetty 1.1 sec All tests ran under the same jdk (1.3.1_06), same machine, same configuration, default install etc. I know I use old jdk's and old tomcat version, but I have tried newer tomcat (4.1.28, 5.0) and newer jdk's (1.4.2), but that only showed slight performance gain. I used JProbe to find out what the bottleneck would be, it showed that 67% off all method time goes to java.rmi.server.RemoteRef.invoke and 20% goes to java.rmi.Registry.Lookup. Is it a known issue or known configuration issue, is there a way to speed up this performance? The test machine running is WinXp 1.8Ghz, 512Mb mem. Cheers, Johan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: RMI on Tomcat
Anybody has any ideas on this, Thanks again, Sanjay --- Sanjay [EMAIL PROTECTED] wrote: I am trying to set a RMI-IIOP server on Tomcat. Getting some issues. MY RMI Server works fine if I start it standalone- without Tomcat. I think have been able to set security codebase etc correctly. Environment : Tomcat 4.1, Win NT4, JDK1.4.1 I have issues when I start the RMIServer in Tomcat. I can start tomcat in the secured mode and start my RMI server successfully but then I run into two different kinds of problems: 1. If I run the client from the same m/c as Tomcat then I can do the lookup and also do the PortableRemoteObject.narrow(). But a client on a difffrent m/c (in the same LAN) can not execute the narrow() - gives classcast Exception. 2. I can not execute a method on the server (even when I get the narrow() to succeeed). Gives error: java.rmi.NoSuchObjectException: CORBA OBJECT_NOT_EXIST 1398079692 No Has anyone done this. Any ideas suggestions would be welcome Thanks Sanjay __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: RMI on Tomcat
You may problems using RMI if tomcat is installed in a directory containing whitespace. (e.g. C:\Program Files\Apache Group\...). -Original Message- From: Sanjay [mailto:[EMAIL PROTECTED] Sent: 09 July 2003 14:02 To: Tomcat Users List Subject: Re: RMI on Tomcat Anybody has any ideas on this, Thanks again, Sanjay --- Sanjay [EMAIL PROTECTED] wrote: I am trying to set a RMI-IIOP server on Tomcat. Getting some issues. MY RMI Server works fine if I start it standalone- without Tomcat. I think have been able to set security codebase etc correctly. Environment : Tomcat 4.1, Win NT4, JDK1.4.1 I have issues when I start the RMIServer in Tomcat. I can start tomcat in the secured mode and start my RMI server successfully but then I run into two different kinds of problems: 1. If I run the client from the same m/c as Tomcat then I can do the lookup and also do the PortableRemoteObject.narrow(). But a client on a difffrent m/c (in the same LAN) can not execute the narrow() - gives classcast Exception. 2. I can not execute a method on the server (even when I get the narrow() to succeeed). Gives error: java.rmi.NoSuchObjectException: CORBA OBJECT_NOT_EXIST 1398079692 No Has anyone done this. Any ideas suggestions would be welcome Thanks Sanjay __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: RMI on Tomcat
I have it set in a simple directory called tomcat. Thanks Sanjay --- Bodycombe, Andrew [EMAIL PROTECTED] wrote: You may problems using RMI if tomcat is installed in a directory containing whitespace. (e.g. C:\Program Files\Apache Group\...). -Original Message- From: Sanjay [mailto:[EMAIL PROTECTED] Sent: 09 July 2003 14:02 To: Tomcat Users List Subject: Re: RMI on Tomcat Anybody has any ideas on this, Thanks again, Sanjay --- Sanjay [EMAIL PROTECTED] wrote: I am trying to set a RMI-IIOP server on Tomcat. Getting some issues. MY RMI Server works fine if I start it standalone- without Tomcat. I think have been able to set security codebase etc correctly. Environment : Tomcat 4.1, Win NT4, JDK1.4.1 I have issues when I start the RMIServer in Tomcat. I can start tomcat in the secured mode and start my RMI server successfully but then I run into two different kinds of problems: 1. If I run the client from the same m/c as Tomcat then I can do the lookup and also do the PortableRemoteObject.narrow(). But a client on a difffrent m/c (in the same LAN) can not execute the narrow() - gives classcast Exception. 2. I can not execute a method on the server (even when I get the narrow() to succeeed). Gives error: java.rmi.NoSuchObjectException: CORBA OBJECT_NOT_EXIST 1398079692 No Has anyone done this. Any ideas suggestions would be welcome Thanks Sanjay __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: RMI Performance problem
RMI has never been fast. It uses java serialization to marshall requests. hence it is slow. The more complicated objects you send over the request, the slower it gets. Filip -Original Message- From: Arachtingi, Mike [mailto:[EMAIL PROTECTED]] Sent: Friday, January 31, 2003 2:07 PM To: [EMAIL PROTECTED] Subject: RMI Performance problem Has anyone noticed a performance problem, using RMI from within a web app? I developed a test program that looks up a remote object, and sends it 99 messages (i.e., invokes one of the remote methods.) When I run this as a stand-alone program, my results show an average invocation time of about 3 - 4ms. When I run the same program as a web app (tomcat 4.0.1, or 4.0.4) I'm seeing averages around 80 ms. JProbe confirms that cpu time is primarily spent in sun.rmi.server.UnicastRef.invoke( ) I don't have the sun.rmi source right now (I've looked on Sun One, but can't find it -- anyone know the URL?), so I don't have any idea what's the hang up. Anyone have insight into this? I saw a similar thread msg77001 RMI Class Annotation, in which a fellow sees 800 ms per invocation for his test, but he was talking about JBoss, and huge classpaths. Or, am I having the same problem? (I don't know anything about RMIClassLoader.getClassAnnotation(), which he says delivers 35K bytes from server to client in his situation.) Thanks, Mike Arachtingi - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: RMI Performance problem
sorry didn't read the full email. Performance degrading when inside of an webapp, shouldn't be doing that, unless the classloader is doing something funky when demarshalling your request. what you could do is to play around putting your RMI classes in different classpaths, like common/lib instead of WEB-INF/lib and see if that yields a difference Filip -Original Message- From: Filip Hanik Sent: Friday, January 31, 2003 2:16 PM To: Tomcat Users List Subject: RE: RMI Performance problem RMI has never been fast. It uses java serialization to marshall requests. hence it is slow. The more complicated objects you send over the request, the slower it gets. Filip -Original Message- From: Arachtingi, Mike [mailto:[EMAIL PROTECTED]] Sent: Friday, January 31, 2003 2:07 PM To: [EMAIL PROTECTED] Subject: RMI Performance problem Has anyone noticed a performance problem, using RMI from within a web app? I developed a test program that looks up a remote object, and sends it 99 messages (i.e., invokes one of the remote methods.) When I run this as a stand-alone program, my results show an average invocation time of about 3 - 4ms. When I run the same program as a web app (tomcat 4.0.1, or 4.0.4) I'm seeing averages around 80 ms. JProbe confirms that cpu time is primarily spent in sun.rmi.server.UnicastRef.invoke( ) I don't have the sun.rmi source right now (I've looked on Sun One, but can't find it -- anyone know the URL?), so I don't have any idea what's the hang up. Anyone have insight into this? I saw a similar thread msg77001 RMI Class Annotation, in which a fellow sees 800 ms per invocation for his test, but he was talking about JBoss, and huge classpaths. Or, am I having the same problem? (I don't know anything about RMIClassLoader.getClassAnnotation(), which he says delivers 35K bytes from server to client in his situation.) Thanks, Mike Arachtingi - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: RMI Performance problem
Hello, Mike Arachtingi, When I run this as a stand-alone program, my results show an average invocation time of about 3 - 4ms. When I run the same program as a web app (tomcat 4.0.1, or 4.0.4) I'm seeing averages around 80 ms. 80ms doesn't sound too slow to me! But you've made a very interesting observation. I don't have much experience with RMI, and I've never looked at Tomcat's source code. But this is a mailing list, so I don't see why these facts should stop me from writing a response! ;-) In your Test program, I would try starting up a second do nothing thread before you run your RMI test. All it would do in its run() method is this: while ( true ) { synchronized( this ) { wait( 10 ); } } With that running, how much slower is your RMI test? Tomcat is somehow always listening on 1 or more ports for incoming requests... (that code is probably not in Tomcat, but in the JDK Socket stuff...) Those have got to eat up a few resources. Now, I don't imagine my do nothing thread is an accurate simulation of a web server waiting for incoming requests, but it must be better than nothing! yours, Julius Davies, Programmer, CUCBC Email: [EMAIL PROTECTED], Ph: 604.730.6385 ps to Derek: any thoughts? -Original Message- From: Arachtingi, Mike [mailto:[EMAIL PROTECTED]] Sent: Friday, January 31, 2003 2:07 PM To: [EMAIL PROTECTED] Subject: RMI Performance problem Has anyone noticed a performance problem, using RMI from within a web app? I developed a test program that looks up a remote object, and sends it 99 messages (i.e., invokes one of the remote methods.) When I run this as a stand-alone program, my results show an average invocation time of about 3 - 4ms. When I run the same program as a web app (tomcat 4.0.1, or 4.0.4) I'm seeing averages around 80 ms. JProbe confirms that cpu time is primarily spent in sun.rmi.server.UnicastRef.invoke( ) I don't have the sun.rmi source right now (I've looked on Sun One, but can't find it -- anyone know the URL?), so I don't have any idea what's the hang up. Anyone have insight into this? I saw a similar thread msg77001 RMI Class Annotation, in which a fellow sees 800 ms per invocation for his test, but he was talking about JBoss, and huge classpaths. Or, am I having the same problem? (I don't know anything about RMIClassLoader.getClassAnnotation(), which he says delivers 35K bytes from server to client in his situation.) Thanks, Mike Arachtingi - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: RMI Performance problem
Just drop a comment. Between 4 ms to 80ms, netword traffic could be effect too. You might consider run the script a couple more times to check if there is a difference. -Original Message- From: Arachtingi, Mike [mailto:[EMAIL PROTECTED]] Sent: Friday, January 31, 2003 2:07 PM To: [EMAIL PROTECTED] Subject: RMI Performance problem Has anyone noticed a performance problem, using RMI from within a web app? I developed a test program that looks up a remote object, and sends it 99 messages (i.e., invokes one of the remote methods.) When I run this as a stand-alone program, my results show an average invocation time of about 3 - 4ms. When I run the same program as a web app (tomcat 4.0.1, or 4.0.4) I'm seeing averages around 80 ms. JProbe confirms that cpu time is primarily spent in sun.rmi.server.UnicastRef.invoke( ) I don't have the sun.rmi source right now (I've looked on Sun One, but can't find it -- anyone know the URL?), so I don't have any idea what's the hang up. Anyone have insight into this? I saw a similar thread msg77001 RMI Class Annotation, in which a fellow sees 800 ms per invocation for his test, but he was talking about JBoss, and huge classpaths. Or, am I having the same problem? (I don't know anything about RMIClassLoader.getClassAnnotation(), which he says delivers 35K bytes from server to client in his situation.) Thanks, Mike Arachtingi
RE: RMI Class Annotation
Interesting problem. You're right that the java.server.rmi.codebase property is ignored in Tomcat. The property is only used by the RMIClassloader when a class's loader has no obvious codebase property. If the classloader extends from URLClassLoader, as Tomcat's WebAppClassloader does, then the value of getURLs() is used for the annotation. In the case of Tomcat, that annotation will include everything in WEB-INF/lib, common/lib, etc. For RMI purposes, it's entirely useless anyway, since it doesn't contain a url to your publicly accessible classes for RMI download. There's a way to add a real codebase (check in the tomcat-dev archives), but you can't get rid of the stuff that's already there. I've thought about writing a modified WebAppClasslLoader to support RMI better, but I don't want the support headaches! Workaround: Check which classes you're sending down the pipe (they're probably arguments to an RMI method call). Could you have the instances created on the RMI server and sent to you? They would then have the server's codebase annotation rather than yours. This should also work with a factory object that gets sent to you by the RMI server, so long as the classes are not available in the local classpath. Repeat -- The classes used as arguments in your RMI method calls should not be available in your local WEB-INF/lib directory (although they'll have to implement interfaces that are available locally). I suppose you could also create a URLClassLoader pointing to your codebase and use it to create your instances, but it seems like a lot of work, plus you still have the need to implement locally-available interfaces. Hope this helps, Greg Trasuk, President StratusCom Manufacturing Systems Inc. - We use information technology to solve business problems on your plant floor. http://stratuscom.ca -Original Message- From: David Esposito [mailto:[EMAIL PROTECTED]] Sent: December 09, 2002 10:18 To: [EMAIL PROTECTED] Subject: RMI Class Annotation Hello all, My problem is this: I am running Tomcat 4.1 as an embedded service in JBOSS 3.0.4 ... One of my servlets makes an RMI call to an RMI server running on a different box. The problem is that the classpath that JBOSS creates (and Tomcat inherits, i believe) is so large that it actually has an impact on the performance of the RMI method invocation. That is, the value returned by RMIClassLoader.getClassAnnotation() is over 35kilobytes!! Here's just a brief snippet: file:/C:/jboss-3.0.4-tomcat/tomcat-4.1.x/work/MainEngine/localh ost/testjms/W EB-INF/classes/ file:/C:/jboss-3.0.4-tomcat/tomcat-4.1.x/work/MainEngine/localh ost/testjms/W EB-INF/lib/jbossall-client.jar file:/C:/jboss-3.0.4-tomcat/tomcat-4.1.x/work/MainEngine/localh ost/testjms/W EB-INF/lib/log4j.jar file:/C:/jboss-3.0.4-tomcat/server/default/tmp/deploy/tomcat-4. 1.x/common/li b/naming-common.jar/81.naming-common.jar file:/C:/jboss-3.0.4-tomcat/server/default/tmp/deploy/server/de fault/lib/jnp server.jar/17.jnpserver.jar file:/C:/jboss-3.0.4-tomcat/server/default/tmp/deploy/tomcat-4. 1.x/server/li b/tomcat-jk.jar/85.tomcat-jk.jar file:/C:/jboss-3.0.4-tomcat/server/default/tmp/deploy/server/default/lib/cou nter-plugin.jar/38.counter-plugin.jar file:/C:/jboss-3.0.4-tomcat/tomcat-4.1.x/server/classes/ file:/C:/jboss-3.0.4-tomcat/server/default/tmp/deploy/server/default/deploy/ jca-service.xml/45.jca-service.xml file:/C:/jboss-3.0.4-tomcat/server/default/tmp/deploy/tomcat-4.1.x/server/li b/commons-modeler.jar/86.commons-modeler.jar file:/C:/jboss-3.0.4-tomcat/server/default/tmp/deploy/server/default/lib/jbo ssmx.jar/2.jbossmx.jar file:/C:/jboss-3.0.4-tomcat/server/default/tmp/deploy/server/default/lib/jbo ss-j2ee.jar/16.jboss-j2ee.jar file:/C:/jboss-3.0.4-tomcat/server/default/tmp/deploy/server/default/lib/mai l-plugin.jar/20.mail-plugin.jar This turns a 20ms RMI method invocation (when invoked from a standalone java application) into a 800ms RMI method invocation (when invoked from the servlet) because of all of the upstream bandwidth that is required ... Needless to say, this is a problem ... Does anyone have any input? I read a few messages that were posted about this problem and someone commented that Tomcat is not behaving correctly; that is, it's using the webapp's classloader's classpath instead of the RMI codebase's classpath ... It seems to me that the RMIClassLoader should only be concerned with classpaths set in the java.rmi.server.codebase? Thanks in advance, Dave -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: RMI and Tomcat
You don't want your remote application's classes to be resident in the access webapp. I'd suggest we go back to the original problem and try to solve that; take the application classes out of examples/WEB-IF/classes. (Aside-- While you're at it, it's worth taking an hour or two to download Ant, look at the Application Developer docs and sample build.xml included in the Tomcat distribution, and set up your own webapp to get out of /examples. It's not that hard, and it makes development much smoother!) The original problem looks like the RMIClassLoader can't find the code for MyAppStarter. Are you passing or returning an instance of MyAppStarter as an argument in the RMI call to the server app, or is the server object an instance of MyAppStarter? In either case, do you have the codebase property set on the RMI server JVM? The system property java.rmi.server.codebase needs to refer to a set of URLs from which classes used in the RMI call can be downloaded. By extension, you need to have those classes available on some sort of a server, typically ftp or http. Tomcat'll do it! If the codebase is set properly and the download files are available, a webapp in Tomcat can execute RMI calls on a remote object. There's one not-so-small detail left, though; the class loader (RMIClassLoader) that wants to load the remote bytecode will refuse to work if there's no security manager, so you need to run Tomcat with the security manager enabled, which will also require setting up the security.properties file to allow whatever permissions your application needs. See the Security Manager HOWTO in the Tomcat docs. In your case, you didn't get RMIClassLoader's exception, so I suspect the codebase problem. Note that it's a little awkward to set the codebase on a webapp, so it's difficult (i.e. possible, but not elegant and not portable) to export remote objects from a webapp. I'd say this isn't a Tomcat limitation, so much as a case of the servlet spec not being written with RMI in mind. If you need to support callbacks from the remote application, you need to employ a proxy strategy. You might want to look at jini.org for more information on the proxy concept. Greg Trasuk, President StratusCom Manufacturing Systems Inc. - We use information technology to solve business problems on your plant floor. http://stratuscom.ca -Original Message- From: news [mailto:[EMAIL PROTECTED]]On Behalf Of Bill Barker Sent: November 27, 2002 00:47 To: [EMAIL PROTECTED] Subject: Re: RMI and Tomcat This is starting to look like a classic case of bad design. But to get your app working, try adding servlet.jar to the CLASSPATH of rmiregistry. Sarah L. Moore [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Well, I just moved the application classes over to the examples/WEB-INF/classes directory and re-ran my servlet. I get a slightly different message: java.rmi.ServerError: Error occurred in server thread; nested exception is: java.lang.NoClassDefFoundError: javax/servlet/ServletRequest From the output of my application, it looks as though the application begins to run, but it is the servlet that is throwing the above exception upon the call to the RMI application. I did a search for servlet.jar, and it looks as though it is where it should be in the Tomcat directory structure (i.e. catalina_home/common/lib). Any other advice? I'm at a total loss. Thanks again! Sarah At 11:30 AM 11/27/2002 +0800, you wrote: Sorry, did not correctly see which class it was complaining about. Try and move MyApplicationStarter to the said directories. Sarah L. Moore wrote: Thanks for your reply. My servlet class is in examples/WEB-INF/classes. If I comment out the RMI step, the servlet runs fine, so I'm left to think that the servlet location, etc. are OK, but something relating to RMI is the culprit. At 11:01 AM 11/27/2002 +0800, you wrote: Cannot allocate servlet instance for path /examples/servlet/MyServlet means that it can't find the requested servlet for that web app which implies that your servlet class isn't where it should be. Servlets classes go in /examples/WEB-INF/classes or /examples/WEB-INF/lib for jar packages. Sarah L. Moore wrote: Hello all. I am new to Tomcat, and am having a problem with RMI. I have a Java application that basically just sits on my server waiting for a data vector to be passed to it from my servlet. However, when I run the servlet and try to have it pass the data to the application through RMI, I get: javax.servlet.ServletException: Cannot allocate servlet instance for path /examples/servlet/MyServlet java.lang.NoClassDefFoundError: MyApplicationStarter The application resides in a directory on the root of the c drive (i.e. c:\MyApplication), and the servlet I am working with is in catalina_home/webapps/examples. Could it be that my problem is due to the fact tha
Re: RMI and Tomcat
Cannot allocate servlet instance for path /examples/servlet/MyServlet means that it can't find the requested servlet for that web app which implies that your servlet class isn't where it should be. Servlets classes go in /examples/WEB-INF/classes or /examples/WEB-INF/lib for jar packages. Sarah L. Moore wrote: Hello all. I am new to Tomcat, and am having a problem with RMI. I have a Java application that basically just sits on my server waiting for a data vector to be passed to it from my servlet. However, when I run the servlet and try to have it pass the data to the application through RMI, I get: javax.servlet.ServletException: Cannot allocate servlet instance for path /examples/servlet/MyServlet java.lang.NoClassDefFoundError: MyApplicationStarter The application resides in a directory on the root of the c drive (i.e. c:\MyApplication), and the servlet I am working with is in catalina_home/webapps/examples. Could it be that my problem is due to the fact that Tomcat can't locate the classes that are in the c:\MyApplication directory? How can I remidy that problem, if that is, in fact, the problem. I am running Tomcat 4 with jdk 1.3.1 on Win2K. Please let me know if you need any more information. Any help would be appreciated. Thanks! Sarah -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: RMI and Tomcat
Thanks for your reply. My servlet class is in examples/WEB-INF/classes. If I comment out the RMI step, the servlet runs fine, so I'm left to think that the servlet location, etc. are OK, but something relating to RMI is the culprit. At 11:01 AM 11/27/2002 +0800, you wrote: Cannot allocate servlet instance for path /examples/servlet/MyServlet means that it can't find the requested servlet for that web app which implies that your servlet class isn't where it should be. Servlets classes go in /examples/WEB-INF/classes or /examples/WEB-INF/lib for jar packages. Sarah L. Moore wrote: Hello all. I am new to Tomcat, and am having a problem with RMI. I have a Java application that basically just sits on my server waiting for a data vector to be passed to it from my servlet. However, when I run the servlet and try to have it pass the data to the application through RMI, I get: javax.servlet.ServletException: Cannot allocate servlet instance for path /examples/servlet/MyServlet java.lang.NoClassDefFoundError: MyApplicationStarter The application resides in a directory on the root of the c drive (i.e. c:\MyApplication), and the servlet I am working with is in catalina_home/webapps/examples. Could it be that my problem is due to the fact that Tomcat can't locate the classes that are in the c:\MyApplication directory? How can I remidy that problem, if that is, in fact, the problem. I am running Tomcat 4 with jdk 1.3.1 on Win2K. Please let me know if you need any more information. Any help would be appreciated. Thanks! Sarah -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: RMI and Tomcat
Sorry, did not correctly see which class it was complaining about. Try and move MyApplicationStarter to the said directories. Sarah L. Moore wrote: Thanks for your reply. My servlet class is in examples/WEB-INF/classes. If I comment out the RMI step, the servlet runs fine, so I'm left to think that the servlet location, etc. are OK, but something relating to RMI is the culprit. At 11:01 AM 11/27/2002 +0800, you wrote: Cannot allocate servlet instance for path /examples/servlet/MyServlet means that it can't find the requested servlet for that web app which implies that your servlet class isn't where it should be. Servlets classes go in /examples/WEB-INF/classes or /examples/WEB-INF/lib for jar packages. Sarah L. Moore wrote: Hello all. I am new to Tomcat, and am having a problem with RMI. I have a Java application that basically just sits on my server waiting for a data vector to be passed to it from my servlet. However, when I run the servlet and try to have it pass the data to the application through RMI, I get: javax.servlet.ServletException: Cannot allocate servlet instance for path /examples/servlet/MyServlet java.lang.NoClassDefFoundError: MyApplicationStarter The application resides in a directory on the root of the c drive (i.e. c:\MyApplication), and the servlet I am working with is in catalina_home/webapps/examples. Could it be that my problem is due to the fact that Tomcat can't locate the classes that are in the c:\MyApplication directory? How can I remidy that problem, if that is, in fact, the problem. I am running Tomcat 4 with jdk 1.3.1 on Win2K. Please let me know if you need any more information. Any help would be appreciated. Thanks! Sarah -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: RMI and Tomcat
Well, I just moved the application classes over to the examples/WEB-INF/classes directory and re-ran my servlet. I get a slightly different message: java.rmi.ServerError: Error occurred in server thread; nested exception is: java.lang.NoClassDefFoundError: javax/servlet/ServletRequest From the output of my application, it looks as though the application begins to run, but it is the servlet that is throwing the above exception upon the call to the RMI application. I did a search for servlet.jar, and it looks as though it is where it should be in the Tomcat directory structure (i.e. catalina_home/common/lib). Any other advice? I'm at a total loss. Thanks again! Sarah At 11:30 AM 11/27/2002 +0800, you wrote: Sorry, did not correctly see which class it was complaining about. Try and move MyApplicationStarter to the said directories. Sarah L. Moore wrote: Thanks for your reply. My servlet class is in examples/WEB-INF/classes. If I comment out the RMI step, the servlet runs fine, so I'm left to think that the servlet location, etc. are OK, but something relating to RMI is the culprit. At 11:01 AM 11/27/2002 +0800, you wrote: Cannot allocate servlet instance for path /examples/servlet/MyServlet means that it can't find the requested servlet for that web app which implies that your servlet class isn't where it should be. Servlets classes go in /examples/WEB-INF/classes or /examples/WEB-INF/lib for jar packages. Sarah L. Moore wrote: Hello all. I am new to Tomcat, and am having a problem with RMI. I have a Java application that basically just sits on my server waiting for a data vector to be passed to it from my servlet. However, when I run the servlet and try to have it pass the data to the application through RMI, I get: javax.servlet.ServletException: Cannot allocate servlet instance for path /examples/servlet/MyServlet java.lang.NoClassDefFoundError: MyApplicationStarter The application resides in a directory on the root of the c drive (i.e. c:\MyApplication), and the servlet I am working with is in catalina_home/webapps/examples. Could it be that my problem is due to the fact that Tomcat can't locate the classes that are in the c:\MyApplication directory? How can I remidy that problem, if that is, in fact, the problem. I am running Tomcat 4 with jdk 1.3.1 on Win2K. Please let me know if you need any more information. Any help would be appreciated. Thanks! Sarah -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: RMI and Tomcat
This is starting to look like a classic case of bad design. But to get your app working, try adding servlet.jar to the CLASSPATH of rmiregistry. Sarah L. Moore [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Well, I just moved the application classes over to the examples/WEB-INF/classes directory and re-ran my servlet. I get a slightly different message: java.rmi.ServerError: Error occurred in server thread; nested exception is: java.lang.NoClassDefFoundError: javax/servlet/ServletRequest From the output of my application, it looks as though the application begins to run, but it is the servlet that is throwing the above exception upon the call to the RMI application. I did a search for servlet.jar, and it looks as though it is where it should be in the Tomcat directory structure (i.e. catalina_home/common/lib). Any other advice? I'm at a total loss. Thanks again! Sarah At 11:30 AM 11/27/2002 +0800, you wrote: Sorry, did not correctly see which class it was complaining about. Try and move MyApplicationStarter to the said directories. Sarah L. Moore wrote: Thanks for your reply. My servlet class is in examples/WEB-INF/classes. If I comment out the RMI step, the servlet runs fine, so I'm left to think that the servlet location, etc. are OK, but something relating to RMI is the culprit. At 11:01 AM 11/27/2002 +0800, you wrote: Cannot allocate servlet instance for path /examples/servlet/MyServlet means that it can't find the requested servlet for that web app which implies that your servlet class isn't where it should be. Servlets classes go in /examples/WEB-INF/classes or /examples/WEB-INF/lib for jar packages. Sarah L. Moore wrote: Hello all. I am new to Tomcat, and am having a problem with RMI. I have a Java application that basically just sits on my server waiting for a data vector to be passed to it from my servlet. However, when I run the servlet and try to have it pass the data to the application through RMI, I get: javax.servlet.ServletException: Cannot allocate servlet instance for path /examples/servlet/MyServlet java.lang.NoClassDefFoundError: MyApplicationStarter The application resides in a directory on the root of the c drive (i.e. c:\MyApplication), and the servlet I am working with is in catalina_home/webapps/examples. Could it be that my problem is due to the fact that Tomcat can't locate the classes that are in the c:\MyApplication directory? How can I remidy that problem, if that is, in fact, the problem. I am running Tomcat 4 with jdk 1.3.1 on Win2K. Please let me know if you need any more information. Any help would be appreciated. Thanks! Sarah -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: RMI and TC4.x (Really classloader stuff)
Thanks for your comments Greg. Now at least I know what's going on. I'm going to attach these comments to the bug log. Thanks. Dave. -Original Message- From: Greg Trasuk [mailto:[EMAIL PROTECTED]] Sent: 10 August 2002 04:54 To: 'Tomcat Users List' Subject: RE: RMI and TC4.x (Really classloader stuff) Hi David: I'm in the same boat trying to use RMI and/or Jini from Tomcat. This isn't a complete answer to your question, as I'm still investigating the issue, but I'm posting what I know so far in the hope that it might help in your own solution, and also generate discussion that will guide my exploration. When all is said and done, if there's interest, I can post a Catalina-RMI HOWTO sort of document. Although I didn't try to run the test case that you attached to your bug report, I did take a look at it, and I think I know what's going on. Here's what I know so far (most of which you probably know already, but I'm summarizing for other folks on the list): When you pass an instance of some Serializable class as an argument to an RMI call (e.g. passing a command object, as in your test case), the RMI subsystem will serialize the object with an additional annotation indicating the locations from which the class's bytecode can be downloaded. When you pass an exported object (e.g. a server object or an object that will receive callbacks from remote objects), the RMI subsystem creates and serializes a proxy object (otherwise known as the RMI stub object) in place of the actual object. In either case, the remote RMI subsystem has to load the class that is called out in the serialized instance. It does this by calling the RMIClassLoader. The RMIClassLoader object first tries to find the class locally (i.e. in the default classloader). If it can't find it locally, it searches in the list of locations contained in the annotation mentioned above. If the required class is available locally, no further headaches are caused, which may be why some people have had no problems using RMI under Tomcat - they probably had the serialized classes and/or proxy classes in the standard classpath/classloader setup. And there we find our problem. (At this point you might want to have a look at the JSP snippet below) The annotation is determined by RMIClassLoader. According to the RMI and Object Serialization FAQ in the JDK1.31 API docs, If the _Stub class was loaded by an RMIClassLoader, then RMI already knows which codebase to use for its annotation. If the _Stub class was loaded from the CLASSPATH, then there is no obvious codebase, and RMI consults the java.rmi.server.codebase system property to find the codebase. If the system property is not set, then the stub is marshalled with a null codebase, which means that it cannot be used unless the client has a matching copy of the _Stub classfile in the client's CLASSPATH. If we're running a standalone application (and I believe also in Tomcat 3.x), we're using the system class loader, which has no obvious codebase, so the java.rmi.server.codebase property gets used. But what's the class loader used in Tomcat 4.x? I looked at the source code for Tomcat 4.0.1 (happens to be what I have on hand), and o.a.c.loader.WebAppClassLoader extends from o.a.c.loader.StandardClassLoader, which extends from java.net.URLClassLoader, which has a method called getURLs(). The WebAppClassLoader.getURLs() method returns a list of all the repositories it will search when trying to load a class on behalf of the web app. This list calls out all the jar's in WEB-INF/lib, common/lib, etc. Having not seen the source for RMIClassLoader, I suspect that the getClassAnnotation(..) method checks to see if the classloader for the supplied class is a URLClassLoader, and if so, uses the results of the getURLs() method call as an obvious codebase. This suspicion is supported by the last part of the JSP, where I create a classloader that extends from URLClassLoader but overrides getURLs() to return a phony url. The phony url shows up as the class's annotation. So the exact error you quoted in the bug report shows something about a protocol missing MalformedURL exception, which is caused by the fact that the urls to the repositories contain spaces, since the RMI annotation is supposed to be a space-separated list of URL's. Thus the annotation doesn't get parsed properly. This may be a bug in Catalina's class loader (i.e. should the returned urls have the spaces encoded to '%20'?) or possibly in the way RMIClassLoader uses the results of getURLs(). But it's not the problem. The problem is how to get our codebase into the annotation. Clearly the java.rmi.server.codebase property is not used, since the class loader has a codebase. But setting a system property doesn't feel right to me anyway, since in a webapp scenario
RE: RMI and TC4.x (Really classloader stuff)
I am not familiar with RMI, but I have looked at the classloaders. The classloader overview is defined in the classloader document. There are two instances of StandardClassLoader that are used by webapps, 'shared' and 'common'. Then each webapp has its own WebappClassLoader instance. If the WebappClassLoader can not find a class then it delegates to the 'shared' instance of StandardClassLoader, which then can delegate to the 'common' instance. Are you by chance passing a Hashtable,Vector,etc that contain instances of your classes? If so you may want to see this thread from last week which also had a problem serializing objects(although not with RMI): http://www.mail-archive.com/tomcat-user@jakarta.apache.org/msg61929.html For (2) below: This is difficult because classes loaded by the WebappClassLoader will not know about the classes that you load. This is why you get ClassNotfoundExceptions. It may help to set the current classloader as the parent for your new classloader, so that class requests can be delegated. For (3) below: This is what the WebappClassLoader already does. The webapp specific things are in the /WEB-INF/lib, which you said was returned by getUrls(). I looked at the bug listed previously. does the stack trace change when you have no spaces in the tomcat path? Charlie -Original Message- From: Greg Trasuk [mailto:[EMAIL PROTECTED]] Sent: Friday, August 09, 2002 11:54 PM To: 'Tomcat Users List' Subject: RE: RMI and TC4.x (Really classloader stuff) Hi David: I'm in the same boat trying to use RMI and/or Jini from Tomcat. This isn't a complete answer to your question, as I'm still investigating the issue, but I'm posting what I know so far in the hope that it might help in your own solution, and also generate discussion that will guide my exploration. When all is said and done, if there's interest, I can post a Catalina-RMI HOWTO sort of document. Although I didn't try to run the test case that you attached to your bug report, I did take a look at it, and I think I know what's going on. Here's what I know so far (most of which you probably know already, but I'm summarizing for other folks on the list): When you pass an instance of some Serializable class as an argument to an RMI call (e.g. passing a command object, as in your test case), the RMI subsystem will serialize the object with an additional annotation indicating the locations from which the class's bytecode can be downloaded. When you pass an exported object (e.g. a server object or an object that will receive callbacks from remote objects), the RMI subsystem creates and serializes a proxy object (otherwise known as the RMI stub object) in place of the actual object. In either case, the remote RMI subsystem has to load the class that is called out in the serialized instance. It does this by calling the RMIClassLoader. The RMIClassLoader object first tries to find the class locally (i.e. in the default classloader). If it can't find it locally, it searches in the list of locations contained in the annotation mentioned above. If the required class is available locally, no further headaches are caused, which may be why some people have had no problems using RMI under Tomcat - they probably had the serialized classes and/or proxy classes in the standard classpath/classloader setup. And there we find our problem. (At this point you might want to have a look at the JSP snippet below) The annotation is determined by RMIClassLoader. According to the RMI and Object Serialization FAQ in the JDK1.31 API docs, If the _Stub class was loaded by an RMIClassLoader, then RMI already knows which codebase to use for its annotation. If the _Stub class was loaded from the CLASSPATH, then there is no obvious codebase, and RMI consults the java.rmi.server.codebase system property to find the codebase. If the system property is not set, then the stub is marshalled with a null codebase, which means that it cannot be used unless the client has a matching copy of the _Stub classfile in the client's CLASSPATH. If we're running a standalone application (and I believe also in Tomcat 3.x), we're using the system class loader, which has no obvious codebase, so the java.rmi.server.codebase property gets used. But what's the class loader used in Tomcat 4.x? I looked at the source code for Tomcat 4.0.1 (happens to be what I have on hand), and o.a.c.loader.WebAppClassLoader extends from o.a.c.loader.StandardClassLoader, which extends from java.net.URLClassLoader, which has a method called getURLs(). The WebAppClassLoader.getURLs() method returns a list of all the repositories it will search when trying to load a class on behalf of the web app. This list calls out all the jar's in WEB-INF/lib, common/lib, etc. Having not seen the source for RMIClassLoader, I
RE: RMI and TC4.x (Really classloader stuff)
permissions). Options as I see them: (1)-Use an object factory approach to create instances of classes. If we get the factory object from the RMI server, it and all the instances it creates will have the server's codebase property already set, which skirts the whole issue. It won't allow us to use locally-defined inner classes, however, so it's not great for callback objects (although I suspect we could have the created object call back to a local object) (2)-Load our local classes explicitly through a classloader that returns our codebase. This is what I did in the last part of the test case. It seems like a pain in the butt, and also caused ClassCastExceptions, which is why the reference is to an Object. (3)-Replace the context's classloader with a class loader that adds a webapp-specific codebase to the repositories it lists. I'm thinking of having a property defined in the application context to specify the codebase. There's already provision in server.xml to specify an alternate webapp classloader. Downside is that the application is then Tomcat-specific (not that anyone would want to use any other container...). I suspect that using RMI purely as a client (i.e. with no local objects exported) and passing only instances of classes on the local classpath of both client and server (e.g. java.* classes) would work just fine, with no codebase issues at all, but I've yet to try it out. Ideas and comments, anyone? Greg Trasuk, President StratusCom Manufacturing Systems Inc. - We use information technology to solve business problems on your plant floor. http://stratuscom.ca test-case apology=I know it's ugly code %@page import=ca.stratuscom.TestWebapp.SampleClass % %@page import=java.rmi.server.RMIClassLoader % %@page import=java.util.Date % %@page import=java.rmi.RMISecurityManager % %@page import=java.net.URL % %@page import=java.net.URLClassLoader % %! private class MyLoader extends URLClassLoader { public URL[] getURLs() { URL retval=null; try { retval=new URL(http://bob/fred.jar;); } catch (Exception e) {} return new URL[] { retval }; } MyLoader(URL urls[]) { super(urls); } } % !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN html head title/title /head body h1Show Annotation for locally created class/h1 % /* System.setSecurityManager(new RMISecurityManager()); */ String codebase=http://localhost:8080/TestWebapp/TestWebapp.jar;; Date dt=new Date(); /*System.setProperty(java.rmi.server.codebase,codebase);*/ String annotation=RMIClassLoader.getClassAnnotation(dt.getClass()); SampleClass sample=new SampleClass(); String sampleAnnotation= RMIClassLoader.getClassAnnotation(sample.getClass()); % Annotation for a Date instance is %=annotation%. br Annotation for a SampleClass instance is %=sampleAnnotation%. hr % Class sampCls=RMIClassLoader.loadClass(codebase,ca.stratuscom.TestWebapp.SampleCl ass); SampleClass rmiSamp=(SampleClass) sampCls.newInstance(); String localSampAnnotation= RMIClassLoader.getClassAnnotation(rmiSamp.getClass()); % br Annotation for localSamp loaded through RMIClassLoader is %=localSampAnnotation% hr % URL codebaseURL=new URL(codebase); URL loaderURLs[]=new URL[] {codebaseURL}; URLClassLoader urlLoader=new URLClassLoader(loaderURLs); Class urlCls=urlLoader.loadClass(ca.stratuscom.TestWebapp.SampleClass); Object urlSamp= urlCls.newInstance(); String urlSampAnnotation= RMIClassLoader.getClassAnnotation(urlSamp.getClass()); % br Annotation for localSamp loaded through URLClassLoader is %=urlSampAnnotation% hr % MyLoader myLoader=new MyLoader(loaderURLs); Class myCls=myLoader.loadClass(ca.stratuscom.TestWebapp.SampleClass); Object mySamp= myCls.newInstance(); String mySampAnnotation= RMIClassLoader.getClassAnnotation(mySamp.getClass()); % br Annotation for localSamp loaded through MyLoader is %=mySampAnnotation% hr addressa href=mailto:trasukg@THINKPAD;/a/address !-- Created: Wed Jul 31 09:17:33 Eastern Daylight Time 2002 -- !-- hhmts start -- Last modified: Fri Aug 09 01:01:14 Eastern Daylight Time 2002 !-- hhmts end -- /body /html -- In SampleClass.java package ca.stratuscom.TestWebapp; public class SampleClass {} /test-case -Original Message- From: David Oxley [mailto:[EMAIL PROTECTED]] Sent: July 23, 2002 05:36 To: 'Tomcat Users List' Subject: RE: RMI and TC4.x It does actually connect to the RMI server, but it can't download classes from the web server. It looks like java.rmi.codebase = TC local path rather than http://server/webapp which iks what the code sets it to. Dave -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED]] Sent: 22 July 2002 18:25 To: Tomcat
RE: RMI and TC4.x
It does actually connect to the RMI server, but it can't download classes from the web server. It looks like java.rmi.codebase = TC local path rather than http://server/webapp which iks what the code sets it to. Dave -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED]] Sent: 22 July 2002 18:25 To: Tomcat Users List Subject: RE: RMI and TC4.x Howdy, We use RMI extensively on long-running tomcat servers (4.0.1 and 4.0.4). Never had any problems with it. We even have a portion of the night when we do very frequent (more than 1/sec) serialization and deserialization of relatively large, complex (but serializable) objects between a number of servers. We also use JDK 1.4.0 (also tested on 1.3.1), on Solaris. I looked at your bugzilla bug report, and it looked like a fairly simple MalformedURLException. I wonder if this bug is related to a difference between tc 3.x and 4.x in the way they handle spaces in JNDI/RMI server URLs. Did you try using tomcat 4.x to connect to an RMI server that doesn't have a space in its URL? Yoav Shapira Millennium ChemInformatics -Original Message- From: David Oxley [mailto:[EMAIL PROTECTED]] Sent: Monday, July 22, 2002 12:59 PM To: 'Tomcat Users List' Subject: RMI and TC4.x Has anyone got RMI working from within TC4.x. I had no problems under TC3.x, but just can't get it working under TC4.x. I have had a bug report outstanding for quite some time on this, but I was hoping that someone on the user list may have already got this working. http://issues.apache.org/bugzilla/show_bug.cgi?id=7082 http://issues.apache.org/bugzilla/show_bug.cgi?id=7082 Cheers. Dave. -- To unsubscribe, e-mail: mailto:tomcat-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:tomcat-user- [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: RMI and TC4.x
Howdy, We use RMI extensively on long-running tomcat servers (4.0.1 and 4.0.4). Never had any problems with it. We even have a portion of the night when we do very frequent (more than 1/sec) serialization and deserialization of relatively large, complex (but serializable) objects between a number of servers. We also use JDK 1.4.0 (also tested on 1.3.1), on Solaris. I looked at your bugzilla bug report, and it looked like a fairly simple MalformedURLException. I wonder if this bug is related to a difference between tc 3.x and 4.x in the way they handle spaces in JNDI/RMI server URLs. Did you try using tomcat 4.x to connect to an RMI server that doesn't have a space in its URL? Yoav Shapira Millennium ChemInformatics -Original Message- From: David Oxley [mailto:[EMAIL PROTECTED]] Sent: Monday, July 22, 2002 12:59 PM To: 'Tomcat Users List' Subject: RMI and TC4.x Has anyone got RMI working from within TC4.x. I had no problems under TC3.x, but just can't get it working under TC4.x. I have had a bug report outstanding for quite some time on this, but I was hoping that someone on the user list may have already got this working. http://issues.apache.org/bugzilla/show_bug.cgi?id=7082 http://issues.apache.org/bugzilla/show_bug.cgi?id=7082 Cheers. Dave. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: RMI Server in Tomcat problems
High Weber, try System.setSecurityManager(new RMISecurityManager(fully qualified name of you're security file)); Lance -Original Message- From: Jürgen Weber [mailto:[EMAIL PROTECTED]] Sent: Friday, April 12, 2002 7:33 AM To: [EMAIL PROTECTED] Subject: RMI Server in Tomcat problems Hi I tried to set up an RMI server in tomcat 4.03 First problem is, there seems to be no possibility to have something in tomcat like weblogics startup classes, i.e. classes that are called at server startup. So I had to trigger a servlet by hand that does the initialisation and registry of the RMI server. Tomcat and RMI client both on my NT machine worked. On different machines the client gets the exception below. Running the RMI Server in a stand-alone VM outside of tomcat works. First I had the following, if (null == System.getSecurityManager()) System.setSecurityManager(new RMISecurityManager()); but it would not be called as tomcat already has a SecurityManager. So I left the if - part but still no change. So I wonder, if it is possible to have an RMI Server in Tomcat at all? I started with catalina start -security. catalina.policy is only grant { permission java.security.AllPermission; }; [java] java.rmi.ConnectException: Connection refused to host: localhost; nested exception is: [java] java.net.ConnectException: Connection refused: connect [java] at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:567) [java] at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185) [java] at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171) [java] at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:101) [java] at webservice.rmiserver.RMIServerImpl_Stub.register(Unknown Source) [java] at .webservice.rmiclient.RMIClientImpl.main(RMIClientImpl.java:110) [java] Caused by: java.net.ConnectException: Connection refused: connect [java] at java.net.PlainSocketImpl.socketConnect(Native Method) [java] at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:295) [java] at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:161) [java] at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:148) [java] at java.net.Socket.connect(Socket.java:425) [java] at java.net.Socket.connect(Socket.java:375) [java] at java.net.Socket.init(Socket.java:290) [java] at java.net.Socket.init(Socket.java:118) [java] at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketF actory.java:22) [java] at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketF actory.java:122) [java] at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:562) [java] ... 5 more [java] Java Result: 1 _ Downloaden Sie MSN Explorer kostenlos unter http://explorer.msn.de/intl.asp. -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Re: RMI remote Method which returns File object.
Sucharitha: A File object represents a files name (and location). It does not represent or store the contents of a file. Therefore, using RMI to pass a File object around doesn't make much sense. It is likely that a File object that points to a valid file on the client is completely invalid on the server. Worse yet, it is valid, but points to a different copy of the file. If you need to transfer a file from one side of an RMI connection to another, you'll need to read the file into a buffer of some sort and pass that across your RMI interface. This explains why your client program only works when you run it on the same computer as your server. Tom - Original Message - From: Sucharitha Panthika [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Wednesday, February 06, 2002 5:16 PM Subject: RMI remote Method which returns File object. Hey I have a qution using RMI to return files . If I have a a remote method public File getFile(); method in a Server and I implemented this method to return one file from my local drive C:\. When the remote Client from different system calls this method should it return the my File to that Client or not. i have give allpermission in the policy files. I have similar example. When I run the Client from a different system I don't get the File object instead when I run the Client from myy system in another window without the required classes in the classpath I get the File. Can Any one let me know what could be the problem? I am attaching the Server, ServerImpl, Client and policy files for review if required. Sucharitha -Original Message- From: Gearoid Coughlan [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 06, 2002 3:32 PM To: 'Tomcat Users List' Subject: tomcat 4.0 + apache 1.3.12 + mod_jk Hi I am getting the following error reported in mod_jk.log when executing servlets -- [Wed Feb 06 23:14:56 2002] [jk_connect.c (143)]: jk_open_socket, connect() failed errno = 146 [Wed Feb 06 23:14:56 2002] [jk_ajp13_worker.c (196)]: In jk_endpoint_t::connect_to_tomcat, failed errno = 146 [Wed Feb 06 23:14:56 2002] [jk_ajp13_worker.c (635)]: Error connecting to the Tomcat process. [Wed Feb 06 23:14:56 2002] [jk_ajp13_worker.c (848)]: In jk_endpoint_t::service, send_request failed in send loop 2 --- Im running apache version 1.3.12 with tomcat 4.0.x when I run tomcat 3.0 everything is fine. BTW im running this on a Sparc Solaris SunOS 8 Any ideas.. thanks gearoid -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] | -- | To unsubscribe: mailto:[EMAIL PROTECTED] | For additional commands: mailto:[EMAIL PROTECTED] | Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Re: RMI error (SocketException: socket write error) on Tomcat 4.0, NT4/Win2K
Turn on logging on the RMI server process: java -Djava.rmi.server.logCalls=true -Djava.rmi.server.logLevel=VERBOSE -Djava.rmi.loader.logLevel=VERBOSE ServerName where, java.rmi.server.logCalls=true - will log all incoming calls and exceptions java.rmi.server.logLevel=VERBOSE - will log details of outgoing calls java.rmi.loader.logLevel=VERBOSE - logs classname and codebase whenever RMI attempts to load a class as aresult of unmarshalling an arg. This could help in debugging. Thanks. RS. Tee Chee Han [EMAIL PROTECTED] on 12/19/2001 04:47:18 AM Please respond to Tomcat Users List [EMAIL PROTECTED] To: [EMAIL PROTECTED] cc: Subject: RMI error (SocketException: socket write error) on Tomcat 4.0, NT4/Win2K Hi, -- Environment -- I am running Tomcat 4.0.1 on NT4 with JDK1.3.0. -- Error Symptom -- I have a servlet that makes RMI calls to an RMI server process (non EJB) on the same machine. It used to work fine on Tomcat 3.2.3 and Tomcat 3.3 but when we switched to Tomcat 4.0 it stopped working. The servlet looks-up the RMI server object successfully but fails as soon as it tries to invoke an RMI method with this exception: java.net.SocketException: Connection aborted by peer: socket write error [See end of message for full stack trace] At first we suspected it had to do with the policy file but we have ruled that out because we are NOT running with the -security option and the error doesn't seem to point to a security or permission problem. It also doesn't seem like a CLASSPATH problem because everything else (including the RMI lookup) works fine. I have scoured the web for a solution but found only an identical question on comp.lang.java with no reply. Is Tomcat 4.0 doing anything different with RMI? Is JNDI or EJB somehow involved here by default? We don't use either of these. Any help would be much appreciated! cheehan -- Stack Trace -- java.rmi.MarshalException: error marshalling arguments; nested exception is: java.net.SocketException: Connection aborted by peer: socket write error java.net.SocketException: Connection aborted by peer: socket write error at java.net.SocketOutputStream.socketWrite(Native Method) at java.net.SocketOutputStream.write(SocketOutputStream.java:83) at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:72 ) at java.io.BufferedOutputStream.write(BufferedOutputStream.java:116) at java.io.ObjectOutputStream.drain(ObjectOutputStream.java:1477) at java.io.ObjectOutputStream.setBlockData(ObjectOutputStream.java:1500) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:407) at sun.rmi.server.UnicastRef.marshalValue(UnicastRef.java:268) at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:106) at hello.ExecuterImpl_Stub.execute(Unknown Source) [...] at hello.ServletA.doPost(Unknown Source) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl icationFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF ilterChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV alve.java:243) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline .java:566) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav a:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV alve.java:201) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline .java:566) at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve .java:246) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline .java:564) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav a:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java: 2344) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j ava:164) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline .java:566) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatche rValve.java:170) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline .java:564) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j ava:170) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline .java:564) at
Re: RMI error (SocketException: socket write error) on Tomcat 4.0, NT4/Win2K
I have found the solution. It turns out that RMI fails if Tomcat is installed in directory with white spaces. Before my original posting, I had actually seen this bug in the tomcat-dev mailing list: http://www.mail-archive.com/tomcat-dev%40jakarta.apache.org/msg17201.html But I thought my problem was a different one because the error mentioned in this bug report was one of MalformedURL. Out of desperation, I tried re-installing Tomcat in a directory without white space and now it works. In any case, thanks RS. cheehan [EMAIL PROTECTED] wrote: Turn on logging on the RMI server process: java -Djava.rmi.server.logCalls=true -Djava.rmi.server.logLevel=VERBOSE -Djava.rmi.loader.logLevel=VERBOSE ServerName where, java.rmi.server.logCalls=true - will log all incoming calls and exceptions java.rmi.server.logLevel=VERBOSE - will log details of outgoing calls java.rmi.loader.logLevel=VERBOSE - logs classname and codebase whenever RMI attempts to load a class as aresult of unmarshalling an arg. This could help in debugging. Thanks. RS. Tee Chee Han [EMAIL PROTECTED] on 12/19/2001 04:47:18 AM Please respond to Tomcat Users List [EMAIL PROTECTED] To: [EMAIL PROTECTED] cc: Subject: RMI error (SocketException: socket write error) on Tomcat 4.0, NT4/Win2K Hi, -- Environment -- I am running Tomcat 4.0.1 on NT4 with JDK1.3.0. -- Error Symptom -- I have a servlet that makes RMI calls to an RMI server process (non EJB) on the same machine. It used to work fine on Tomcat 3.2.3 and Tomcat 3.3 but when we switched to Tomcat 4.0 it stopped working. The servlet looks-up the RMI server object successfully but fails as soon as it tries to invoke an RMI method with this exception: java.net.SocketException: Connection aborted by peer: socket write error [See end of message for full stack trace] At first we suspected it had to do with the policy file but we have ruled that out because we are NOT running with the -security option and the error doesn't seem to point to a security or permission problem. It also doesn't seem like a CLASSPATH problem because everything else (including the RMI lookup) works fine. I have scoured the web for a solution but found only an identical question on comp.lang.java with no reply. Is Tomcat 4.0 doing anything different with RMI? Is JNDI or EJB somehow involved here by default? We don't use either of these. Any help would be much appreciated! cheehan -- Stack Trace -- java.rmi.MarshalException: error marshalling arguments; nested exception is: java.net.SocketException: Connection aborted by peer: socket write error java.net.SocketException: Connection aborted by peer: socket write error at java.net.SocketOutputStream.socketWrite(Native Method) at java.net.SocketOutputStream.write(SocketOutputStream.java:83) at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:72 ) at java.io.BufferedOutputStream.write(BufferedOutputStream.java:116) at java.io.ObjectOutputStream.drain(ObjectOutputStream.java:1477) at java.io.ObjectOutputStream.setBlockData(ObjectOutputStream.java:1500) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:407) at sun.rmi.server.UnicastRef.marshalValue(UnicastRef.java:268) at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:106) at hello.ExecuterImpl_Stub.execute(Unknown Source) [...] at hello.ServletA.doPost(Unknown Source) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl icationFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF ilterChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV alve.java:243) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline .java:566) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav a:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV alve.java:201) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline .java:566) at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve .java:246) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline .java:564) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav a:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at
RE: RMI/JNDI problem w/tomcat 3.3
I assume you noticed in the documentation that Tomcat 3.3 startup scripts ignore your CLASSPATH. Did you modify the tomcat.bat/tomcat.sh file to include the jndi.properties file? If so, what is the error you are seeing? Cheers, Larry -Original Message- From: Mike Comb [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 06, 2001 10:37 PM To: [EMAIL PROTECTED] Subject: RMI/JNDI problem w/tomcat 3.3 Hi, I am trying to upgrade from tomcat 3.2.3 to 3.3 and I am having a problem. Under 3.2.3 I was able to get tomcat to act as a JNDI server by adding a jndi.properties file to my classpath with the following contents... java.naming.factory.initial=com.sun.jndi.rmi.registry.Registry ContextFactory java.naming.provider.url=rmi://localhost:1099 an RMI server was automatically started on port 1099 as part of the tomcat process. With TC 3.3 this no longer works. I found a couple of old emails mentioning that tc3.3 may not be able to open that file, but no real details. Can someone please tell me what is going on and if there is any work around? Thanks, -Mike -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
RE: RMI/JNDI problem w/tomcat 3.3
Yes, I know it ignores the CLASSPATH. I tried puting jndi.properties in my webapps classes directory as well as modifying tomcat.sh so it uses the system CLASSPATH. Neither had any effect. I am not getting any error, RMI just never starts up. Has anybody gotten this to work with tc3.3? Can someone try? I want to know if this is a TC bug or just a configuration error with my setup. Thanks, -Mike --On Friday, December 7, 2001 8:04 AM -0500 Larry Isaacs [EMAIL PROTECTED] wrote: I assume you noticed in the documentation that Tomcat 3.3 startup scripts ignore your CLASSPATH. Did you modify the tomcat.bat/tomcat.sh file to include the jndi.properties file? If so, what is the error you are seeing? Cheers, Larry -Original Message- From: Mike Comb [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 06, 2001 10:37 PM To: [EMAIL PROTECTED] Subject: RMI/JNDI problem w/tomcat 3.3 Hi, I am trying to upgrade from tomcat 3.2.3 to 3.3 and I am having a problem. Under 3.2.3 I was able to get tomcat to act as a JNDI server by adding a jndi.properties file to my classpath with the following contents... java.naming.factory.initial=com.sun.jndi.rmi.registry.Registry ContextFactory java.naming.provider.url=rmi://localhost:1099 an RMI server was automatically started on port 1099 as part of the tomcat process. With TC 3.3 this no longer works. I found a couple of old emails mentioning that tc3.3 may not be able to open that file, but no real details. Can someone please tell me what is going on and if there is any work around? Thanks, -Mike -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
RE: RMI class loading in a servlet (ClassCastException)
I have found the bug number 1883 in the bug database that exectly matches my problem. It is supposed to be fixed in version 3.3. Sorry for the trouble. jacek. -Original Message- From: Jacek Lawniczek [mailto:[EMAIL PROTECTED]] Sent: Monday, August 06, 2001 6:46 PM To: [EMAIL PROTECTED] Subject: RMI class loading in a servlet (ClassCastException) Hello everyone, I have a problem using RMI in a servlet. My configuration is desribed below: Machine 1: - RMI server - HTTP server for dynamic class loading. Machine 2: - Tomcat 3.2, my servlet that is an RMI client. When the servlet is trying to connet to the RMI server, it cannot see all the classes which are located in WEB-INF/classes directory. This is strange but it does not cause an error and the client then downloads the neccessary class files from HTTP server on Machine 1. I can see in the HTTP server log that the RMI interface, related class and the STUB class are downloaded to Machine 2. Unfortunatelly an exception is thrown after I use Naming.lookup to find the server's instance. I cast the returned Object to my server's interface (ParkServer) and I get ClassCastException. When I check the Object's class it shows PackServerImpl_Stub and PackServerImpl_Stub implements ParkServer. The code looks like this: Object o = Naming.lookup(//machine2/park/ParkServer); // ok System.out.println(Class= + o.getClass().getName()); // prints Class=ParkServerImpl_Stub // and this class implements ParkServer interface ParkServer p = (ParkServer) o; // exception is raised This is very strange to me and I don't know what to do. Please help. Everything works fine when I put the STUB file in the WEB-INF directory but it is not the best solution. The the client doesn't download any files from HTTP server on Machine 1. It takes evertything from WEB-INF/classes. When I connect to the RMI server from a standalone client everything is OK. I can also see in the HTTP server's log that only the STUB class is loaded to the client. This is the right way. Best regards, Jacek. --- Wyprawy 2001: Szlakiem Stasia i Nel http://wyprawy.interia.pl/stasinel2001?aid=9470
RE: RMI with the IIS/Tomcat behind a firewall
Take a look at the following link. It uses HTTP to connect to a servlet and then the servlet does everything else:- http://developer.java.sun.com/developer/technicalArticles/RMI/rmi/ It's all pure Java. Regards, Adam. Adam Fowler Second year Computer Science undergraduate University of Wales, Aberystwyth Carroll College, WI, USA(2000-2001) web: http://gucciboy.dyndns.org/aff9 e-mail: [EMAIL PROTECTED] "Every new beginning comes from some other beginning's end" -Original Message- From: Sascha Richter [mailto:[EMAIL PROTECTED]] Sent: Saturday, March 17, 2001 7:54 PM To: [EMAIL PROTECTED] Subject: RMI with the IIS/Tomcat behind a firewall Hello, I have an IIS webserver working with tomcat behind a firewall and we want to use RMI objects on our server. Because of the firewall we can not conntact to port 1099 directly. It seems to exists only two solution, the CGI script called java-rmi.cgi, which is available in the unix distribution of the jdk and a servlet called rmiservlethandler. I don't know how to adapted the CGI script to use it with the IIS webserver. So a context /rmiservlethandler is created on our server and it works. But the problem is, that RMI clients call /cgi-bin/java-rmi.cgi by default to tunnel a firewall. The readme says, that all calls for /cgi-bin/java-rmi.cgi should be redirected to the servlet. A redirect within the IIS fails, because the redirects doesn't work in a transparent manner, but by sending the client a redirect command (30X Error), requesting the client to reload the new url. This method seems not to work for RMI clients. Another method is, to map /cgi-bin/java-rmi.cgi to the ajp12 worker and to create a new context cgi-bin under tomcat and to rename the servletname rmiservlethandler in java-rmi.cgi. If the url /cgi-bin/servlet/java-rmi.cgi is called, it works, but if the url /cgi-bin/java-rmi.cgi is called, the servlet is naturally not found. I need to call /cgi-bin/java-rmi.cgi and not /cgi-bin/servlet/java-rmi.cgi to tunnel our firewall. Is there a way to map a request without having the "/servlet" path included ? Exists other methods to tunnel a firewall ? Thanks Sascha
RE: RMI and Tomcat
I have made two posts to the list about similar problems with 3.2.1 and using JNDI/RMI (EJB's) and not figured much out. Not having the time to delve further I backed off to Tomcat 3.1. You may try that for the interim. Any feedback from any of the implementors that would help us start to figure this out? -Original Message- From: Gerard BORREILL [mailto:[EMAIL PROTECTED]] Sent: Friday, March 09, 2001 12:01 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: RMI and Tomcat Hello, Sorry, but I have not found any answer in the mailing list archive. I am using Tomcat 3.2.1. I have a web application based on servlets that communicates with a server using RMI, so I have set the SecurityManager when starting Tomcat. I get a java.lang.ClassNotFoundException on a class that is under the WEB-INF/classes/ directory, or in *.jar file located in WEB-INF/lib. The class file is at the right place. I have made two attempts: 1) put every classes in jar files. I have 2 jar files. myApplication.jar and com.jar. The class not found is in the com.jar, and the servlet class is in the myApplication.jar file. 2) expand those .jar files under WEB-INF/classes, The class file not found is not in the same package as the servlet class. (com.xxx and fr.xxx.). I do not understand why tomcat is not able to find this class. I have no SecurityException.Why is it finding my servlet and performing it, and not my com.xx classes. I think it is a matter of class loader (?) How can I know the class loader used by tomcat for my application ? Do I need this ? Does anyone have a solution ? In advance thank you. Grard - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: RMI and Tomcat
I have made two posts to the list about similar problems with 3.2.1 and using JNDI/RMI (EJB's) and not figured much out. Not having the time to delve further I backed off to Tomcat 3.1. You may try that for the interim. Any feedback from any of the implementors that would help us start to figure this out? I've also reported this as "it makes no sense" that it can find a JSP bean in the classpath, but if that bean calls other classes and those classes call others, things get screwed up, as if those other beans have forgotten the classloader/classpath that was in effect at the time the original JSP page bean was referenced. I have found a temporary solution that will likely help you. In your Tomcat startup file, put those two jar files in your CLASSPATH so that when Tomcat itself starts up it will also have the same classpath that your webapp is using. I just set the CLASSPATH in Tomcat's startup script to use te WEB-INF/classes and each jar in my WEB-INF/lib. That does the trick, though it's certainly not what I'd expect, and it would be worse if there was some sort of conflict between jars/classes in two webapps running under the same tomcat process. David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: RMI
I've just got my serlevt working as an RMI client. To do this I had to edit the tomcat.policy file to give all permissions to everything, and use the rmiSecurityManager. See my earlier posts for more info So it is impossible to publish such a servlet without affecting base Tomcat configuration, isn't it? That's pity:( And I am not sure I want to give AllPermissions. Did you try to refine the permissions? Sergey I had to get on with the servlets, so I haven't started refining permissions. Someone said that perhaps the securtity exception was being thrown by tomcats codebase, but this has all-permissions granted. I've not carried out and in-depth test yet to see if there is something wrong with the handling of the policy file by tomcat, or if its something I've done. One of the guys at work has done allot of work with security stuff, so next week he'll take a look - I'll let you know what happens. sam - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: RMI
Hi I try to run Tomcat with SecurityManager and policy file. First, I found a bug in tomcat.sh - it passes "-security" option to the class (it's necessary to add one "shift" statement before calling java). Then I found that all session-based jsps give me errors like this (in tomcat console): java.security.AccessControlException: access denied (java.util.PropertyPermission tomcat.sessionid.randomclass read) at java.security.AccessControlContext.checkPermission(AccessControlContext.java:272) at java.security.AccessController.checkPermission(AccessController.java:399) at java.lang.SecurityManager.checkPermission(SecurityManager.java:545) at java.lang.SecurityManager.checkPropertyAccess(SecurityManager.java:1278) at java.lang.System.getProperty(System.java:560) at org.apache.tomcat.util.SessionIdGenerator.getIdentifier(SessionIdGenerator.java:124) at org.apache.tomcat.util.SessionIdGenerator.generateId(SessionIdGenerator.java:177) at org.apache.tomcat.util.SessionUtil.generateSessionId(SessionUtil.java:180) at org.apache.tomcat.session.StandardManager.getNewSession(StandardManager.java:379) at org.apache.tomcat.session.StandardSessionInterceptor.newSessionRequest(StandardSessionInterceptor.java:177) at org.apache.tomcat.core.ContextManager.doNewSessionRequest(ContextManager.java:913) at org.apache.tomcat.core.RequestImpl.getSession(RequestImpl.java:478) at org.apache.tomcat.facade.HttpServletRequestFacade.getSession(HttpServletRequestFacade.java:381) at org.apache.jasper.runtime.PageContextImpl._initialize(PageContextImpl.java:173) at org.apache.jasper.runtime.PageContextImpl.initialize(PageContextImpl.java:149) at org.apache.jasper.runtime.JspFactoryImpl.getPageContext(JspFactoryImpl.java:99) at jsp.sessions._0002fjsp_0002fsessions_0002fcarts_0002ejspcarts_jsp_0._jspService(_0002fjsp_0002fsessions_0002fcarts_0002ejspcarts_jsp_0.java:51) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:177) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404) at org.apache.tomcat.core.Handler.service(Handler.java:286) at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372) at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797) at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743) at org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection(Ajp12ConnectionHandler.java:166) at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416) at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498) at java.lang.Thread.run(Thread.java:484) 2001-03-02 03:45:32 - Ctx( /examples ): Exception in: R( /examples + /jsp/sessions/carts.jsp + null) - java.lang.NullPointerException at jsp.sessions._0002fjsp_0002fsessions_0002fcarts_0002ejspcarts_jsp_0._jspService(_0002fjsp_0002fsessions_0002fcarts_0002ejspcarts_jsp_0.java:132) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:177) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404) at org.apache.tomcat.core.Handler.service(Handler.java:286) at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372) at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797) at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743) at org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection(Ajp12ConnectionHandler.java:166) at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416) at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498) at java.lang.Thread.run(Thread.java:484) So in browser I also get the error: Error: 500 Location: /examples/jsp/sessions/carts.jsp Internal Servlet Error: java.lang.NullPointerException at
Re: RMI
I've just got my serlevt working as an RMI client. To do this I had to edit the tomcat.policy file to give all permissions to everything, and use the rmiSecurityManager. See my earlier posts for more info So it is impossible to publish such a servlet without affecting base Tomcat configuration, isn't it? That's pity:( And I am not sure I want to give AllPermissions. Did you try to refine the permissions? Sergey - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: RMI
I've just got my serlevt working as an RMI client. To do this I had to edit the tomcat.policy file to give all permissions to everything, and use the rmiSecurityManager. See my earlier posts for more info sam - Original Message - From: Sergey V. Udaltsov [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, February 28, 2001 11:39 PM Subject: RMI Hi all My 4-tier app uses RMI-based AppServer. I want my JSP to connect to it (using dynamic stub loading). In order to do this I have to install RMISecurityManager, haven't I? Is this legal in Tomcat? Probably, I should provide some policy file? Can my webapp use separate policy (I would not like to change the base Tomcat configuration)? I use JDK 1.3, so AFAIK RMISecurityManager === SecurityManager and uses usual policy files. Any comments are more than welcome. Regards, Sergey - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: RMI in linux
Im using linux, jdk1.2.2 and tomcat. I'm having a problem with rmi registry... how do you start rmi regsitry? I read that its different from windows and it has something to do with the ports. Could anyone explain it more to me... like how would i bind it to a port i like to use like 8080 or something. It said something like "rmiregistry " which seem to work but my binder code thows a ConnectException or ServerException... 0. Start the RMI registry. The registry is an application where RMI objects can be published so users will be able to find where the RMI objects are. 1. Start you application. You application "binds" its remote objects to specific names to the registry -- Naming.bind(...). This in effect tells the RMI registry that you remote object is ready to serve whoever requests for it. HTH jeff -- -- Jeff Gutierrez Intertainer Inc (http://www.intertainer.com) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: RMI in linux
'rmiregistry' runs on port 1099 by default. You can specify another port by supplying it as the argument ('rmiregistry [port] '). The biggest difference between Windows and Unix (Linux), is that Unix only lets 'root' use ports below 1024. An even better option for many apps is to run the registry right in their own JVM. The java.rmi.LocateRegistry class has static methods that will try to find a registry on a given port; if unsuccessful it will create an instance for you within your JVM. The only reason to run 'rmiregistry' separately is if you need to supply its functionality as a shared resource (like DNS). Original Message On 2/7/01, 12:11:20 AM, Merwin Yap [EMAIL PROTECTED] wrote regarding RMI in linux: Not a question regarding tomcat but maybe someone might know... Im using linux, jdk1.2.2 and tomcat. I'm having a problem with rmi registry... how do you start rmi regsitry? I read that its different from windows and it has something to do with the ports. Could anyone explain it more to me... like how would i bind it to a port i like to use like 8080 or something. It said something like "rmiregistry " which seem to work but my binder code thows a ConnectException or ServerException... Thanks, Merwin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: rmi amd tomcat
wendy wang wrote: Hi there, Does anyone know how to set up tomcat3.2.1 to run servlet which look up remote object using rmi? Wendy There is nothing special required in the Tomcat setup. A servlet talking to a RMI object is just like an application doing the same. I would suggest that you write a "Bean" type component to do the actual RMI so you can test it without a servlet interface first. -- WBB - [EMAIL PROTECTED] Java Cert mock exams http://www.lanw.com/java/javacert/ Author of Java Developer's Guide to Servlets and JSP ISBN 0-7821-2809-2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]