NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

NB7.0.1 GF App Client - Ear Needed

 
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users
View previous topic :: View next topic  
Author Message
GeoffC



Joined: 15 May 2009
Posts: 21

PostPosted: Tue Oct 11, 2011 6:59 am    Post subject: NB7.0.1 GF App Client - Ear Needed Reply with quote

Hi All,

I'm working on an app client project with NB 7.0.1 (Build 201107282000) using Glassfish 3.1.1 (build 12), going back to first principles to (hopefully) solve issues in a more complex project related to libraries and web start and J2EE.

I've created a class library for entities and EJB interfaces. I've created an Enterprise Application which contains an EJB project and WAR project. I've got that all working fine, both deploying from NB and via the admin console using the generated ear, running servlet okay etc.

I've now created an application client project using, among other resources, http://netbeans.org/kb/docs/javaee/entappclient.html where it indicates that for NB 7 we no longer need to add the app client project to an enterprise application. So I didn't.

My simplistic app client creates the remote bean, passes it into a JFrame where it is used to update a label. I've also added in an external 3rd party library and use it to update another label.

If I use "Run" on the app client within NB everything works as expected.

Checking in the GF admin console I can see the app client has deployed as expected, but it has the "You must redeploy the application to change Java Web Start Support." message. It also indicates that NB has somewhere along the line sent the jar files across.

If I redeploy the app client jar file in order to enable webstart it doesn't work when I run using webstart, I believe because, as discussed in http://forums.netbeans.org/post-57927.html and elsewhere, it seems that one cannot deploy a jarred enterprise application client because it wont contain and/or maintain the references to the external libraries.

If I try to redeploy using the local directory option in GF admin console and select the "dist" directory that NB has created (which contains the Test.jar, TestClient.jar and the subdirectory TestClient containing those same jars again) it fails to deploy. Same for trying with the subdirectory. In any case the needed libraries are not within the dist folder anyway.

Am I missing something in NB that would allow me to deploy with webstart option enabled, and preserve the links to libraries for my app client?

Am I going about this completely the wrong way?!

Is there a way to get NB to generate an ear that includes the needed libraries for an application client outside of an enterprise application, or is it a manual task?

I realise I can create an app client linked to an enterprise application which will then bundle the whole lot up as an ear, but I'm assuming that not connecting it to an enterprise app was made possible for a reason. I've also had absolutely no luck getting my main project which has that configuration to do the right thing with respect to finding libraries, hence this return to a simple test.

Any advice or insight greatly appreciated.

Thanks,
Geoff
Back to top
Tim Quinn
Posted via mailing list.





PostPosted: Tue Oct 11, 2011 10:08 pm    Post subject: Re: NB7.0.1 GF App Client - Ear Needed Reply with quote

Hi, Geoff.

One simple thing to try is to create the enterprise app containing the
EJB JAR, the WAR, and the library as you already have. Then when you
create the app client module tell NetBeans to include it in that
enterprise app. Yes, this is different from what the tutorial lesson
you linked to says, but I have a reason.

I am not familiar with the details of exactly how NetBeans supports
the scenario described in the tutorial you linked to, but it looks as
if when NetBeans launches the app client it is not using the Java Web
Start support to do so. That means NetBeans can adjust the class path
by adding the library to it before launching the client.

In contrast, the built-in automatic Java Web Start support in
GlassFish analyzes the client's dependencies and resolves them but
only if the JARs and the client are in the same EAR. Then GlassFish
will make sure the library is available to the client at runtime
regardless of how you launch it: using the appclient command (which is
the rough equivalent of what NetBeans does) or using Java Web Start.

- Tim





On Oct 11, 2011, at 2:01 AM, GeoffC wrote:

Quote:
Hi All,

I'm working on an app client project with NB 7.0.1 (Build
201107282000) using Glassfish 3.1.1 (build 12), going back to first
principles to (hopefully) solve issues in a more complex project
related to libraries and web start and J2EE.

I've created a class library for entities and EJB interfaces. I've
created an Enterprise Application which contains an EJB project and
WAR project. I've got that all working fine, both deploying from NB
and via the admin console using the generated ear, running servlet
okay etc.

I've now created an application client project using, among other
resources, http://netbeans.org/kb/docs/javaee/entappclient.html
where it indicates that for NB 7 we no longer need to add the app
client project to an enterprise application. So I didn't.

My simplistic app client creates the remote bean, passes it into a
JFrame where it is used to update a label. I've also added in an
external 3rd party library and use it to update another label.

If I use "Run" on the app client within NB everything works as
expected.

Checking in the GF admin console I can see the app client has
deployed as expected, but it has the "You must redeploy the
application to change Java Web Start Support." message. It also
indicates that NB has somewhere along the line sent the jar files
across.

If I redeploy the app client jar file in order to enable webstart it
doesn't work when I run using webstart, I believe because, as
discussed in http://forums.netbeans.org/post-57927.html and
elsewhere, it seems that one cannot deploy a jarred enterprise
application client because it wont contain and/or maintain the
references to the external libraries.

If I try to redeploy using the local directory option in GF admin
console and select the "dist" directory that NB has created (which
contains the Test.jar, TestClient.jar and the subdirectory
TestClient containing those same jars again) it fails to deploy.
Same for trying with the subdirectory. In any case the needed
libraries are not within the dist folder anyway.

