ejb@glassfish.java.net

RE: Re: EJB and Client on Different Computers

From: Markus Karg <karg_at_quipsy.de>
Date: Sun, 30 Nov 2008 15:38:53 +0100

Benjamin,

 

1. I do not understand what exactly is "not easy"? You just do
package-appclient and asadmin deploy --retrieve . MyEar.ear once on the
server, jar -xf client.jar on each client then, and then can run
"appclient -client MyClient.jar" to start it. What is "not easy" here?
The alternative would be using the WebStart way: Just click on the link
and it will do the above for you "under the hood", but it will be a bit
slower at each start.

 

2. What do you mean with "jnlp file is not easy to open"? You just have
got a link on your desktop and need to click on it.

 

3. Yes, a remote SB can be called from JSP and Servlet but (at least in
the J2EE standard) not from "pure" Java. Check the EJB 3.0 specification
and you will find a lot of other technology that you might want to learn
before trying the rough things. ;-)

 

Another idea is not using RMI but to add "@WebService" to you SB. Then
you can use the wsimport tool to create client classes automatically.
These classes will run even in "pure" Java SE 1.6, so it is much easier
to deploy and start. Maybe this solves your problems (which, in fact, I
still have not understood)?

 

Regards

Markus

 

From: Benjamin Lin [mailto:benjaminlin_at_rocketmail.com]
Sent: Sonntag, 30. November 2008 15:17
To: ejb_at_glassfish.dev.java.net
Subject: Re: EJB and Client on Different Computers

 

Thank Tim, Eve and Markus. Now I understand your meaning. But I have 3
questions.

 

1. Runing remote ejb client using appclient in this way is not easy,
any better way?

2. Runing remote ejb client using Java Web Start needs to open jnlp.
jnlp file is not easy to open and I am not able to open this jnlp after
my long search.

3. My actual question is how to call remote ejb (session bean) on
different JVM from JSP, Servlet, Java directly. Can we do this? I hope
we can do this just by configuring something in Glassfish.

 

Thanks.

 

Benjamin

 

________________________________

From: Tim Quinn <Timothy.Quinn_at_Sun.COM>
To: ejb_at_glassfish.dev.java.net
Sent: Sunday, November 23, 2008 10:14:36 AM
Subject: Re: EJB and Client on Different Computers

Hi, Benjamin.

As Markus described, there are two common ways of launching app clients:
using the built-in support for Java Web Start and using the 'appclient'
command.

The documentation here

http://docs.sun.com/app/docs/doc/819-3672/beakt?a=view

should help you.

The link that Markus described is accessible from the admin console. If
you have deployed an EAR that contains the app client you want to
launch, use the left part of the admin console to open the Applications
node, then open the Enterprise Applications subnode. Then click on the
entry for you application. You should see the submodules (including the
app client(s)) that are part of that EAR listed in the main panel (more
to the right). In the row for each app client you should see a link
labeled Launch. If you click that link the admin console will display
another screen where you can supply any arguments you want to pass to
the app client via Java Web Start. Enter them, then click the Launch
button.

If you are seeing "unknown file type" when you click that button it
might be because your browser does not associate the file type "jnlp"
with the Java Web Start helper application that is part of the Java
runtime. If that is the case you'll need to fix that first.

You can also launch an app client using Java Web Start by using the
"javaws" command from a command prompt. Specify the URL for that app
client on the command line. You can find out the URL either from the
App Client Launch Page in the admin console or by looking in the
server.log file for your server. Whenever you deploy an app client or
restart the server, GlassFish lists the path part of the URL for
launching each app client. Look for those messages and find the
"context-root" part of the message.

Eve's note about retrieving the generated stubs is required only if you
are using the other way of launching an app client, the 'appclient'
command.

Again, look in the documentation for more details.

- Tim

Benjamin Lin wrote:

Thank Eve and Markus.

Now I know more and finished step 7. But after that, where is the link
to click? I only found "launch" link on admin console. When I click
"launch", it says "unknown file type". Any more help?

