RMI localhost problem
I specifiy RMI lookups to use 127.0.0.1 however for some reason if I pull out my network connection the lookup fails with the Error due to the fact that no connection can be made to the IP address of the machine and not 127.0.0.1
How can I ensure that 127.0.0.1 is used so that RMI lookups do not fail when the netwrok is down?
By default it will try to connect to the local host..
try to use this
-Djava.rmi.server.hostname=127.0.0.1
Krishna
Similar Messages
-
HI all im really not sure how to fix this error that im having, to be honest im not really sure what i have done wrong, or where im going wrong with pulling information from my interface or and implimentation.
Okies here is all the code
Interface:
public interface RMIServ
extends java.rmi.Remote {
public String PassCheck(String pass, String user)
throws java.rmi.RemoteException;
Implimentation:
public class RMIServImpl
extends
java.rmi.server.UnicastRemoteObject
implements RMIServ {
// Implementations must have an
//explicit constructor
// in order to declare the
//RemoteException exception
public RMIServImpl()
throws java.rmi.RemoteException {
super();
public String PassCheck(String pass, String user)//takes the user and switch number
throws java.rmi.RemoteException {
String result;
int password = Integer.parseInt(pass);//converts the string to an int
int info = Integer.parseInt(user);//converts the string to an int
if (password==72)//checks password
switch(info) //start switch.
case 1: result="Hello my name is Gareth Gates.";break;
case 2: result= "My student number is 0302814.";break;
case 3: result= "I am Taking Computer Science and Robotics.";break;
case 4: result= "This semester i am taking 4 units, this is one.";break;
case 5: result= "my project is on server times.";break;
case 6: result= "i live in luton during the week.";break;
case 7: result= "i work in a garden centre.";break;
case 8: result= "please let me know what you think of my server.";break;
case 9: result= "Email: [email protected]";break;
case 10: result= "Email me any time, thanks.";break;
default : result= "You entered a number bigger then 10 please try again.";break;
} //end switch.
return result; //sends string back to client.
else
return result= "You entered the wrong password";//send back an error
Server:
import java.rmi.Naming;
public class RMIServServer {
public RMIServServer() {
try {
RMIServ c = new RMIServImpl();
Naming.rebind("rmi://localhost:1099/RMIServService", c);
} catch (Exception e) {
System.out.println("Trouble: " + e);
public static void main(String args[]) {
new RMIServServer();
Client:
import java.rmi.Naming;
import java.rmi.RemoteException;
import java.net.MalformedURLException;
import java.rmi.NotBoundException;
import javax.swing.*;
public class RMIServClient {
public static void main(String[] args) {
try {
RMIServ c = (RMIServ)
Naming.lookup("rmi://localhost/RMIServService");
String password = JOptionPane.showInputDialog("Please enter your password");
if (password == c.PassCheck(pass)){
JOptionPane.showMessageDialog(null, "Password Correct");
catch (MalformedURLException murle) {
System.out.println();
System.out.println(
"MalformedURLException");
System.out.println(murle);
catch (RemoteException re) {
System.out.println();
System.out.println(
"RemoteException");
System.out.println(re);
catch (NotBoundException nbe) {
System.out.println();
System.out.println(
"NotBoundException");
System.out.println(nbe);
catch (
java.lang.ArithmeticException
ae) {
System.out.println();
System.out.println(
"java.lang.ArithmeticException");
System.out.println(ae);
Any light that you could shed on my problem would be much appreciated, thanks for the help in advance
the bold is where my problem lies
Joe de Ronde
Message was edited by:
joederondetry
String password = JOptionPane
.showInputDialog("Please enter your password");
if (password == c.PassCheck(password, "username")) {
JOptionPane.showMessageDialog(null, "Password Correct");
}Also your implementation is wrong, you better take a look at some examples (like the java tutorial, including the rmi tutorial, or if you're using eclipse there are some working ready to use examples in the rmi plugin for eclipse (google it). -
Could not connect to remote service [rmi://localhost:1099/
I have a large deployment with two filr appliances and one database and one search index.
I am running zen load balancer in front of the appliance which works great.
There are no config changes to the filr appliances in terms of port redirection.
I had an issue upgrading from 1.0.1 to 1.1 so I blew it away and started fresh.
After I installed and configured the appliances there were no issues . Now the :9443 configuration section will not work I get
(this is just the top lines)
HTTP ERROR 500
Problem accessing /. Reason:
Could not connect to remote service [rmi://localhost:1099/GangliaService]; nested exception is java.rmi.NoSuchObjectException: no such object in table
Caused by:
org.springframework.remoting.RemoteConnectFailureE xception: Could not connect to remote service [rmi://localhost:1099/GangliaService]; nested exception is java.rmi.NoSuchObjectException: no such object in table
at org.springframework.remoting.rmi.RmiClientIntercep torUtils.convertRmiAccessException(RmiClientInterc eptorUtils.java:190)
at org.springframework.remoting.rmi.RmiClientIntercep tor.doInvoke(RmiClientInterceptor.java:347)
This is on all appliances (search,data,filr1,filr2)
I restarted filr2 and the admin section 9443 comes back for a short time. Maybe 10 minutes then I get the same error. But now after the restart I get and authentication box asking for credentials on 8443. when I put in the admin or other creds it directs me to a page that says
HTTP Status 500 - Filter execution threw an exception
type Exception report
message Filter execution threw an exception
description The server encountered an internal error that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Filter execution threw an exception
org.kablink.teaming.webdav.servlet.filter.Resource DispatchFilter.doFilter(ResourceDispatchFilter.jav a:87)
root cause
java.lang.ExceptionInInitializerError
java.lang.J9VMInternals.initialize(J9VMInternals.j ava:259)
org.kablink.teaming.asmodule.spring.security.userd etails.DecryptedPasswordUserDetailsService.loadUse rByUsername(DecryptedPasswordUserDetailsService.ja va:51)
org.springframework.security.web.authentication.http://www.DigestAuthenticationFilte...lter.java:144)
org.springframework.security.web.FilterChainProxy$ VirtualFilterChain.doFilter(FilterChainProxy.java: 323)
org.springframework.security.web.context.SecurityC ontextPersistenceFilter.doFilter(SecurityContextPe rsistenceFilter.java:87)
org.springframework.security.web.FilterChainProxy$ VirtualFilterChain.doFilter(FilterChainProxy.java: 323)
org.springframework.security.web.FilterChainProxy. doFilter(FilterChainProxy.java:173)
org.springframework.web.filter.DelegatingFilterPro xy.invokeDelegate(DelegatingFilterProxy.java:346)
org.springframework.web.filter.DelegatingFilterPro xy.doFilter(DelegatingFilterProxy.java:259)
org.kablink.teaming.webdav.servlet.filter.Resource DispatchFilter.doFilter(ResourceDispatchFilter.jav a:87)
I have rebooted to no avail. If I restart the jetty service I do get the appliance login for 9443 but if I try to login I get the same message about [rmi://localhost:1099/
again if I reboot then 9443 works for 10 mins but 8443 gets hosed. Everything worked fine until I rebooted the appliance.
I am afraid to even reboot these appliances now in fear that the will cease to work.
I should also note that this was part of the upgrade issue I had after I rebooted all of the appliances.
Thanks in advance.Originally Posted by bschilliger
The same issue here:
HTTP Status 500 - Filter execution threw an exception
type Exception report
message Filter execution threw an exception
description The server encountered an internal error that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Filter execution threw an exception
org.kablink.teaming.webdav.servlet.filter.Resource DispatchFilter.doFilter(ResourceDispatchFilter.jav a:87)
The password in the FILR appliance configuration 'Outbound E-Mail' was too complex (with special characaters). After changing the special characters with letters and/or numbers, the server starts without any troubles!
Regards from Switzerland,
Beat -
Hello,
I've tested out programs on the following links.
http://www.execpc.com/~gopalan/java/rmiserver.html
I've haven't got the chance to test out the client side code as I have problem on generating the stub file.
When I compile the programs just like the author did, I've got an error message. The steps that I used to compile and rmic the programs are as follows:-
C:\jdk1.4\newTest\StockRMI\SimpleStocks>javac *.java
C:\jdk1.4\newTest\StockRMI\SimpleStocks>cd..
C:\jdk1.4\newTest\StockRMI\SimpleStocks>rmic SimpleStocks.StockMarketImpl
error: Class SimpleStocks.StockMarketImpl not found.
Do anyone of you know what is worng?
What did I miss out?
Thanks in advance.Hi,
Thank you very much for your response.
I am able to generate the .stub file already.
But now, I am having other errors.
The following was what i did when I try out your solution and some errors appear.
C:\jdk1.4\newTest\StockRMI\SimpleStocks>javac *.java
C:\jdk1.4\newTest\StockRMI\SimpleStocks>cd..
C:\jdk1.4\newTest\StockRMI>rmic -classpath ./ SimpleStocks.StockMarketImpl
C:\jdk1.4\newTest\StockRMI>javac *.java
StockMarketClient.java:6: package SimpleStocks does not exist
import SimpleStocks.*;
^
StockMarketServer.java:12: package SimpleStocks does not exist
import SimpleStocks.*;
^
StockMarketClient.java:15: cannot access StockMarket
bad class file: c:\jdk1.4\newTest\StockRMI\SimpleStocks\StockMarket.class
class file contains wrong class: SimpleStocks.StockMarket
Please remove or make sure it appears in the correct subdirectory of the classpa
th.
StockMarket market = (StockMarket)Naming.lookup("rmi://localhost/NASDAQ");
^
3 errors
C:\jdk1.4\newTest\StockRMI>
What is wrong this time?
Can someone please to help me?
Thank you very much.
Your help will be apppreciated. -
RMI Marshalling Problem: weblogic.Admin PING
WebLogic 5.1.0 with service pack 8 has been installed on a HPUX server. I'm
trying to ping the server from an NT box, but I'm getting some RMI
marshalling problems.
Here is the command that I run on NT:
C:\weblogic\jre1_2\jre\bin\java -classpath
c:weblogic/lib/weblogic510sp.jar;c:/weblogic/classes;c:/weblogic/lib/weblogi
caux.jar weblogic.Admin t3://HPServer:7001 PING > MarshallingProblem.txt
Here is what is in MarshallingProblem.txt (modified server name):
Failed to connect to t3://HPServer:7001 due to:
[weblogic.rmi.UnexpectedException: Marshalling:
- with nested exception:
[weblogic.rjvm.PeerGoneException:
- with nested exception:
[weblogic.utils.AssertionError: ***** ASSERTION FAILED *****[ Exception
creating response stream ] - with nested exception:
[java.io.InvalidClassException:
weblogic.security.acl.internal.AuthenticatedUser; Local class not
compatible: stream classdesc serialVersionUID=6699361079932480379 local
class serialVersionUID=2825328378974757378]]]]
I previously had similar problems pinging the server from the server itself
until I included the servicepack in the classpath.
Anyone have any idea what going on in this situation?
Cameron TaggartCameron
Can you test with sp8 installed on your NT machine too ? And also make
sure you set the classpath with the sp8 jar files on NT before you run
weblogic.Admin PING
Raj Alagumalai
Cameron Taggart wrote:
WebLogic 5.1.0 with service pack 8 has been installed on a HPUX server. I'm
trying to ping the server from an NT box, but I'm getting some RMI
marshalling problems.
Here is the command that I run on NT:
C:\weblogic\jre1_2\jre\bin\java -classpath
c:weblogic/lib/weblogic510sp.jar;c:/weblogic/classes;c:/weblogic/lib/weblogi
caux.jar weblogic.Admin t3://HPServer:7001 PING > MarshallingProblem.txt
Here is what is in MarshallingProblem.txt (modified server name):
Failed to connect to t3://HPServer:7001 due to:
[weblogic.rmi.UnexpectedException: Marshalling:
- with nested exception:
[weblogic.rjvm.PeerGoneException:
- with nested exception:
[weblogic.utils.AssertionError: ***** ASSERTION FAILED *****[ Exception
creating response stream ] - with nested exception:
[java.io.InvalidClassException:
weblogic.security.acl.internal.AuthenticatedUser; Local class not
compatible: stream classdesc serialVersionUID=6699361079932480379 local
class serialVersionUID=2825328378974757378]]]]
I previously had similar problems pinging the server from the server itself
until I included the servicepack in the classpath.
Anyone have any idea what going on in this situation?
Cameron Taggart -
My first RMI server: problem
Hi,
I'm just trying to create my first RMI program, but I got already blocked immediately:
It's just a stupid program with a function that returns "ok".
So what I did is the following:
1)I created a class OkServer.java
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface OkServer extends Remote {
public String getOk() throws RemoteException;
2)I created a class OkServerImpl.java
import java.rmi.server.UnicastRemoteObject;
import java.rmi.RMISecurityManager;
import java.rmi.RemoteException;
import java.rmi.Naming;
public class OkServerImpl extends UnicastRemoteObject implements OkServer {
public OkServerImpl() throws RemoteException {
public String getOk() {
return "ok";
public static void main (String args[]) throws Exception {
System.setSecurityManager(new RMISecurityManager());
OkServerImpl OkSvr = new OkServerImpl();
Naming.bind("OkServer", OkSvr);
3) I compiled everything with javac *.java
i use java version below:
java version "1.5.0_12"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_12-b04)
Java HotSpot(TM) Client VM (build 1.5.0_12-b04, mixed mode)
4)I opened a cmd window and started the registry with the command c:\rmiregistr
(a cursor starts blinking, so I think it runs correctly)
5)then I start the program with the command: C:\java OkServerImpl
but I get the error below !!
C:\Temp\rmitester>java OkServerImpl
Exception in thread "main" java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:1099 connect,resolve)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
at java.security.AccessController.checkPermission(AccessController.java:427)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
at java.lang.SecurityManager.checkConnect(SecurityManager.java:1034)
at java.net.Socket.connect(Socket.java:513)
at java.net.Socket.connect(Socket.java:469)
at java.net.Socket.<init>(Socket.java:366)
at java.net.Socket.<init>(Socket.java:179)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:569)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:306)
at sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source)
at java.rmi.Naming.bind(Naming.java:111)
at OkServerImpl.main(OkServerImpl.java:18)
What's wrong???solved, but i don't understand why i encountered this particular issue (that isn't mentioned to happen or to configure in my book):
i had to create a custom policy file:
make a file "c:\temp\rmitester\policy.all" and past the text below in it:
grant {
permission java.security.AllPermission "", "";
thereafter launch the server with this command:
c:\temp\rmitester\java -Djava.security.policy=policy.all OkServerImpl
and the client with this command:
c:\temp\rmitester\java -Djava.security.policy=policy.all OkClient localhost
Can anyone explain if it was normal that i encountered this problem or was it seldom behaviour that happens only to me? -
Hi folks,
Using this tutorial;
http://java.sun.com/j2se/1.5.0/docs/guide/rmi/hello/hello-world.html
I was able to get the example working when I had all of my classes in the same directory as I ran it. E.g.
$pwd
/home/jmcparla/RMI2/server
$ ls
Hello.class Server.class
$rmiregistry 2000 &
$ java Server
Server ready
$ pwd
/home/jmcparla/RMI2/client
$ ls
Client.class Hello.class
$ java Client
response: Hello, world!So I decided to bundle the code into two Jars, Server.jar (containing Hello.class and Server.class) and Client.jar (Hello.class and Client.class). However this time when I went to start the Server;
$ pwd
/home/jmcparla/RMI2
$ ls
Server.jar bin client policy server src
$ rmiregistry 2000 &
[1] 2848
$ java -jar Server.jarI got these exceptions;
Server exception: java.rmi.ServerException: RemoteException occurred in server t
hread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested excep
tion is:
java.lang.ClassNotFoundException: Hello
java.rmi.ServerException: RemoteException occurred in server thread; nested exce
ption is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested excep
tion is:
java.lang.ClassNotFoundException: Hello
at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:396
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:250)
at sun.rmi.transport.Transport$1.run(Transport.java:159)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:5
35)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTranspor
t.java:790)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport
.java:649)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
utor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:908)
at java.lang.Thread.run(Thread.java:619)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknow
n Source)
at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source)
at Server.main(Server.java:22)
Caused by: java.rmi.UnmarshalException: error unmarshalling arguments; nested ex
ception is:
java.lang.ClassNotFoundException: Hello
at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:386
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:250)
at sun.rmi.transport.Transport$1.run(Transport.java:159)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:5
35)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTranspor
t.java:790)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport
.java:649)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
utor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:908)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassNotFoundException: Hello
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at sun.rmi.server.LoaderHandler.loadProxyInterfaces(LoaderHandler.java:7
11)
at sun.rmi.server.LoaderHandler.loadProxyClass(LoaderHandler.java:655)
at sun.rmi.server.LoaderHandler.loadProxyClass(LoaderHandler.java:592)
at java.rmi.server.RMIClassLoader$2.loadProxyClass(RMIClassLoader.java:6
28)
at java.rmi.server.RMIClassLoader.loadProxyClass(RMIClassLoader.java:294
at sun.rmi.server.MarshalInputStream.resolveProxyClass(MarshalInputStrea
m.java:238)
at java.io.ObjectInputStream.readProxyDesc(ObjectInputStream.java:1531)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1493)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1
732)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
... 12 moreIt seems to be that it cannot find the Hello class file but this is bundled in Server.jar. Putting Server.jar on the classpath makes no difference.
Any ideas?Cheers, using createRegistry(int) did the trick (along with a few other bits and pieces).
For the sake of aiding others with this kind of problem here's what I did. Remember most of it came from the Sun Java 5 RMI tutorial (http://java.sun.com/j2se/1.5.0/docs/guide/rmi/hello/hello-world.html).
1. Download and compile SUN's class file server (http://java.sun.com/javase/technologies/core/basic/rmi/class-server.zip). You'll need this to serve up the classes. Place this in a different directory to the one your going to use for the RMI tutorial.
2. Download the source files for the tutorial.
3. Use this directory structure (relative to /home/<username>)
| RMI/
| src/
| example/
| hello/
| bin/4. Change the server to the following. The main points to note are the registry is now created (rather than located) and the port number used.
package example.hello;
import java.rmi.registry.Registry;
import java.rmi.registry.LocateRegistry;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
public class Server implements Hello {
public Server() {}
public String sayHello() {
return "Hello, world!";
public static void main(String args[]) {
try {
System.out.println("Starting Server");
Server obj = new Server();
Registry registry = LocateRegistry.createRegistry(2000);
System.out.println("Created registry");
Hello stub = (Hello) UnicastRemoteObject.exportObject(obj, 0);
System.out.println("Exported Server");
// Bind the remote object's stub in the registry
registry.rebind("Hello", stub);
System.out.println("Bound Server to \"Hello\"");
System.out.println("Server ready");
} catch (Exception e) {
System.err.println("Server exception: " + e.toString());
e.printStackTrace();
}5. In the src dir compile with the following;
javac -d ../bin example/hello/*.java6. In the bin dir create the server jar with the following;
jar cvfe Server.jar example.hello.Server example/hello/Server* example/hello/Hello*7. In the bin dir create the client jar with the following;
jar cvfe Client.jar example.hello.Client example/hello/Client* example/hello/Hello*8. Move both Jars out of the bin directory to the parent one (e.g. /home/<username>RMI/) (to prevent the rmi registry / server using the current dir in the classpath if you've set it up that way).
9. Create the policy file in the RMI directory (see above directory structure);
grant codeBase * {
permission java.security.AllPermission;
permission java.net.SocketPermission "*", "accept, connect, listen, resolve";
};10. Start the class file server (read the notes that come with it) in its own directory. Note the port number used (different from RMI registry) and the Jar file on the end of the path.
java ClassFileServer 2001 /home/<username>/RMI/Server.jar11. If this has worked you should be able to visit the URL http://localhost:2001 and get a blank page (as opposed to a broken link notification).
12. Start the RMI server in the bin dir. Note the port is the same as the one used to launch the class file server.
java -Djava.security.policy=policy -Djava.rmi.codebase=http://localhost:2001/ -jar Server.jar13. You should see the following output;
Starting Server
Created registry
Exported Server
Bound Server to "Hello"
Server ready14. Start the client
java -jar Client.jar15. You should see the following output;
response: Hello, world! -
Java.rmi.ServerException Problem
The exception that has occured is java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: Process00Impl_Stub
I have the interface, Client, Server and the Implementation java files
in the same machine.
11/29/2002 08:52p 282 Process00.class
11/29/2002 08:25p 221 Process00.java
11/29/2002 07:40p 215 Process00.java.bak
11/29/2002 08:56p 1,008 Process00Client.java
11/29/2002 08:55p 1,010 Process00Client.java.bak
11/29/2002 08:57p 451 Process00Impl.class
11/29/2002 08:57p 936 Process00Impl.java
11/29/2002 08:52p 934 Process00Impl.java.bak
11/29/2002 08:57p 2,153 Process00Impl_Skel.class
11/29/2002 08:57p 3,938 Process00Impl_Stub.class
11/29/2002 08:56p 995 Process00Server.class
11/29/2002 08:57p 645 Process00Server.java
11/29/2002 08:56p 643 Process00Server.java.bak
I also have the _Stub.class. I do not know why I get this error. If any
one have an idea, kindly share with me.
Thanks.Hi,
I had the same problem. In my machine, path was having jre1.1.7 before my jdk 1.4. So it was picking up from jre1.1.7.
Java was happy when I moved my jdk1.4 path to the beginning of the path variable.
Hope this helps you. -
Hi, I am learning RMI whit SSL and I have a problem, I cant run the example form the RMI SSL tutorials.
I can run the server, and bind the object but the client throw this exception:
HelloClient exception: error during JRMP connection establishment; nested exception is:
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is:
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:274)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:306)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at HelloClient.main(HelloClient.java:60)...
can you help me???Hi,
Dis you solved the probelm ? I am facing the similar exception. I am using jre1.5.0_11.
Regards,
Titas Mutsuddy -
Hi
I'm a novice on RMI and have been trying to learn the concept by copying the HelloWorld RMI example from the Java Tutorials to run on my Windows 98 PC. However, when I issued a DOS command: Java HelloImpl, the following error came up:
" Access denied (java.net.SocketPermission .....1099 connect resolve)"
Any suggestions what possible cause of the problem ?
Thanks.check the permissions in your policy file.
-
when i try to compile my server i get the following errors
D:\JAVA_P~1\SIMPLE~1>javac -classpath . PhoneDirServer.java
PhoneDirServer.java:6: package PhoneDirectory does not exist
import PhoneDirectory.PhoneDirImpl;
^
.\PhoneDirImpl.java:34: class, interface, or enum expected
^
.\PhoneDirImpl.java:12: cannot find symbol
symbol: class PhoneDirInterface
implements PhoneDirInterface {
^
PhoneDirServer.java:29: cannot access PhoneDirImpl
bad class file: .\PhoneDirImpl.java
file does not contain class PhoneDirImpl
Please remove or make sure it appears in the correct subdirectory of the classpa
th.
PhoneDirImpl myObject = new PhoneDirImpl();
^
4 errors
here is my server code
import java.util.Properties;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import PhoneDirectory.PhoneDirImpl;
* Creates a Server and binds the RMI Servant with the IIOP Registry
public class PhoneDirServer {
static final String CONTEXT_NAME = "java.naming.factory.initial";
static final String IIOP_STRING = "com.sun.jndi.cosnaming.CNCtxFactory";
static final String URL_NAME = "java.naming.provider.url";
static final String IIOP_URL_STRING = "iiop://localhost:1000";
* Entry Point to this application
public static void main(String[] args) {
try {
// Create the Object
PhoneDirImpl myObject = new PhoneDirImpl();
// Create the IIOP Initial Context
Properties iiopProperties = new Properties();
iiopProperties.put( PhoneDirServer.CONTEXT_NAME,
PhoneDirServer.IIOP_STRING );
iiopProperties.put( PhoneDirServer.URL_NAME,
PhoneDirServer.IIOP_URL_STRING );
InitialContext iiopContext = new InitialContext( iiopProperties );
// Bind the object to the IIOP registry
iiopContext.rebind( "Phone Directory", myObject );
System.out.println( "Hello from server, ready for action..." );
catch ( Exception exception ) {
exception.printStackTrace ();
}they are all in the same directory ..
PhoneDirImpl.java
PhoneDirInterface.java
PhoneDirServer.javasorry the code is
import java.rmi.*;
import java.rmi.server.*;
import java.io.BufferedReader;
import java.io.FileReader;
import java.util.HashMap;
import java.util.Map;
public class PhoneDirServer extends UnicastRemoteObject
implements PhoneDirInterface {
private Map pbMap = new HashMap();
public PhoneDirServer () throws RemoteException
super();
try {
BufferedReader br = new BufferedReader(new FileReader("numbers.txt"));
String line;
while ((line = br.readLine()) != null)
String[] info = line.split(":", 2);
pbMap.put(info[0], info[1]);
catch (Exception exc) {
exc.printStackTrace();
System.exit(1); }
public String getPhoneNumber(String name) {
return (String) pbMap.get(name); }
public boolean addPhoneNumber(String name, String num) {
if (pbMap.containsKey(name)) return false;
pbMap.put(name, num); return true; }
public boolean replacePhoneNumber(String name, String num) {
if (!pbMap.containsKey(name)) return false;
pbMap.put(name, num); return true;
public static void main ( String args[] ) throws Exception
// Assign a security manager, in the event that dynamic
// classes are loaded
if (System.getSecurityManager() == null)
System.setSecurityManager ( new RMISecurityManager() );
// Create an instance of our service server ...
PhoneDirServer server = new PhoneDirServer();
// ... and bind it with the RMI Registry
Naming.bind ("PhoneBook",server);
System.out.println ("Service bound....");
}and the interface is
import java.rmi.Remote;
import java.rmi.RemoteException;
* This is an interface to a component that looks up
public interface PhoneDirInterface extends Remote {
public String getPhoneNumber(String name) throws RemoteException;
public boolean addPhoneNumber(String name, String num) throws RemoteException;
public boolean replacePhoneNumber(String name, String num)throws RemoteException;
} -
RMI connectivity problem (multi-NIC)
I'm developing a simple photo share program with Java RMI.
I connect rmiregistry (192.168.100.3), it returns the object reference, but when I invoke a method I get problems.
My server (remote) - 192.168.100.3 - reply with an address of another NIC - 192.168.62.1 (from VMware). I print out the Proxy object, and I was surprised when I saw 192.167.62.1 address, instead 192.168.100.3. My client is running on 192.168.100.1 address.
Why is this happening?
When I turned off the VMware virtual NICs, I was successful. I want to understand what is going on, and if is there a way to fix this issue.
$ java rmi.Client
Looking...object found!
Proxy[PhotoShare,RemoteObjectInvocationHandler[UnicastRef [liveRef: [endpoint:[192.168.62.1:58343](remote),objID:[4cc5973e:11de2bb065b:-7fff, 4037313925566802436]]]]]
Exception in thread "main" java.rmi.ConnectIOException: Exception creating connection to: 192.168.62.1; nested exception is:
java.net.SocketException: Network is unreachable
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:614)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:198)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:184)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:110)
at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:178)
at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:132)
at $Proxy0.listaFotos(Unknown Source)
at rmi.Client.main(Client.java:26)
Caused by: java.net.SocketException: Network is unreachable
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:519)
at java.net.Socket.connect(Socket.java:469)
at java.net.Socket.<init>(Socket.java:366)
at java.net.Socket.<init>(Socket.java:180)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:595)
... 7 moreEdited by: pantony on Nov 28, 2008 3:26 AM
Edited by: pantony on Nov 28, 2008 3:27 AMSee item A.1 of the [RMI FAQ|http://java.sun.com/j2se/1.5.0/docs/guide/rmi/faq.html].
-
Hello
I want to write a client server application using rmi and eclipse, where many clients are able to register to the server. The server has a string attribute and a client should be able to pass a string object to the server and the server replaces the value of his attribute with the sent string and notifies all registered clients of the new value. In a later step the server writes to a mysql database and notifies the clients about changes in the database, but that is later...
I use eclipse for developing.
Here is the remoteinterface of the server:
package com.iz.rmi.server;
import java.rmi.*;
import java.rmi.server.*;
import com.iz.rmi.client.IObserver;
public interface ISubject extends Remote
public void registerClient(IObserver obs) throws RemoteException, ServerNotActiveException;
public void notifyObervers() throws RemoteException, ServerNotActiveException;
} the remoteinterface of the client:
package com.iz.rmi.client;
import java.rmi.*;
import java.rmi.server.*;
public interface IObserver extends Remote
public void sendNotify(String notification) throws RemoteException, ServerNotActiveException;
}the implementation of the server interface:
package com.iz.rmi.server;
import java.net.MalformedURLException;
import java.rmi.*;
import java.rmi.server.*;
import java.rmi.registry.*;
import java.util.*;
import com.iz.rmi.client.*;
public class Subject extends UnicastRemoteObject implements ISubject
private Vector<IObserver> obs;
private String service;
public Subject() throws java.rmi.RemoteException
super();
this.obs = new Vector<IObserver>();
@Override
public void notifyObervers() throws RemoteException, ServerNotActiveException
Iterator<IObserver> obsIt = this.obs.iterator();
while(obsIt.hasNext())
IObserver o = obsIt.next();
try
o.sendNotify("blabla");
catch (Exception e)
e.printStackTrace();
@Override
public void registerClient(IObserver obs) throws RemoteException, ServerNotActiveException
System.out.println("client registered");
this.obs.add(obs);
public static void main(String[] args)
if (System.getSecurityManager() == null)
System.setSecurityManager(new SecurityManager());
try
String name = "Observable";
ISubject engine = new Subject();
//ISubject stub = (ISubject) UnicastRemoteObject.exportObject(engine, 0);
LocateRegistry.createRegistry(1099);
Registry registry = LocateRegistry.getRegistry(1099);
registry.rebind(name, engine);
System.out.println("ComputeEngine boundlll");
catch (Exception e)
System.err.println("ComputeEngine exception:");
e.printStackTrace();
} and the implementation of the client interface
package com.iz.rmi.client;
import java.rmi.*;
import java.rmi.server.*;
import com.iz.rmi.server.*;
public class Observer extends UnicastRemoteObject implements IObserver
private String host;
private String service;
private ISubject sub;
public Observer(String host, String service) throws RemoteException
this.host = host;
this.service = service;
System.out.println("Service: " + service);
try
this.sub = (ISubject) Naming.lookup(this.service);
this.sub.registerClient(this);
System.out.println(" istered");
catch(Exception e)
System.out.println("Unable to connect and register with subject.");
e.printStackTrace();
@Override
public void sendNotify(String notification) throws RemoteException,
ServerNotActiveException
public static void main(String[] args)
try {
new Observer("192.168.1.34:1099", "Observable");
} catch (RemoteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}Both programs get started with this vm-argument:
-Djava.security.policy=C:\daten\noSpring\Obsv\wideopen.policy
where wideopen.policy looks like this for testing:
grant {
// Allow everything for now
permission java.security.AllPermission;
};when I start the server all looks fine, but when I start the a client i become just the output.
Service: Observable
isteredinstead of
Service: Observable
client registerd
isteredThere are no exceptions or something like that, but it seems that the registerClient()-method does not get called on the server when the client starts. There were many changes since the last time I used rmi, so I don't know what's wrong here. I hope some one can help me with this problem.
Kind regards,
MichaelThe server's System.out.prints will go to the server's console on the server host.
Not interleaved wih the client's output on the client's console on the client host. -
Java.rmi.NoSuchObjectException problems
Hello,
After calling home.create() in my code, passing in primary key and
additional column data, when I call home.findByPrimaryKey (primkey)
followed by a call to one of the methods in the bean, I immediately get
a a java.rmi.NoSuchObjectException.
An exception is not thrown when calling home.findByPrimaryKey (primkey)
so it is safe to assume that a reference has been obtained to the bean
with the data I am looking for, correct? If so, why am I getting this
exception:
java.rmi.NoSuchObjectException: Bean with primary key: 'Pat Hardy' not
found in
home: 'Student'
at
weblogic.ejb.internal.EntityEJBContext.load(EntityEJBContext.java:153
at
weblogic.ejb.internal.EntityEJBContext.afterBegin(EntityEJBContext.ja
va:212)
at
weblogic.ejb.internal.StatefulEJBObject.getContextForInvoke(StatefulE
JBObject.java:162)
etc.
etc.
etc.
Any ideas of what I might be doing wrong?
Thanks for your help in advance.We had a similar problem, although I don't know if it was the same
thing. We are using WL 5.1, sp5, with Oracle 8.1.6.
I have a stateless session bean, which had a transactional attribute
of 'Supports'. It would call an entity bean with transactional attribute
of 'RequiresNew' for all methods. The session bean would do a finder
on the entity bean, and if it got an ObjectNotFoundException, it would
then create the entity bean with a call to home.create(id). Then, it would
call a business method on the entity bean.
For some reason, in the case where the session bean is called from within
a thread that already had a transaction started, the call to the entity
bean business method would hang, if an only if it had to create a new
bean first. If the finder of the bean succeeded, there would be no hang.
Sometimes, instead of hanging, it would return a NoSuchObjectException.
If the stateless bean were called outside of a transaction, would always
succeed, regardless.
So, my fix, was to set the transactional attribute for the stateless bean to
'NotSupported' for all methods. It now seems to work in all cases,
no more hangs or NoSuchObjectExceptions....
Is this expected behavior? Is this related to the same problem?
The BEA recomendations to use READ-COMMITTED are useless for
the case where you are running a clustered environment, and where you
need to have the bean deployed on all servers in the cluster for
fail-over reliability.....
Jason
"Korey Shronts" <[email protected]> wrote in message
news:[email protected]...
I dont' know about the mapping to CHAR but we've managed to fix our nosuch
object problem.
BEA sent me this snippet:
The bug is as follows
In Oracle (8.0.5), if there is a primary key constraint AND you use an
isolation
level of SERIALIZABLE, an insert followed by an update in the same
transaction
fails. Specifically, the insert succeeds (to all outward indications),
but the update fails (the returned count is 0) after some number of
iterations.
What's the workaround? If the customer is not sharing the database with
any
other app or running it under a cluster, tell them to set the isolation
level to
read_committed. Serializable only slows them down without any added
benefit.
If clustering is on, and serializable behavior is deemed essential for
this
particular bean, maybe they can deploy the bean on only one of the
servers
to reduce it to the case above.
I set the isolation level on our beans to read_commited. Fixed theproblem
although we're using Oracle 8i not 8.0.5.
<[email protected]> wrote in message
news:[email protected]...
Well, it appears, that you cannot map a java.lang.String to a CHAR inOracle.
A java.lang.String can be mapped to a VARCHAR2.
Is this a bug?
[email protected] wrote:
I just install WebLogic server 5.1.0 and SP5 on a new machine.
Still have the same problems.
Will keep you posted.
Korey Shronts wrote:
We're having the same problem. I've opened a case with BEA but
haven't
heard anything yet. If you find the solution let me know!
[email protected]
<[email protected]> wrote in message
news:[email protected]...
I accidently omitted the first line in the exception. Sorry aboutthat.
Here it is again from the beginning:
Thu Sep 21 08:52:12 EDT 2000:<I> <EJB JAR deploymentC:/wlogic/lib/S.jar>
Transa
ction: '969540638993_1' rolled back due to EJB exception:
java.rmi.NoSuchObjectException: Bean with primary key: 'Pat Hardy'not
found in
home: 'Student'
at
weblogic.ejb.internal.EntityEJBContext.load(EntityEJBContext.java:153
at
weblogic.ejb.internal.EntityEJBContext.afterBegin(EntityEJBContext.ja
va:212)
at
weblogic.ejb.internal.StatefulEJBObject.getContextForInvoke(StatefulE
JBObject.java:162)
etc.
etc.
etc.
Any ideas of what I might be doing wrong?
Thanks for your help in advance.
[email protected] wrote:
Hello,
After calling home.create() in my code, passing in primary key
and
additional column data, when I call home.findByPrimaryKey(primkey)
followed by a call to one of the methods in the bean, Iimmediately get
a a java.rmi.NoSuchObjectException.
An exception is not thrown when calling home.findByPrimaryKey(primkey)
so it is safe to assume that a reference has been obtained to
the
bean
with the data I am looking for, correct? If so, why am I gettingthis
exception:
java.rmi.NoSuchObjectException: Bean with primary key: 'Pat
Hardy'
not
found in
home: 'Student'
at
weblogic.ejb.internal.EntityEJBContext.load(EntityEJBContext.java:153
at
weblogic.ejb.internal.EntityEJBContext.afterBegin(EntityEJBContext.ja
va:212)
at
weblogic.ejb.internal.StatefulEJBObject.getContextForInvoke(StatefulE
JBObject.java:162)
etc.
etc.
etc.
Any ideas of what I might be doing wrong?
Thanks for your help in advance. -
Hi
I have just put RMI into my app and it works fine, connects to a remote server, runs a method on the server and returns the results.
The problem is when I try to use a line like:
URL url = MyClass.class.getResources("image/save.gif");
The url is null. This code will work before my RMI function is run. Also, every dialog the application opens after running RMI has a line at the top of the pane saying: "Java Applet Window".
Is RMI playing with the Classloader?
Do I have to instaniate the ClassLoader or do something else to get my resources again and get rid of the text on each of the dialog boxes???
Thanks in advance.if your class is Remote object, you use the RMI CLassLoader when you do:
URL url = MyClass.class.getResources("image/save.gif");you shoud use instead:
URL url = Classloader.getSystemResources("image/save.gif");
Maybe you are looking for
-
How to download the recorded video from my ipad to my PC ?
How to download the recorded video from my ipad to my PC?
-
Best way to cut clips out of a long long capture
Hi all, I shoot underwater footage. I don't usually stop/record/stop during a dive and most of the time my camera is always shooting. As a result when I capture, I get a long clip which really has multiple scenes (descent, swim around, wreck penetrat
-
Hi. Im using EP6 SP2 and i am working on modifying the standard teamviewer such that any userid can be passed to the standard teamviewer so that I can view subordinates corresponding to that userid. Ive created my own teamviewer class similar to the
-
What version of windows is compatible with Photoshop 12.1 x32
I currently have Photoshop 12.1 x32 running on Windows 7 Home Premium This computer is shot, so I need to buy a new one. Should I stick to Windows 7, or can I go with 7 or 8 depending on what I find. I will not be upgrading to CS6 anytime soon, so I
-
I am using Oracle Forms [32 Bit] Version 10.1.2.3.0 My Forms runtime settings where we specify the default browser, Application Server URL etc are not getting saved. Meaning when I exit out and open Forms builder again , I am having to specify this a