Am I missing something in NB that would allow me to deploy with
webstart option enabled, and preserve the links to libraries for my
app client?

Am I going about this completely the wrong way?!

Is there a way to get NB to generate an ear that includes the needed
libraries for an application client outside of an enterprise
application, or is it a manual task?

I realise I can create an app client linked to an enterprise
application which will then bundle the whole lot up as an ear, but
I'm assuming that not connecting it to an enterprise app was made
possible for a reason. I've also had absolutely no luck getting my
main project which has that configuration to do the right thing with
respect to finding libraries, hence this return to a simple test.

Any advice or insight greatly appreciated.

Thanks,
Geoff



Back to top
GeoffC



Joined: 15 May 2009
Posts: 21

PostPosted: Wed Oct 12, 2011 3:07 am    Post subject: Reply with quote

Hi Tim,

Thanks for the reply!

Unfortunately I'm still left in the same situation even though I now have a proper ear containing the app client.

I recreated the whole lot, minus the extra lib and the war, to ensure there was no confusion between clients (NB offers either web or app client in the enterprise app project properties), just trying to get the basics working.

So I've now got an enterprise application, an ejb project with one bean, with a test() method that returns a string. It has a remote interface in a standard class library. Then I have an app client project, linked to the enterprise application, with Main class and Frame.

If I run this from NB all is well.

In the GF Admin Console the application client is not enabled for webstart when NB deploys it, and there are no settings to achieve this.

So I undeploy the application, then redeploy using the ear NB has generated, check to allow webstart, and attempted using both "Enterprise Application" and "Application Client" as Type values, and including Library details and not for the ent app version.

In each case I arrive at the following error once I try to launch from the GF Admin Console via WebStart.

Code:
java.io.FileNotFoundException: http://foxwhelp:8080/___JWSappclient/___system/___dyn/___system_s1as.jnlp
   at sun.reflect.GeneratedConstructorAccessor2.newInstance(Unknown Source)
   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
   at java.lang.reflect.Constructor.newInstance(Unknown Source)
   at sun.net.www.protocol.http.HttpURLConnection$6.run(Unknown Source)
   at sun.net.www.protocol.http.HttpURLConnection$6.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at sun.net.www.protocol.http.HttpURLConnection.getChainedException(Unknown Source)
   at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
   at com.sun.deploy.net.BasicHttpRequest.doRequest(Unknown Source)
   at com.sun.deploy.net.BasicHttpRequest.doGetRequestEX(Unknown Source)
   at com.sun.deploy.net.DownloadEngine.actionDownload(Unknown Source)
   at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)
   at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)
   at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
   at com.sun.deploy.net.DownloadEngine.getCachedFile(Unknown Source)
   at com.sun.javaws.LaunchDownload.downloadExtensionsHelper(Unknown Source)
   at com.sun.javaws.LaunchDownload.downloadExtensions(Unknown Source)
   at com.sun.javaws.Launcher.prepareLaunchFile(Unknown Source)
   at com.sun.javaws.Launcher.prepareAllResources(Unknown Source)
   at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
   at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
   at com.sun.javaws.Launcher.launch(Unknown Source)
   at com.sun.javaws.Main.launchApp(Unknown Source)
   at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
   at com.sun.javaws.Main$1.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
Caused by: java.io.FileNotFoundException: http://foxwhelp:8080/___JWSappclient/___system/___dyn/___system_s1as.jnlp
   at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
   at java.net.HttpURLConnection.getResponseCode(Unknown Source)
   ... 18 more


Unfortunately the webstart error dialog wont let me find out what the "18 more" are, the webstart logs contain only two brief entries, and the GF logs don't contain anything untoward.

The GF domain1/applications folder contains (what seems to be) a properly expanded ear with the lib jar in the lib directory, though it is only referenced from the TestUI.jar (my app client) manifest

I've cleared the webstart cache, stopped and restarted the GF server. (Incidentally, when I restart GF the application is no longer available and has to be redeployed, but that's something I should take up on a GF forum I'd imagine)

I don't know enough to know whether there is a problem in the NB settings for the projects, or whether it's an issue in GF that should be taken up with them.

I've attached a zip of the test project, approx 68kb in case anyone is inclined to have a look.

Thanks,
Geoff



ATestApp.zip
 Description:
Zip of directory containing projects.

Download
 Filename:  ATestApp.zip
 Filesize:  65.79 KB
 Downloaded:  96 Time(s)

Back to top
GeoffC



Joined: 15 May 2009
Posts: 21

PostPosted: Mon Oct 17, 2011 12:11 am    Post subject: Reply with quote

Hi again,

I see a couple of people have downloaded the files. Have you had any luck deploying it and running via webstart? Am I missing something really obvious or is there a genuine problem there?
Back to top
GeoffC



Joined: 15 May 2009
Posts: 21

PostPosted: Mon Oct 24, 2011 1:38 am    Post subject: Reply with quote

For the benefit of anyone else suffering with this issue: after posting over at the GF forums I got the a reply that I should delete the content of domains/domain1/java-webstart, undeploy the application, restart the server and then redeploy it.

This solved the problem outlined here, but raised another one. For GF 3.1.1 there is a patched grizzly-utils.jar available attached to the following JIRA issue which, when installed and the server restarted, allowed the app to work.

http://java.net/jira/browse/GLASSFISH-17150

Cheers,
Geoff
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo