b*******9 发帖数: 15 | 1 JEE 高手:
本人正自学JEE,有个问题想请教。I found an application client directly calls
session bean remote interface without URL in the client program. I just don'
t understand why it can call from one computer to another computer (or from
one JVM to anther JVM) without URL. What is the mechanism? Or where is the
URL defined or established?
Thanks.
Bajamin |
g*****g 发帖数: 34805 | 2 Usually remote service needs to register in JNDI.
calls
don'
from
【在 b*******9 的大作中提到】 : JEE 高手: : 本人正自学JEE,有个问题想请教。I found an application client directly calls : session bean remote interface without URL in the client program. I just don' : t understand why it can call from one computer to another computer (or from : one JVM to anther JVM) without URL. What is the mechanism? Or where is the : URL defined or established? : Thanks. : Bajamin
|
A**o 发帖数: 1550 | 3 it's in the client configuration, and many are application specific.
calls
don'
from
【在 b*******9 的大作中提到】 : JEE 高手: : 本人正自学JEE,有个问题想请教。I found an application client directly calls : session bean remote interface without URL in the client program. I just don' : t understand why it can call from one computer to another computer (or from : one JVM to anther JVM) without URL. What is the mechanism? Or where is the : URL defined or established? : Thanks. : Bajamin
|
b*******9 发帖数: 15 | 4 Thanks. But no any JNDI for this session bean.
【在 g*****g 的大作中提到】 : Usually remote service needs to register in JNDI. : : calls : don' : from
|
b*******9 发帖数: 15 | 5 Thanks. But I didn't find anything in client configuration.
I guess maybe it is done by multiple computers (servers, or JVM)
configuration.
Does anybody have this experiences?
Thanks.
Zhangshi
【在 A**o 的大作中提到】 : it's in the client configuration, and many are application specific. : : calls : don' : from
|
A**o 发帖数: 1550 | 6 it's for sure not in your session bean.
what's your application container,
what's your application client?
【在 b*******9 的大作中提到】 : Thanks. But I didn't find anything in client configuration. : I guess maybe it is done by multiple computers (servers, or JVM) : configuration. : Does anybody have this experiences? : Thanks. : Zhangshi
|
t*******e 发帖数: 684 | 7 Post your code that locates the remote session bean pls. |
g*****g 发帖数: 34805 | 8 Haven't been working on ejb for a long time, but check your xmls,
it should be somewhere in it.
【在 b*******9 的大作中提到】 : Thanks. But I didn't find anything in client configuration. : I guess maybe it is done by multiple computers (servers, or JVM) : configuration. : Does anybody have this experiences? : Thanks. : Zhangshi
|
b*******9 发帖数: 15 | 9 I posted all codes here. Part 1 is remote insterface. Part 2 is session bean.
Part 3 is client. You can see the client directly call remote interface
without URL. The client has no xml. Thanks.
Part 1
package order.request;
import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.ejb.Remote;
@Remote
public interface Request
{
void addLineItem(
Integer orderId,
String partNumber,
int revision,
int quantity);
void addPart
【在 t*******e 的大作中提到】 : Post your code that locates the remote session bean pls.
|
g*****g 发帖数: 34805 | 10 If OrderClient doesn't need any parameter, what's the point of
having a method
public OrderClient(String[] args)
I suspect the point is to pass args and create an InitialContext there.
Your code can run fine only if it's inside JEE container.
bean.
【在 b*******9 的大作中提到】 : I posted all codes here. Part 1 is remote insterface. Part 2 is session bean. : Part 3 is client. You can see the client directly call remote interface : without URL. The client has no xml. Thanks. : Part 1 : package order.request; : import java.io.Serializable; : import java.util.Collection; : import java.util.Date; : import javax.ejb.Remote; : @Remote
|
|
|
t*******e 发帖数: 684 | 11 Injection through @EJB only works with app clients, typically deployed as a
client module in an ear. Standalone clients have to use JNDI to lookup EJBs. |
A**o 发帖数: 1550 | 12 as i'd suspected, it's only the java source code,
w/o configuration...
source code is for demo only, lz needs a container
to get the details configuration set.
and the client here is an application client,
which as you said, requires a container to run as well.
again, for lz, it's container specific,
find one and read the docs.
【在 g*****g 的大作中提到】 : If OrderClient doesn't need any parameter, what's the point of : having a method : public OrderClient(String[] args) : I suspect the point is to pass args and create an InitialContext there. : Your code can run fine only if it's inside JEE container. : : bean.
|
b*******9 发帖数: 15 | 13 In my example, ejb and client is in the same ear. You mean this is called
the inside JEE container? I want to modify the client in different computer
to call ejb. Do you know how to do that?
Thanks.
【在 g*****g 的大作中提到】 : If OrderClient doesn't need any parameter, what's the point of : having a method : public OrderClient(String[] args) : I suspect the point is to pass args and create an InitialContext there. : Your code can run fine only if it's inside JEE container. : : bean.
|
b*******9 发帖数: 15 | 14 Yes, I want to make standalone client to call remote ejb. How to modify it?
Do you have a good example?
Thanks.
a
EJBs.
【在 t*******e 的大作中提到】 : Injection through @EJB only works with app clients, typically deployed as a : client module in an ear. Standalone clients have to use JNDI to lookup EJBs.
|
b*******9 发帖数: 15 | 15 What does container mean here?
How to configure a client to call remote ejb?
Thanks.
【在 A**o 的大作中提到】 : as i'd suspected, it's only the java source code, : w/o configuration... : source code is for demo only, lz needs a container : to get the details configuration set. : and the client here is an application client, : which as you said, requires a container to run as well. : again, for lz, it's container specific, : find one and read the docs.
|
A**o 发帖数: 1550 | 16 which application server you are using? glassfish?
read it's ejb example project.
【在 b*******9 的大作中提到】 : What does container mean here? : How to configure a client to call remote ejb? : Thanks.
|
w******f 发帖数: 620 | 17 You need use the JNDI look up to find the register EJB bean, here is the
sample code for jboss container.
Under jboss, the JNDI port is 1099 and 1098, EJB access port is 3837. You
need make sure those port is on when your client want to remote invoke a
server under firewall
public static void init(String server) {
mServer = server;
CONTEXT_PROPERTIES = new Properties();
CONTEXT_PROPERTIES.setProperty("java.naming.factory.initial",
"org.jnp.interfaces.Namin |