NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

RMI Listener and general app client problem..

 
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users
View previous topic :: View next topic  
Author Message
chehtke



Joined: 14 Jan 2009
Posts: 1

PostPosted: Wed Jan 14, 2009 2:35 pm    Post subject: RMI Listener and general app client problem.. Reply with quote

hi,

i just downloaded the latest netbeans version and its great!

im facing some problems when using ejb3 beans and an application client.

first of all i will post my code. then i will describe my problems with that code...

i have a project EPTest-ejb:
TestRemote.java:
Code:
import javax.ejb.Remote;

@Remote
public interface TestRemote {
    void setListener(TestListener listener);
    void doSomeThingOnServer(Object o);
    String getString();
}

TestLocal.java:
Code:
import javax.ejb.Local;
@Local
public interface TestLocal {
    void doSomethingOnListener(Object o);
}

TestListener.java:
Code:
import javax.ejb.Remote;
@Remote
public interface TestListener {
    void doSomethingOnListener(Object o);
}


TestBean.java:
Code:
import javax.ejb.Stateful;
@Stateful
public class TestBean implements TestRemote, TestLocal {
    private TestListener listener=null;
    public void setListener(TestListener listener) {
        this.listener = listener;
    }
    public void doSomeThingOnServer(Object o) {
        this.doSomethingOnListener(o);
    }
    public void doSomethingOnListener(Object o) {
        this.listener.doSomethingOnListener(o);
    }
    public String getString() {
        return "ejb3 string...";
    }

}

---------------------------

and i have a project called EPTest-app-client:
Main.java
Code:

import java.io.IOException;
import java.io.Serializable;
import javax.ejb.EJB;
public class Main implements Serializable, TestListener {
    @EJB
    private static TestRemote testBean;
    public static void main(String[] args) throws IOException {

        TestListener x = new Main();
        System.out.println(testBean.getString());
        testBean.setListener(x);
        testBean.doSomeThingOnServer("Do something on server. The server has to publish an event to me after it did something.");
        System.in.read();
        System.in.read();
    }
    public void doSomethingOnListener(Object o) {
        System.out.println(o.toString());
    }

}

so basically everything the application should do is connect to the ejb (TestBean), invoke the gestring function just as a test. after that a listener needs to be added to the ejb. after the listener has been added, i will call the dosomethingonserver method. the dosomethingonserver method will invoke the dosomethingonlistener method.

i am experiencing different errors at different time!
in debug mode the application will start and connect to ejb. but when i call testBean.setListener(x) there is an exception saying:

Code:
14.01.2009 15:26:46 com.sun.enterprise.appclient.MainWithModuleSupport <init>
WARNUNG: ACC003: Ausnahmefehler bei Anwendung.
javax.ejb.EJBException: nested exception is: java.rmi.MarshalException: CORBA MARSHAL 1398079745 Maybe; nested exception is:
        org.omg.CORBA.MARSHAL: ----------BEGIN server-side stack trace----------
org.omg.CORBA.MARSHAL:   vmcid: SUN  minor code: 257 completed: Maybe
        at com.sun.corba.ee.impl.logging.ORBUtilSystemException.couldNotFindClass(ORBUtilSystemException.java:9684)
        at com.sun.corba.ee.impl.logging.ORBUtilSystemException.couldNotFindClass(ORBUtilSystemException.java:9699)
        at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:1042)
        at com.sun.corba.ee.impl.encoding.CDRInputStream.read_value(CDRInputStream.java:475)
        at com.sun.corba.ee.impl.presentation.rmi.DynamicMethodMarshallerImpl$14.read(DynamicMethodMarshallerImpl.java:368)
        at com.sun.corba.ee.impl.presentation.rmi.DynamicMethodMarshallerImpl.readArguments(DynamicMethodMarshallerImpl.java:435)
        at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:152)
        at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:687)
        at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:227)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1846)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1706)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:1088)
        at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:223)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:806)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.dispatch(CorbaMessageMediatorImpl.java:563)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.doWork(CorbaMessageMediatorImpl.java:2567)
        at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:555)


i absolutely dont understand this error. i did not change any configuration or something. the code ran few hours ago. without any problems.

also i have a problem using the run functionality:
when i use "run" to start the project (app-client) i get an exception:

Code:
 com.sun.enterprise.appclient.MainWithModuleSupport <init>



Code:
java.lang.NullPointerException
        at com.aastra.hermes.Main.main(Main.java:17)


seems to be that testBean variable is null here. how can that be. isnt debug and run mode nearly the same?

the main class is configured to be run at run Wink

----------------------

and now the third and for me biggest problem:

as i mentioned earlier i had the code running without any exception some hours ago. but it behaved strange at least in netbeans ide.
when the doSomeThingOnServer method is executed, it called the doSomeThingOnListener() method. but this code was never reached. there was no exception, but the doSomeThingOnListener method was not executed as i did not have any output in my output window.

thanks in advance for your time and help
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo