users@glassfish.java.net

Re: AppClient/JWS/Derby/Security problems

From: Tim Quinn <Timothy.Quinn_at_Sun.COM>
Date: Tue, 26 Sep 2006 13:17:12 -0500

Hi, Martin.

Martin, Ray wrote:
> First, I need to apologize. You are gonna get a little frustrated
> with my stupidity.
>
> I don't know what an 'app client jar' is.
>
> My understanding is that I create a J2SE application that I want to
> run on the client's desktop. I can go around and load every user's
> desktop with this desktop application. And so far this is not an 'app
> client' - just a desktop application. Then I say this is too
> cumbersome going around loading everyone's desktop. And I say "ah,
> look. If I deploy this desktop application to Glassfish and select the
> Java Web Start checkbox, I will get out of the business of loading
> every user's machine with my application". My understanding is that
> at the point in time when I deploy to Glassfish, the application now
> becomes an 'app client'. But, I had not read anywhere (or, if I did,
> it totally went over my head) that I needed to do anything but deploy
> my application to Glassfish (I use the admin console at port 4848 and
> choose App Client Modules). So, this is the way that I have been
> running for months. After having done a "Clean and Build" in
> Netbeans, I use the Glassfish console and I select (using the browse
> button) the jar file from the dist directory that Netbeans has created.
I may have added unnecessarily to the confusion. Yes, what you are
doing works.

>
> When you say, "...reran my very simple test in which I bundled a JAR
> into an app client JAR, ..." - I do not know what 'bundled' means -
> this is very embarrassing and I had to scrape deep to admit this.
Just different words to describe what you describe below about including
an additional JAR into the application's JAR.
>
> The only thing that I know how to do is include third party jar files
> into my application jar file using build.xml. I need pastry.jar
> (along with others) for the application to run. I just went and
> verified that I had not inadvertently placed pastry.jar into
> Glassfish's lib directory. So, after deploying the desktop
> application to Glassfish, I go to a web page, poke the hyperlink, Java
> Web Start whirs, the application is visible on the client's desktop.
> If I go to a second machine, get to the same web page, poke the
> hyperlink, Java Web Start does its thing, the application is visible
> on the second machine. On both machine's using the desktop
> application, I select my ChatAddon, and I can communicate between the
> two instances of the application.
Do your build.xml customizations add the pastry.jar to the application
JAR so that its path as stored in the application JAR is
lib/pastry.jar? (I suspect strongly that the answer is yes but I want
to verify that.)
>
> In my small understanding, I never created an app client jar. In my
> understanding, Glassfish provides an 'App Client container' - which I
> have come to think of in some way as a Spring container or a JADE
> container. But, I never do anything special. My understanding was
> that I merely plunked my desktop application into Glassfish, the magic
> happens, and I run my application from any machine on the network.
> And this is exactly what happened for me on the Chat thingie. After
> the magic of Glassfish, I could chat between several machines (using
> my app) - and some of those machines (certainly not including my
> development machine) have never had this code loaded- which said to me
> that pastry.jar was available because it was contained in the
> application jar file.
Yes, I agree. The key is that the extra JAR must not only be present in
the application JAR but the manifest must also refer to it in the
Class-Path attribute using the correct path. My NetBeans (5.5 beta 2)
added a Class-Path entry for my extra JAR as lib/extra.jar. In my
earlier experiments my extra.jar was added at the "top level" of the
application JAR. I made sure that it was added to the app JAR as
lib/extra.jar and my test was able to load resources from that extra.jar.
>
> Everything is going gggreat - then I add persistence - and things go
> downhill from there. Don't forget that you guys have gotten me past
> all roadblocks to the point where running appclient from the
> commandline is also gggreat including persistence.
So to make sure I recall correctly, at this point are you adding
derby.jar to your application in the same way you are adding
pastry.jar? And the only thing that is not working at this point is
adding persistence into the mix and launching that from Java Web Start?

Can you - once more - send along the error messages and stack trace you
get during the attempted Java Web Start launch?

Thanks.

- Tim