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.
Similar Messages
-
How to lookup the remote interface in JNDI of the cluster (glassfish)
I have write a simple sessionbean:
package authority;
import javax.ejb.Stateless;
* Session Bean implementation class LoginSessionBean
@Stateless
public class LoginSessionBean implements LoginSessionBeanRemote, LoginSessionBeanLocal {
* Default constructor.
public LoginSessionBean() {
// TODO Auto-generated constructor stub
@Override
public boolean login(String name, String password)
boolean result = false;
System.out.println("User: " + name + " is login with password: " + password);
return result;
@Override
public LoginSessionBeanRemote create()
// TODO Auto-generated method stub
return this;
}And I write a simple client to test it.
package test;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.rmi.PortableRemoteObject;
import authority.LoginSessionBean;
import authority.LoginSessionBeanRemote;
public class SessionBeanTestClient
public static void main(String[] args)
try
InitialContext context = new InitialContext();
Object obj = context.lookup(LoginSessionBean.class.getName());
LoginSessionBeanRemote loginService = (LoginSessionBeanRemote)PortableRemoteObject.narrow(obj, LoginSessionBeanRemote.class);
loginService.login("Jason", "password");
catch (NamingException e)
// TODO Auto-generated catch block
e.printStackTrace();
}And it is OK, but after I deploy the sessionbean into a cluster with two instances on local host, it can not find the remote interface:
javax.naming.NameNotFoundException: authority.LoginSessionBean not found
at com.sun.enterprise.naming.TransientContext.doLookup(TransientContext.java:216)Is it different for cluster (for IIOP port?), I want to test the HA solution, how could I start it?Please look at http://otn.oracle.com/tech/java/oc4j/htdocs/oc4j-how-to.html. There is a How-To on local interface.
thanks
Debu -
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.
-LinusYou 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 -
Implementing the IF_WORKFLOW interface into a custom class
In workflow tasks you can use ABAP Classes and their methods to implement functionality instead of always using BOR objects. I created a class with a static method and got it to work outside of my task. As soon as I put the class and method into my task it says I must Interface implementation IF_WORKFLOW does not exist.
Does anyone know how to do this?Yep, my biggest mistake was looking in the help of my own version. Look in NW2004s:
http://help.sap.com/saphelp_nw04s/helpdata/en/02/527b42303e0e53e10000000a155106/frameset.htm
It applies all the way back to 620. Put IF_WORKFLOW into your interface and then define all the shiny new methods in your class. As long as you're only working with statics you don't even need to bother with all the LPOR stuff - just make sure to at least create all the methods (even if empty) to prevent dumps if WF tries to do anything with it.
Have fun,
Mike -
Convert a local interface to the remote interface
Hello *
Is it possible to convert a local interface to the same bean's remote interface?
Regards,
LukasThanks for the reply.
I have simpliefied the lookup to the following:
Context ctx = new InitialContext();
spiHome = (ServiceProviderBeanLocalHome) ctx.lookup ("ServiceProviderBeanEJB");
I still get the following exception:
javax.naming.NameNotFoundException: ServiceProviderBeanEJB not found
at com.sun.enterprise.naming.TransientContext.doLookup(TransientContext.java:174)
I looked up the deployment descriptor from J2EE RI and took the name
to lookup from the ejb-name:
<ejb-jar>
<display-name>localSPIJAR</display-name>
<enterprise-beans>
<entity>
<display-name>ServiceProviderBeanEJB</display-name>
<ejb-name>ServiceProviderBeanEJB</ejb-name>
I presume that this is the correct name to use. -
Why the method be implemented in EntityManager.class
package javax.persistence;
public interface EntityManager
// Methods
void persist(java.lang.Object p1) { }
T merge(T p1) { }
void remove(java.lang.Object p1) { }
T find(java.lang.Class<T> p1, java.lang.Object p2) { }
T getReference(java.lang.Class<T> p1, java.lang.Object p2) { }
void flush() { }
void setFlushMode(javax.persistence.FlushModeType p1) { }
javax.persistence.FlushModeType getFlushMode() { }
void lock(java.lang.Object p1, javax.persistence.LockModeType p2) { }
void refresh(java.lang.Object p1) { }
void clear() { }
boolean contains(java.lang.Object p1) { }
javax.persistence.Query createQuery(java.lang.String p1) { }
javax.persistence.Query createNamedQuery(java.lang.String p1) { }
javax.persistence.Query createNativeQuery(java.lang.String p1) { }
javax.persistence.Query createNativeQuery(java.lang.String p1, java.lang.Class p2) { }
javax.persistence.Query createNativeQuery(java.lang.String p1, java.lang.String p2) { }
void joinTransaction() { }
java.lang.Object getDelegate() { }
void close() { }
boolean isOpen() { }
javax.persistence.EntityTransaction getTransaction() { }
}This is the first time I saw this usage. I understood it now, but I was afraid I missed some important concepts on "interface as parameter in the constructor". Therefore, I am wondering where I can find some online document about it in order to understand the usage clearly.
For example, if there are a few method implementations of interface TreeModel in MyDataModel.java, which methods will it call after calling JTree constructor? all methods or only part of them?
Thanks -
Where should the interface be? (extending the Remote interface)?
Hello,
I've created a simple rmi server on one machine, sonsisting of two files:
OkServer.java:
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface OkServer extends Remote {
public String getOk() throws RemoteException;
}OkServerImpl.java:
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface OkServer extends Remote {
public String getOk() throws RemoteException;
}and on another machine, I've created a client:
import java.rmi.RMISecurityManager;
import java.rmi.Naming;
public class OkClient {
public static void main (String args[]) throws Exception {
if (args.length != 1)
throw new RuntimeException("Syntax: OkClient <hostname>");
System.setSecurityManager(new RMISecurityManager());
OkServer OkSvr = (OkServer)Naming.lookup("rmi://" +
args[0] + "/OkServer");
String when = OkSvr.getOk();
System.out.println(when);
}Now the problem is, when I try to compile the client (only consisting the file above),
it says of course:
OkClient.java:36: cannot find symbol
symbol : class OkServer
}This is normal, right?
Then, I should copy the interface (that is also at the server) to the client machine?
So the interface file HAS TO BE on both the server and the client????If you want to install OVM with the production option then you will basically need three distinct hosts:
a) the database host, where you install SE/EE on (XE is not for production use and not supported for production use!)
b) install OVM Manager on any computer running OEL 5 (or later)
c) install OVM Server on a bare metal host who's hardware is supported
As far as the SE/EE license goes: Oracle always allows anyone to download and install their software to try it out. If you are putting your setup into production, that is not covered and demands an support contract with Oracle. And from using Oracle for many years, there will come the day when you will need it… ;)
So long story short: grab the Oracle SE/EE installation and be familiar with it - Oracle DB that is, otherwise you'll be sitting there pulling your hair out and yell at your computer.
Or, try the not yet released 3.2.x version of OVMM with runs against MySQL - most likely the easy way to go. -
Why in jndi tree I find the remote interface to String is so strange?
when I view the jndi tree in weblogic server 61sp1
I found such information:
Bind Name: Enterprise1
Class: class $Proxy94
to String: ClusterableRemoteRef(10.132.0.161 [10.132.0.161])/275
hash Code: 4568198
Why the Class and to String like such? my license.bea
is not a cluster version.
Thanks you very much
"Kumar Allamraju" <[email protected]> wrote:
>EJB's are compiled with clustering options "ON". that's why you are seeing
>a
>ClusterableRemoteRef.
>Don't worry, you will not be able to run WLS instances in cluster mode
>without having a cluster license.
>
>--
>--
>Kumar
>
>"Eric nie" <[email protected]> wrote in message
>news:3ca8238a$[email protected]..
>>
>> when I view the jndi tree in weblogic server 61sp1
>> I found such information:
>>
>> Bind Name: Enterprise1
>> Class: class $Proxy94
>> to String: ClusterableRemoteRef(10.132.0.161 [10.132.0.161])/275
>> hash Code: 4568198
>>
>> Why the Class and to String like such? my license.bea
>> is not a cluster version.
>>
>
>
-
Not able to start the remote server - class not found exception
All,
I am quite new to RMI programming, although i am an experienced java programmer. I am facing a problem in starting the remote server program which i wrote for RMI. I am getting class not found exception for "stub" class eventhough the class is in the classpath.
Following is the error console:
cmd> java -classpath "D:\Eclipse_WorkSpaces\WS2\RMITests\classes" MyServerImplementation
GetNames error: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: MyServerImplementation_Stub
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: MyServerImplementation_Stub
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:535)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:359)
at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
at java.rmi.Naming.rebind(Naming.java:160)
at MyServerImplementation.main(MyServerImplementation.java:21)
Caused by: java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: MyServerImplementation_Stub
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:535)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassNotFoundException: MyServerImplementation_Stub
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:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:434)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:165)
at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:620)
at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:247)
at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:197)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1575)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1732)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
... 12 morePLEASE ADVISE HOW TO RESOLVE THIS...
Following are my classes:
MyRemoteInterface.java
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface MyRemoteInterface extends Remote {
public String[] getNames() throws RemoteException;
public class MyServerImplementation extends UnicastRemoteObject implements
MyRemoteInterface {
public MyServerImplementation()throws RemoteException{
super();
public String[] getNames() throws RemoteException{
return new String[]{"Name1","Name2","Name3","Name4"};
public static void main(String args[]) {
try {
// Create an object of the HelloWorldServer class.
MyRemoteInterface obj = new MyServerImplementation();
// Bind this object instance to the name "HelloServer".
Naming.rebind("rmi://localhost:1985/GetNames", obj);
System.out.println("GetNames bound in registry");
catch (Exception e) {
System.out.println("GetNames error: " + e.getMessage());
e.printStackTrace();
public class MyRMIClient {
*@param args*
public static void main(String[] args) {
try {
MyRemoteInterface remObj = (MyRemoteInterface) Naming.lookup("rmi://localhost:1985/GetNames");
System.out.println("Names are "+remObj.getNames());
catch(Exception e) {
System.out.println("Problem encountered accessing remote object "+e);
}That's a remote exception coming from the registry. You need to learn to recognize remote exceptions and their source, it's a mjaor source of confusion in RMI.
In this case it's the registry that can't find the stub class.
The stub class needs to be in the CLASSPATH of (i) the Registry and (ii) the client as well. Ditto the remote interface; ditto any application classes it refers to, and so on until closure.
The easiest way to achieve (i) is to start it in the server's JVM, with LocateRegistry.createRegistry(). -
EJB deployment problem --New remote interface class files are not loaded
Hi, I face a problem while deploying an ear file in oc4j. I basically get some problems like the method in the remote interface is not implemented in the EJB class. But the implementation is actually available in the EJB class.
We get this problem when we actually change the signature of the EJB remote methods. The new methods are not referenced by oc4j. Only the old version of remote interface is referenced by oc4j. But the latest version of EJB class is taken. I am using 9.0.3 version of the oc4j. Could you pls help me regarding this problem ?
Regards
SolomonI have found the solution :-)
You must add to the ejbCreate() method of the bean class throws javax.ejb.CreateException -
ClassCastException at Remote object although remote interface is implemented
Hi,
I want to access a remote object via T3 (on WebLogic 10) but I am
getting a ClassCastException in the client. The exception is thrown if
the generic "Remote" object is casted into a concrete remote interface.
The following works ok (client side, get remote object via JNDI):
Hashtable hashTable = new Hashtable();
hashTable.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
hashTable.put(Context.PROVIDER_URL, "t3://localhost:7001);
ic = new InitialContext(hashTable);
Remote r = (Remote) ic.lookup("...jndi bind name...");
But this cast fails:
IMyRemoteIntf i = (IMintRemoteIntf) r;
The ClassCastException has the classname of the class which implements
the remote interface - the lookup should be ok therefore. With
r.getClass().getInterfaces() I have verified that the remote object
actually implements the appropriate interface. I suppose it is a class
loader issue then and added some debug output.
Class loader parent chain of IMyRemoteIntf:
weblogic.utils.classloaders.ChangeAwareClassLoader@1715ee2
-> weblogic.utils.classloaders.GenericClassLoader@123ade0
-> weblogic.utils.classloaders.FilteringClassLoader@1312cf9
-> weblogic.utils.classloaders.GenericClassLoader@159ea8e
-> java.net.URLClassLoader@82d37
-> sun.misc.Launcher$AppClassLoader@e39a3e
-> sun.misc.Launcher$ExtClassLoader@a39137
Class loader parent chain of IMyRemoteIntf as reported by r.getInterfaces():
sun.misc.Launcher$AppClassLoader@e39a3e
-> sun.misc.Launcher$ExtClassLoader@a39137
IMyRemoteIntf is in a jar file in WEB-INF/lib of my web application. I
tried prefer-web-inf-classes = true in weblogic.xml as well as
prefer-application-packages in weblogic-application.xml (with the
respective package of the interface).
Any ideas? I don't know what more I can try. I can access the same
server with this t3 URL just fine from outside of the WebLogic server.
Regards
WernerI meant an issue about multi-connections. Although the socket is shared by all of the connections, each connection in RMI might correspond to a separated thread, I guess. Since the socket is shared by all rmi clients, the RMI channel would be a blocking connection. I am not sure if the RMI in JDK1.4 or above also use the nonblocking new I/O technique. Thanks.
-
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) -
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 appreciatedThe 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. -
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
Maybe you are looking for
-
How can i display collection of records in HTML Table using DWR framework
Dear All, Just i start using the Direct Web Remoting framework.I am worrying to get the list of records to display html table using this concept.I did the same like. index.js var cellFuncs = [ function(data) { return data; }, function(data) { return
-
How can LabVIEW press a command button in access form?
Situation: access database with a command button, who generate a code after pushing Task: LabVIEW open the access database, pressed the command button and read out the code Status: use activeX to open the access database - ready press the command but
-
Parts of my white logo disappear when viewing seps in Acrobat - Urgent
Hi folks I have been supplied with an .eps logo that is comprised of various grouped elements all on one layer. All the fills are set to C=0 M=0 Y=0 K=0. I am using Illustrator CS I have placed the file in an InDesign CS2 document against a coloured
-
im trying to connect my wifi to my phone but it keeps saying "unable to connect"
-
Hi, Using Smartdraw to draw scaled plans in 2D I then convert to PDF to email to clients. Plans scaled 1:100 convert ok but anything smaller i.e 1:150 or 1:200 convert and have 16-32 blank pages attached to the document. Do you think this is a Smartd