RMI observer problem

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,
Michael

The 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.

Similar Messages

  • RMI + Observable/Observer trouble

    I'm trying to develop the following:
    Local:
    A Swing JFrame object which contains some JPanels that should Observe the actions of server's BusinessLogic.java
    Both sides:
    An interface that contains the declaration of the methods in server's business logic.
    RemoteObserver.java
    RemoteObservable.java
    RemoteObserverImpl.java
    RemoteObservableImpl.java
    Server:
    One Observable class that contains the business logic and notifies some changes and implements the Interface.
    Other classes.
    I'm using the latest JDK version.
    I have some classes to do the RMI + Observable/Observer thing but I don't know how to apply them to my application.
    Here's what i've done so far:
    public class MainFrame extends JFrame {
         public static final String serviceName = "RemoteServer";
         private String host = "localhost";
         private RemoteBusinessLogicInterface remoteLogic;
         public MainFrame(String frameTitle) {
              super();
              setTitle(frameTitle);
              setSize(700, 600);
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              System.setProperty("java.security.policy", "client.policy");
              setRemoteServer();
              ObserverPanel observerPanel = new ObserverPanel(
                        remoteLogic);
              getContentPane().setLayout(new BorderLayout());
              getContentPane().add(observerPanel, BorderLayout.CENTER);
              this.setVisible(true);
         public void setRemoteServer(){
              try {
                   if (System.getSecurityManager() == null)
                        System.setSecurityManager(new RMISecurityManager());
                   String rmiUrl = "rmi://" + host  + "/" + serviceName;
                   remoteLogic = (RemoteBusinessLogicInterface) Naming.lookup(rmiUrl);
              } catch (ConnectException ex) {
              } catch (UnknownHostException ex) {
              } catch (Exception ex) {
         public static void main(String[] args) {
              MainFrame f = new MainFrame("Title");
    public class ObserverPanel extends JPanel{
         private DefaultListModel items;
         private JList list;
         public ObserverPanel(RemoteBusinessLogicInterface remoteLogic) {
              items = new DefaultListModel();
              list = new JList(items);
              list.setVisibleRowCount(24);
              JScrollPane scrollPane;
              scrollPane = new JScrollPane(list);
              setLayout(new BorderLayout());
              add(scrollPane,BorderLayout.CENTER);
         public void update(RemoteObservable observable, Object objektua) {
              System.out.println("Change notified");
    public interface RemoteBusinessLogicInterface extends RemoteObservable{
         public void insertData(int number, String code, Date date) throws RemoteException;
         public void submit() throws RemoteException;
         public void clear() throws RemoteException;
    class RemoteBusinessLogic extends RemoteObservableImpl implements
              RemoteBusinessLogicInterface {
         public static final String serviceName = "RemoteServer";
         public RemoteBusinessLogic() throws RemoteException {
         public void clear() throws RemoteException {
              setChanged();
              super.notifyObservers();
         public void insertData(int number, String code,
                   Date date) throws RemoteException {
              System.out.println("Something");
              setChanged();
              super.notifyObservers();
         public void submit() throws RemoteException {
              System.out.println("Something");
              setChanged();
              super.notifyObservers();
         public static void main(String[] args) {
              System.setProperty("java.security.policy", "client.policy");
              if (System.getSecurityManager() == null)
                   System.setSecurityManager(new RMISecurityManager());
              try {
                   RemoteBusinessLogic serverObject = new RemoteBusinessLogic();
                   try {
                        java.rmi.registry.LocateRegistry.createRegistry(1099);
                        Naming.rebind(serviceName, serverObject;
                        System.out.println("Server launched");
                   } catch (MalformedURLException e) {
                   } catch (Exception e) {
              } catch (RemoteException e1) {
    }RMI works OK, but I don't know how to tell the server which are his observers. I know I have to use the addObserver (RemoteObserver ro) method but I don't know how to tell the server which are the GUI instances (which are the observers) so that I can add them.
    Any help will be welcomed. Thanks.
    Bye.

    Hello Vitor,
    Simply have your clients give your observable server object a remote reference to their observer object.
    It would look something like this:
    server.addObserver(new Remote(myObserver));Your server object would keep a list of its observers, and call them whenever it wants, using some interface method like:observer.stateChanged(someData);Essentially, design it just as if the observers were local.
    John

  • 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 Taggart

    Cameron
    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

  • RMI Observer probs

    Hi, I'm having serious probs getting my head round using Observable/Observer classes as well as RMI. Because double-inheritance isn't allowed, you can't use both - I've search around for answers but they either don't explain directly what to do or not at all.
    I've read that you need to implement your own classes which have the functionality of the observerable/observer classes and use them. The problem is I have no idea how to go about this - the more I read the more confused I get as most sites seem to have a different way of doing it.
    Any help would be most appreciated. Thanks

    Well you just need a RemoteObserver interface and remote implementation class, and a RemoteObservable interface that specifies all the methods of Observable, and a remote implementation of that. How you do it is up to you.

  • 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.

  • RMI SSL problem

    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

  • RMI Rebind problem

    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.

  • 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 AM

    See item A.1 of the [RMI FAQ|http://java.sun.com/j2se/1.5.0/docs/guide/rmi/faq.html].

  • Got a RMI Client problem

    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:
    joederonde

    try
    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).

  • 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.

  • GetResources() gives null's after using RMI (ClassLoader problem???)

    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");

  • RMI activation problem under LINUX

    When I try to run the activation example from the RMI tutorial, I get the following exception:
    Exception in thread "main" java.rmi.activation.ActivationException: ActivationSystem not running; nested exception is:
    java.rmi.NotBoundException: java.rmi.activation.ActivationSystem
    at java.rmi.activation.ActivationGroup.getSystem(ActivationGroup.java:453)
    at examples.activation.Setup.main(Setup.java:68)
    Caused by: java.rmi.NotBoundException: java.rmi.activation.ActivationSystem
    at sun.rmi.registry.RegistryImpl.lookup(RegistryImpl.java:106)
    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.java:701)
    at java.lang.Thread.run(Thread.java:536)
    at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
    at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
    at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:350)
    at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
    at java.rmi.Naming.lookup(Naming.java:84)
    at java.rmi.activation.ActivationGroup.getSystem(ActivationGroup.java:449)
    ... 1 more
    This is with J2SE 1.4.1 on RedHat 7.3 running a vanilla 2.4.18 kernel. I'm running everything out of shell scripts to keep from getting bitten by typos.
    Here's the punchline: The identical code works just fine on RedHat 6.2 (kernel 2.2.14 or so) - same 1.4.1.
    Netstat tells me there is something listening on the appropriate ports, and output from strace suggests that there is some traffic back and forth to the server. There is no firewall running - I unloaded ipchains in the interest of paranoia. (There is firewalling running on the working system, go figure...)
    Help? I can post more details if that would help resolve the problem.

    I wrote
    When I try to run the activation example from the RMI
    tutorial, I get the following exception:<snip>
    The key was this:
    The identical code works just
    fine on RedHat 6.2 (kernel 2.2.14 or so) - same 1.4.1."Identical" really was - I'd used a tar archive to make a complete copy of the code running on the RH 6.2 system. The copy included the file log/Logfile.1, written by rmid (or rmiregistry). This contains lots of IP addresses; I suspect it's more than a log. Since the original machine and the clone are separated by a firewall, attempts by the clone to contact the original failed.
    Deleting the "log" directory made the problem go away.

  • RMI version problem

    Hi,
    I have a problem :D. In order to verify clients access to my application I have to use an RMI. The application server I'm running my app on has JVM 1.4 but the RMI is written in at least v5.0, it uses collection framework with abstract implementations ( List<String> and other features not avaliable in Java 1.4 ).
    Is there an easy workaround to this problem or is there a trivial solution?
    Should I write a web service to work as a fascade for the RMI?
    Any help will be greately appreciated!
    Thanks in advance, Martin.

    5.0 is compatible with 1.4. So clients running 5.0 will not have any problem accessing your application which is running in 1.4.
    When you say the RMI is 5.0, do you mean the client's RMI, or the RMI your application will use? Im kind of confused with the way you injected the application server into the mix.

  • RMI Server and RMI Client Problem

    First, Hi!
    I have create my RMI Server and a RMI Servlet client.
    I can run the server and servlet first time and it works fine.
    Then, I stop rmiregistry and server.
    Then, I start rmiregistry and server for a second time but my RMI Servlet client gets a
    java.rmi.ConnectException: Connection refused to host: xxx.xxx.xxx.xxx; nested exception is: java.net.ConnectException: Connection refused
    If I copy the class again where the servlets resides, it works again. But I have to keep doing that. I have to keep copying the class file to the servlet directory every 2nd time I try to run it for it to work.
    Anyone know what am I doing wrong?

    First, Hi!
    I have create my RMI Server and a RMI Servlet client.
    I can run the server and servlet first time and it
    works fine.
    Then, I stop rmiregistry and server.
    Then, I start rmiregistry and server for a second time
    but my RMI Servlet client gets a
    java.rmi.ConnectException: Connection refused to host:
    xxx.xxx.xxx.xxx; nested exception is:
    java.net.ConnectException: Connection refused
    If I copy the class again where the servlets resides,which class file ? u mean RMIServer's class files ??
    I have faced the same problem too. In my case if i just restart my Tomcat webserver the error goes and the servlet is very well able to connect back to the RMI Server
    it works again. But I have to keep doing that. I have
    to keep copying the class file to the servlet
    directory every 2nd time I try to run it for it to
    work.
    Anyone know what am I doing wrong?

  • 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?

Maybe you are looking for

  • Seeking advice regarding the purchase of an external hard drive for audio

    Hi, Two questions: 1. I have 2 firewire ports on my iMac. Currently I have an Edirol FA-66 plugged into one of these and the other is free. These ports appear to be identical. Can I plug a firewire 800 hard drive into these or am I limited to firewir

  • In my folder "Pictures" - the same picture figure more than once

    When I move pictures from my iPhone to Iphoto my MacBook Pro, I get this problem.... My photos below Finder - > Pictures , appears twice and sometimes more than twice. This also happens to my pictures from music albums. It's annoying , since I now ha

  • Error when connecting to jvm

    I've created a database in 9ias and i also selected the option of jvm. but whenever i go into the enterprise manager and try to connect to the jvm it gives me an error the error is VDJSERVER-1516 failed to get a new jserver session. and during the da

  • Problems with Big Bang Fuzion

    I have been having a world of problems with this motherboard. It a long story but I will start with what is going on now. The machine has some of the strangest behavior. 10-30 minute boots. This happens every time I boot the machine after the first r

  • Proxy files not linking in server

    Couple issues going on here. I added a final cut pro project to the server yesterday and the Server began compressing all the files. After thumbnails and poster frames, I am only doing edit proxies currently because I need them sooner. I saw the comp