Thanks.





 

Benjamin

 

________________________________

From: Eve Pokua <gorgeous65_at_msn.com> <mailto:gorgeous65_at_msn.com>
To: ejb glassfish <ejb_at_glassfish.dev.java.net>
<mailto:ejb_at_glassfish.dev.java.net>
Sent: Saturday, November 22, 2008 10:55:35 AM
Subject: RE: EJB and Client on Different Computers

Hi,
 
To enable web start and in most cases its enabled by default.
 
1. Make sure your server in running.
2. load your admin console and log in.
3. click on enterprise application under application.
4. click on your application
5. Make sure Java web start is ticked - enabled.
 
6. After deploying again, go back to your admin console. - step 2 -4
7.Under sub comps. download client stubs.
 
That wil give you a copy of your client jar. or follow what markus
said-
 
 
Then, from your client's browser, click on the link shown in the
browser. It will download the client container and the client and run
it.
 
 
 
eve


 

________________________________


Date: Fri, 21 Nov 2008 06:43:59 -0500
From: pm.renaud_at_gmail.com
To: ejb_at_glassfish.dev.java.net
Subject: Re: Re: EJB and Client on Different Computers

You should start with this:
http://java.sun.com/javaee/5/docs/tutorial/doc/



On Fri, Nov 21, 2008 at 2:14 AM, Markus Karg <karg_at_quipsy.de> wrote:

What is the part that you do not understand?
 

From: Benjamin Lin [mailto:benjaminlin_at_rocketmail.com]
Sent: Freitag, 21. November 2008 00:57


To: ejb_at_glassfish.dev.java.net

Subject: Re: EJB and Client on Different Computers

 

 

Markus:

Thank you for reply and instruction. But for my JEE beginner, I don't
understand what it is. Could you give detailed and concrete instructions
step by step?

Thanks.

 

Benjamin


 

 

________________________________

From: Markus Karg <karg_at_quipsy.de>
To: ejb_at_glassfish.dev.java.net
Sent: Wednesday, November 19, 2008 2:10:59 AM
Subject: RE: EJB and Client on Different Computers

It's pretty simple.
 
(1) Web Start
 
You can enable Web Start for your application (to be found in the admin
GUI). Then, from your client's browser, click on the link shown in the
browser. It will download the client container and the client and run
it.
 
To run it, just double click the link that it created.
 
(2) Standalone Client Container
 
Alternatively you can install client container and client on each remote
machine manually. One way is: Use asadmin's --retrieve . option when
deploying. It will load a JAR file containing the application client.
The client container can be obtained by the command "package-appclient"
(to be run on the server once). The result is a file "appclient.jar".
You must unpack it on all remote client machines using jar -xf
appclient.jar. Set JAVA_HOME to your JDK root on the client, and append
%JAVA_HOME%\bin to PATH. Using your editor of choice edit the file
appclient\config\asenv.bat: AS_INSTALL must point to the expanded
appclient folder, and AS_JAVA must point to %JAVA_HOME%. Also check
appclient/config/sun-acc.xml. The line <target-server> must point to the
server's host name or IP address.
 
To run it, do: appclient -client MyClientJar.jar
 
HTH
Markus
 
 
 

From: Benjamin Lin [mailto:benjaminlin_at_rocketmail.com]
Sent: Mittwoch, 19. November 2008 02:37
To: ejb_at_glassfish.dev.java.net
Subject: EJB and Client on Different Computers

 

Hi,
 
I am learning JEE. You gave an excellent EJB example on
https://glassfish.dev.java.net/javaee5/ejb/examples/Sless.html. You
showed application client and standalone java client in the same
computer. If I want to put EJB and client on different computers, how
can I run EJB and client on different computers? Could you please tell
me how to modify it?
 
Thanks.

 

Ben

 

 




-- 
Martin Renaud
________________________________
Read amazing stories to your kids on Messenger Try it Now!
<http://clk.atdmt.com/UKM/go/117588488/direct/01/>