Remote Interface question

I have a remote Interface as follows.
public interface AccessDataBaseI {
List retrieveItems(Object id) throws ApplicationException;
The ApplicationException extends RemoteException.
public class ApplicationException extends RemoteException {
public AppException () {}
public AppException (String msg) {
super(msg);
I build compile the application and I dont have a problem .When I deploy it to the server I get the following error message .
method retrieveItems(Object id) defined in the remote interface must include java.rmi.RemoteException in its throws clause.
It includes the ApplicationException in its signature which extends RemoteException .
Any ideas what could be wrong and how to over come this .
I am using weblogic 8.1.4 .
Thanks for your help.

It's not a good idea to subclass RemoteException for your ApplicationException. RemoteException
should be preserved for system level failures. I would recommend instead subclassing
java.lang.Exception. If you're using the EJB 3.0 Remote business interface there is no longer
a requirement to declare RemoteException on each method signature.
--ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Similar Messages

  • How to specify a base class for Remote Interface in Workshop 9.2? -- URGENT

    Hi,
    I am trying to create a UUP EJB in WebLogic 9.2 workshop. I am using @FileGeneration to create my home & remote interfaces. And the generated remote interface is extending javax.ejb.EJBObject;I want my remote interface to extend com.bea.p13n.property.EntityPropertyManager which in turn implements javax.ejb.EJBObject. Can someone tell how i can do it in Workshop?.
    I came across Predefined Variable: remote.baseClass and as per docume
    ntation..."If specified, the value of this variable will be used as the base class for all generated remote classes. Where i should specify it?. @FileGeneration does nt have any option for it. Any help is grtly appreciated.
    Following are my code snippets:
    IMPL Class
    @FileGeneration(remoteClass = Constants.Bool.TRUE,remoteHome = Constants.Bool.TRUE, localClass = Constants.Bool.FALSE, localHome = Constants.Bool.FALSE,remoteClassName = "MyEntityPropertyManager",remoteHomeName = "MyEntityPropertyManagerHome")
    public class MyEntityPropertyManagerImpl extends GenericSessionBean implements
              SessionBean {
    //code
    }

    This question was posted to both the bea.workshop.developer.general and weblogic.developer.interest.workshop (I had replied to the later on 10/19); after seeing an identical question today on this list want to include a reference to that reply here:
    http://forums.bea.com/bea/message.jspa?messageID=600044925&tstart=0
    -Rob

  • Remote interface distribution

    Hi,
    I am just learning to use RMI, have a typical setup, Server and Client and everything works fine, BUT.......
    I have compiled my remote classes, ie RmtServer, RmtServerImpl, then run the rmiregistry
    and then started the service, so far so good.
    I then compile etc the Client class and run
    My question is this, I am currently working from the same directory for all classes, I would like to truly
    distribute the client and server. Do I need to put a copy of the RmtServer interface on the client?
    Currently in my client I have the line:
    RmtServer server = (RmtServer)Naming.lookup("rmi://" + serverHost + "/ProjectServer");
    I have been reading about dynamic class loading but I am slightly confused!!!
    It says that the stubs created by running "rmic" on the server classes can be loaded dynamically, thats great, but the stubs created and the RmtServer interface are not the same thing. If I have to have a "local" copy of every interface I want to use then it seems a bit limited.
    My impression was that I could specify a location for a class repositry on a remote machine and then
    instantiate classes from the server on the local machine! So then I would only need to have one interface on the client to enable me to connect to the server for the first time!!!
    Im really confused as people can probably tell. Any help would be really appreciated

    The purpose of dynamic loading is really so that you don't have to distribute the stub, or the implementation classes of any interfaces.
    You can certainly load the remote interface dynamically from the codebase in the client, e.g. with URLClassLoader, but you will also have to have already loaded all the classes that use the remote interface the same way, rather than via the system class loader. Otherwise they won't load (NoClassDefFoundError). You can download the entire client actually, and this is not a bad way to go: see the the RMI 1.1 Specification, 'Bootstrapping the client', for details (if you can find it: try http://java.sun.com/products/archive/jdk/1.1/index.html), and the RMI-USERS archives of about five-six years ago for discussions (see http://archives.java.sun.com/archives/rmi-users.html). The description of this was removed from the 1.2 specification for some reason, and I did encounter problems migrating a 1.1 bootstrap client to 1.2, so beware.

  • Location of stubs, skeletons, remote interface ,client and server files

    I have a question to the subject mentioned above :
    In a training example for RMI I red the following :
    .... stubs, remote interface and client files into
    client location
    ... skeletons, remote interfaces, server files and stubs
    into server location ....
    I understand that with the exception that the stubs must also be located at server side. My understanding is
    that it is enough if those reside only at client side. Is that
    right or wrong ?
    Thanks for your comment.
    Regards,
    Oskar

    The stubs must be available (in the classpath) on the server side. This is because when a remote server object is exported, the RMI runtime creates an instance of the stub (instead of the server) and sends it whenever a reference to the server is encountered. In order to create (and then serialize) the stub, its class file must be available on the server.

  • Returning a remote interface as a polymorphic form of its superinterface.

    Hi all
    I have a remote interface 'remoteinterface1'
    of a statless session enterprise java bean extending an interface 'BusinessInterface' that has some business methods.
    Can a business method 'getObj()' of the bean return a polymorphic form of the above remote interface as 'BusinessInterface' i.e.
    public BusinessInterface getObj()
    //some conditional check is done here; if true
    return remoteinterface1;
    Does doing as above violate any EJB specifications. If so what could be the alternative.
    Any input at the earliest is highly appreciated.
    Thanks.

    Hello,
    Hi
    Thanks for the quick reply.
    I guess I might be asking the same question but just
    wanted to confirm again by expressing one more doubt:
    If the remote interface is casted to Business
    Interface;
    Later when I check if the business interface is an
    instanceof the remoteinterface, will it be actual
    remote interface i.e. since we are casting to
    business interface(a simple interface and thus not an
    RMI aware object), would the remote interface loose
    any RMI features and thus violate EJB
    specifications.You don't have to worry at all if you access a remote object (in an RMI or EJB context) through a particular interface. You just have to make sure that the interface follows the RMI rules.
    This could be very useful if you want to create a number of different "views" for a remote object.
    Consider for example the following:
    class SomeRemoteObject implements A, B, ... {
       public void doSomething1() throws RemoteException {
       public void doSomething2() throws RemoteException {
    interface A {
       public void doSomething1() throws RemoteException;
    interface B {
       public void doSomething2() throws RemoteException;
    interface RemoteInterfaceOfSomeRemoteObject extends A, B, ... {
    }Interfaces A and B follow the RMI regulations. In this case you could access the remote object through A which disables access to doSomething2() which in turn is only accessible through B. Ofcourse the remote interface should contain the methods that you want to access remote for example by extending A and B.
    public A getAnAObject() {
    A anAObject = getAnAObject();
    anAObject.doSomething1();
    System.out.println(anAObject instanceof RemoteInterfaceOfSomeRemoteObject); // true
    System.out.println(anAObject instanceof B); // true
    System.out.println(anAObject instanceof java.rmi.Remote); // trueThere are indeed subtle differences in setting up the remote system (EJB or plain RMI) but the same principles always apply.
    Hope it helps.
    >
    Thanks in advance.

  • Role of Remote Interface in EJB 2.0

    Hi,
    Recently I was working upon a sample application for developing Entity Bean, the Home interface had a method which provided Business functionality. The implementation of the method was given in the Bean Class by preceeding the name of the method by ejbHome.
    This method was callable by just looking up the Entity Bean, thus not requiring the need for the Remote Interface.
    Now my question is why was this kind of work around required? This totally removes the need for the remote interface, if the Bean Writer decides so.
    The practices suggest that any functionality to the client should be provided via remote interface, and Home interface should contain only the methods related to life cycle of the EJB, then why to have business methods in the Home Interface.
    Please clarify.

    Bhushan!,
    I hope you getting the whole context wrong!.
    As I said earlier if you want to operate on your persistent data, then you must either find an entity bean through ejbFind() or create a new one using ejbCreate ().
    However ejbHome methods provide a functionality which is independent of the persistent data that the bean represents. For ex. Suppose you have an entity bean User that maps to a user database then in order to operate on user data you will always need a remote interface.
    However if you need some information from the bean which is independent of user data then, for ex. you want to say Hello to your clients, you need to implement this functionality using ejbHome () methods.
    I hope this helps.
    VJ

  • Is the remote interface implemented by some class

    Hi,
    I have a simple question, googled, no help.
    I am trying to udnerstand, where exactly is the remote interface implemented ?
    I mean, i know that it contains all the business methods which have a body in the bean.
    But is the remote interface implemented somewhere ? Is there any class which implements the Remote interface ?
    thanks
    S

    Sarvananda wrote:
    Hi,
    I have a simple question, googled, no help.look better...
    I am trying to udnerstand, where exactly is the remote interface implemented ?
    I mean, i know that it contains all the business methods which have a body in the bean. so, that's what implements it :)
    But is the remote interface implemented somewhere ? Is there any class which implements the Remote interface ?
    the bean class :)
    But the actual implementor is a class generated by the appserver that delegates to the bean class.

  • Handle vs remote interface

    Hi,
    I have some web-page which submits to a servlet which calls methods in a stateful sesiion ejb. The same web page is again displayed. Again on submission the same
    ejb gets called.
    Question is should I hold the ejb's handle or the remote interface in session(HttpSession)?
    Raster

    Hi,
    If it's necessary to keep the state of the bean for the next time, keep the ejb's handle. Otherwise, I think it's better to keep the home handle.(to avoid the bean time out issues.) If state is not needed then u can can make it a stateless, right?
    Also please ensure that not more than on client is using the same insatnce of stateful session bean
    concurrently. Synchronize the code appropriately
    [email protected]

  • Session Bean - Why the Remote Interface?

    Hi,
    I have a stateless session bean that takes a serializable object
    as a parameter and passes it to an entity bean to persist. My question
    is: why should I put the method (addxxx) in the remote interface of my
    session bean? Why can't I just put it in the home interface so that I
    don't have to instantiate the EJB object first, then call the method?
    Any pros/cons? Thanks.
    -Linus

    You could use the Home.create() method. Generally, the home interface is
    used to manage the lifecycle of a EJB. Theoretically, you are right in your
    thinking because a stateless session bean does not preserve any state and is
    alive for the duration of a method call.
    "Linus" <[email protected]> wrote in message
    news:[email protected]..
    Hi,
    I have a stateless session bean that takes a serializable object
    as a parameter and passes it to an entity bean to persist. My question
    is: why should I put the method (addxxx) in the remote interface of my
    session bean? Why can't I just put it in the home interface so that I
    don't have to instantiate the EJB object first, then call the method?
    Any pros/cons? Thanks.
    -Linus

  • Slowness in Retrieval of Remote Interface

    We are running Weblogic 6.1 with service pack 2. Recently we saw that it was taking
    from 1 to 2 minutes to get a remote interface to a session bean. Normally this
    takes less than a second. My question is, what "gotchas" are out there when it
    comes to the timeliness of accessing a session bean?

    The two lines of code causing the delay are:
    home = (TRSSessionHome)javax.rmi.PortableRemoteObject.narrow(contextForBean.lookup(TRSSessionHome.beanHomeName),TRSSessionHome.class);
    remote = home.create();
    What makes you think it is DNS? We are thinking that we are blocking on a thread
    somewhere? But this still doesn't account for the 2 minute delay. We saw no errors
    in our logs either. Any help is greatly appreciated because we haven't gotten a
    solution and the tech support guy is out of ideas until the problem happens again
    and I get him a thread dump.
    thanks,
    lisa
    Rob Woollen <[email protected]> wrote:
    Are you talking about the JNDI look-up, or the call to home.create. Is
    this a
    stateless session bean or a stateful session bean? Is the caller within
    the WebLogic
    Server or in an outside process/machine?
    My first guess is that you're having problems with your DNS. Try using
    the IP address
    instead.
    -- Rob
    Michael Dunnigan wrote:
    We are running Weblogic 6.1 with service pack 2. Recently we saw thatit was taking
    from 1 to 2 minutes to get a remote interface to a session bean. Normallythis
    takes less than a second. My question is, what "gotchas" are out therewhen it
    comes to the timeliness of accessing a session bean?

  • EJB3 - More than one remote interface for Session Bean?

    Hi,
    Is it possible in EJB3 to have more than one remote interface for a SessionBean?
    I have seen it posetd on here that it is possible but never been able to find any other information.
    Using JBoss as my App Server, I have deployed an App, where a SessionBean is defined as implementing 2 interfaces, both of which are annotated using @remote.
    However when I examine the JBoss JMX Console, Global JNDI Namespace only one remote interface is listed, and indeed it is the first one defined in the SessionBean.
    Considering I use a String similar to (MyApp/MyBean/remote) to do the JNDI lookup, this would indicate that it is not possible to have more than one remote interface.
    1. Is this a JBoss specific limitation?
    2. Is there another way of performing the JNDI lookup?
    Thanks,
    Alan.

    Hi,
    Thanks for prompt response! I tried the suggestion in my application, and the output from JBoss JMX Console was
    +- XXXBean (class: org.jnp.interfaces.NamingContext)
      |   |   +- remote (proxy: $Proxy291 implements No ClassLoaders found for: xxx.xxx.xxx.xxx.xxx.Remote1 (no security manager: RMI class loader disabled))Again only displaying the remote interface that is first in the @remote ({ Remote1.class , Remote2.class}) list. This would lead me to believe that JBoss does not support this.
    Can anyone confirm this?
    Alan.

  • Super interfaces on EJB 3.0 Remote interface in OC4J 10.1.3

    We are implementing (on OC4J 10.1.3) an EJB 3.0 Stateless Session Bean with 2 business interfaces (remote and local) both of which extend an inteface we have defined in our system.
    When we look up the local interface we see our interface in the bean.
    When we look up the remote interface we do not see our interface in the bean.
    Any ideas?
    Thanks,
    Ed Dirago
    Computer Sciences Corp.
    FAA TFMS System

    The EJB 3.0 Remote Business references are not directly stored in CosNaming. EJB 3.0 Remote references do not have the cross-vendor interoperability requirements that the EJB 2.x Remote view had.
    You can still access Remote EJB references from a different JVM as long as the client has access to SJSAS naming provider. Please see our EJB FAQ for more details :
    https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html

  • SJSAS 9.1 does not expose EJB 3.0 remote Interface via JNDI

    I have successfully deployed a simple Stateful EJB 3.0 bean (CartBean, like the one in the Java EE 5 tutorial remote interface Cart) on SJSAS 9.1, located on machine host1.
    After I deployed the CartBean, I browsed the SJSAS and noticed the existence of the following JNDI entries:
    ejb/Cart
    ejb/Cart__3_x_Internal_RemoteBusinessHome__
    ejb/Cart#main.Cart
    ejb/mgmt
    ejb/myOtherEJB_2_x_bean ( +myOtherEJB_2_x_bean+ is a different 2.x bean that I have deployed as well)So, I am trying to access the remote interface of the CartBean from a remote machine, host2. The client application is a Java-standalone client.
    I am using the Interoperable Naming Service syntax: corbaname:iiop:host1:3700#<JNDI name>
    The problem is that the remote interface of the bean does NOT seem to be available via JNDI. I get the javax.naming.NameNotFoundException when I try to do a lookup like:
    corbaname:iiop:host1:3700#ejb/Cart
    On the other hand, the following lookups succeed:
    corbaname:iiop:host1:3700#ejb/mgmt
    corbaname:iiop:host1:3700#myOtherEJB_2_x_bean
    and also the following succeeds:
    corbaname:iiop:host1:3700#ejb/Cart__3_x_Internal_RemoteBusinessHome__So it seems like the Remote interface is not available via JNDI, rather only some internal SJSAS implementation (the object returned from the ejb/Cart__3_x_Internal_RemoteBusinessHome__ lookup is of type: com.sun.corba.se.impl.corba.CORBAObjectImpl
    Why is this happening? I know there used to be a bug in Glassfish, but I thought it had been fixed since 2006.
    Many thanks in advance, any help would be greatly appreciated.

    The EJB 3.0 Remote Business references are not directly stored in CosNaming. EJB 3.0 Remote references do not have the cross-vendor interoperability requirements that the EJB 2.x Remote view had.
    You can still access Remote EJB references from a different JVM as long as the client has access to SJSAS naming provider. Please see our EJB FAQ for more details :
    https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html

  • Multiple inheritance in remote interfaces for EJB 3.0 session beans on Webl

    Hi All,
    We started migration from EJB 2.1(WLS 8.1) to EJB 3.0(WLS 10.3.2) and identified few serious problems. One of them is related with multiple business interfaces inheritance. I wrote simple example that presents point of the problem.
    we have session bean AImpl:
    +@Stateless(name="A")+
    +@Remote({A.class})+
    +@TransactionAttribute(TransactionAttributeType.REQUIRED)+
    +public class AImpl implements A {+
    +@Override+
    +public void writeA() {+
    System.out.println("A");
    +}+
    +@Override+
    +public void writeB() {+
    System.out.println("B");
    +}+
    +@Override+
    +public void writeC() {+
    System.out.println("C");
    +}+
    +}+
    with remote interface A:
    +@Remote+
    +@JNDIName(A.JNDI_NAME)+
    +public interface A extends B, C {+
    public static String JNDI_NAME = "A_JNDI_NAME";
    void writeA();
    +}+
    As you can see A extends B, and C. Definition of both interfaces is very simple:
    +public interface B {+
    void writeB();
    +}+
    +public interface C {+
    void writeC();
    +}+
    Everything looks nice until we want to invoke some method on AImpl bean. For above implementation code:
    A a = ctx.lookup(A. JNDI_NAME);
    a.writeA();
    a.writeB();
    a.writeC();
    writes down ”A \n B” and throws exception:
    caused by: java.lang.NoSuchMethodException: pl.gov.arimr.zszik.bazowe.slowniki.ejb.A_vt0zts_AImpl_1032_WLStub.*writeC()*
    at java.lang.Class.getMethod(Class.java:1605)
    at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.getTargetMethod(RemoteBusinessIntfProxy.java:165)
    at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.invoke(RemoteBusinessIntfProxy.java:57)
    so.. in stub generated by WLS there is no method from interface C ! What more interesting after small change in interface A rely on change in interface implementation order from B, C to C, B (+public interface A extends C, B {+) server writes down only A and I have stack like below:
    Caused by: java.lang.NoSuchMethodException: pl.gov.arimr.zszik.bazowe.slowniki.ejb.A_vt0zts_AImpl_1032_WLStub.*writeB()*
    at java.lang.Class.getMethod(Class.java:1605)
    at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.getTargetMethod(RemoteBusinessIntfProxy.java:165)
    at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.invoke(RemoteBusinessIntfProxy.java:57)
    After this experience I came up with suspicion that Weblogic 10.3 does not support inheritance from multiple interfaces in one “generation”. Instead of that it takes only the first interface from the list.
    Does anybody have some experience with such a situation? maybe someone have an idea how to work around this problem?

    This is Not Supported in WebLogic that the Remote Interface extends other Interfaces. Because Annotation Processor just looks up inside the implemented interface methods. The actual interface which is Implemented by the Bean Class. So the Methods declared inside the Interface B and Interface C will be ignored and will not be available as part of the generated Stubs. Thats why u are getting NoSuchMethodError.
    You can even contact Oracle Support on this...there are 3-4 Cases on it. And the Solution is Work As Designed.
    Workaround is : edit your interface A as following
    Declare all the Business Methods only in the Remote Interface and not inside it's Super Interfaces.
    Example:
    @Stateless(name="A")
    @Remote({A.class})
    @TransactionAttribute(TransactionAttributeType.REQUIRED)
    public class AImpl implements A {
    @Override
    public void writeA() {
    System.out.println("A");
    @Override
    public void writeB() {
    System.out.println("B");
    @Override
    public void writeC() {
    System.out.println("C");
    @Remote
    @JNDIName(A.JNDI_NAME)
    public interface A extends B, C {
    public static String JNDI_NAME = "A_JNDI_NAME";
    void writeA();
    void writeB();
    void writeC();
    Thanks
    Jay SenSharma
    http://jaysensharma.wordpress.com (WebLogic Wonders Are Here)

  • A problem while getting a EJB remote interface from SJSAS 9.0

    I hava deployed a session bean in SJSAS 9.0
    I wrote some codes to get the remote interface as follow:
    Context ctx = null;
    Hashtable env = new Hashtable();
    env.put ("java.naming.factory.initial","com.sun.jndi.cosnaming.CNCtxFactory");
    env.put("java.naming.provider.url","iiop://127.0.0.1:3700");
    try {
    ctx = new InitialContext(env);
    } catch (NamingException ex) {
    ex.printStackTrace();
    try {
    Object cs =ctx.lookup(ejb.MySessionBean);
    } catch (NamingException ex) {
    ex.printStackTrace();
    A exception occured during the lookup operation.
    javax.naming.NameNotFoundException [Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0]
    at com.sun.jndi.cosnaming.ExceptionMapper.mapException(ExceptionMapper.java:44)
    at com.sun.jndi.cosnaming.CNCtx.callResolve(CNCtx.java:453)
    at com.sun.jndi.cosnaming.CNCtx.lookup(CNCtx.java:492)
    at com.sun.jndi.cosnaming.CNCtx.lookup(CNCtx.java:470)
    at javax.naming.InitialContext.lookup(InitialContext.java:351)
    at demo.Main.run(Main.java:46)
    at demo.Main.main(Main.java:62)
    Caused by: org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0
    at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.read(NotFoundHelper.java:72)
    at org.omg.CosNaming._NamingContextExtStub.resolve(_NamingContextExtStub.java:406)
    at com.sun.jndi.cosnaming.CNCtx.callResolve(CNCtx.java:440)
    ... 5 more
    Anyone can solve this problem for me???
    Thanks a lot

    We don't recommend explicitly instantiating the CosNaming provider within a stand-alone java client when accessing beans within the Java EE SDK. We have a simpler approach that involves just instantiating the no-arg InitialContext. Details are in our EJB FAQ :
    https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html
    --ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Maybe you are looking for