How to Deploy NetBeans Platform Applications to GlassFish

Here's a quick overview of Java Web Start in the context of NetBeans Platform applications, via GlassFish:

  1. Design and create your application, with all its modules, and so on. I.e., the next step assumes your application is ready for distribution.

  2. Add this line to the "NetBeans Platform Config" of the application (i.e., its platform.properties):

    jnlp.platform.codebase=http://bits.netbeans.org/6.5/jnlp/

  3. Right-click the application and choose "Build JNLP Application".

  4. Now in the application's "dist" folder, i.e., visible in the Files window, you'll see a WAR file:

    The WAR file will not include a 'netbeans' folder, which would normally be there, including a very long list of subfolders with NetBeans JAR files, for each of the NetBeans Platform modules, because of the jnlp.platform.codebase property above.

  5. Now take that WAR file and put it in the GlassFish glassfish/domains/domain1/autodeploy folder. (I do so via the Favorites window, but use any approach you like, maybe a build script for example.)

  6. Next, go to the Services window in NetBeans IDE and refresh the GlassFish node by right-clicking it and choosing "Refresh". In the "Applications" folder you will now see a new node for the application created by dropping the WAR file into the "autodeploy" folder.

  7. Right-click the application node and choose "Open in Browser". There, click "master.jnlp", which is one of the links on the page:

    The above includes a "netbeans/" link, which is only shown if the property described above has NOT been set. Therefore, to verify that everything is as expected, i.e., you're using the 'bits.netbeans.org' location for hosting the NetBeans Platform JARs, you should see this instead:

    Ether way, clicking the "master.jnlp" link should result in your application deploying via Java Web Start.

  8. You probably want the above page to look friendlier, so drop an "index.html" page into the "build" folder that is generated via the "Build JNLP Application" described above:

    The index.html file should contain a line like this:

    <a href="master.jnlp">Launch the application</a>

    Now click "Build JNLP Application" again and the content of your "build" folder will be turned into your WAR file (i.e., in the "dist" folder, exactly as before), which will now include your index.html file.

    Then replace the old WAR file on GlassFish with your new one, which should result in the launcher link being displayed in the browser, together with whatever else you included in the index.html file:

Also, because of the above property in the platform.properties file, all the relevant NetBeans modules will be downloaded, which therefore will not need to be done again for any other application using those modules.

Comments:

So if you don't want to rely on bits.netbeans.org you would have to host that yourself?

Posted by guest on April 22, 2009 at 04:33 AM PDT #

Exactly, 12.30.196.14.

Posted by Geertjan on April 22, 2009 at 04:36 AM PDT #

Hi
I've read your blog with vaste interest.I am actually looking for deploying a "jnlp appl" and i understand i must buy a licence key do to such application under netbeans 6.8.
I am also studiing your complete web cast.
It would be nice if you could you send me the right link or informations about that licence key?
Best regards
Phil

Posted by biblast on January 18, 2010 at 08:44 PM PST #

License key? Who told you you need a license key? You don't.

Posted by Geertjan Wielenga on January 18, 2010 at 09:20 PM PST #

When i right click on "build jnlp application" i have a error message into the "output":
Warning:
The signer certificate will expire within six months.
Enter Passphrase for keystore:
Signing JAR: D:\\Documents and Settings\\@propylée.fr\\Mes documents\\NetBeansProjects\\XML_Ed_2010\\build\\jnlp\\branding\\org-netbeans-core-windows_app.jar to D:\\Documents and Settings\\@propylée.fr\\Mes documents\\NetBeansProjects\\XML_Ed_2010\\build\\jnlp\\branding\\org-netbeans-core-windows_app.jar as jnlp

Warning:
The signer certificate will expire within six months.
Enter Passphrase for keystore:
suite-jnlp.copy-branding:
Warning: Could not find file D:\\Documents and Settings\\@propylée.fr\\Mes documents\\NetBeansProjects\\XML_Ed_2010\\${app.icon} to copy.
Your JNLP file is generated at D:\\Documents and Settings\\@propylée.fr\\Mes documents\\NetBeansProjects\\XML_Ed_2010\\build\\jnlp/master.jnlp

D:\\Program Files\\NetBeans 6.8 RC2\\harness\\suite.xml:493: The following error occurred while executing this line:
D:\\Program Files\\NetBeans 6.8 RC2\\harness\\jnlp.xml:364: Some tests failed:
D:\\Documents and Settings\\@propylée.fr\\Mes documents\\NetBeansProjects\\XML_Ed_2010\\build\\jnlp\\app\\my-presentation-propylee.jnlp/testParse: Invalid byte 2 of 3-byte UTF-8 sequence.
BUILD FAILED (total time: 6 seconds)
Here it is !
Phil

Posted by biblast on January 18, 2010 at 10:24 PM PST #

Read "Self-Signing jar file with NetBeans Web Start" here:

http://kenai.com/projects/cps/pages/DeveloperFAQ

If you then continue to have problems, don't leave a message here (because I don't know how else to help you and I will therefore ignore subsequent questions on this point that you leave here). Instead, write to dev@platform.netbeans.org and also join that mailing list.

Posted by Geertjan Wielenga on January 18, 2010 at 11:30 PM PST #

We're currently using the 'appClient' feature of Glassfish v2, because our NetBeans app is talking with EJBs. Do you know if we can use the technique described in your post and still somehow get some EJBs injected? We would love to use v3, but seems like the appClient-WebStart support isn't there yet. Thanks!

Posted by Chiss on January 20, 2010 at 02:14 AM PST #

Very interested in a follow up on Chiss' question regarding deploying to webstart and still being able to use EJBs.

Posted by Rob Egan on March 09, 2010 at 02:41 AM PST #

Thanks for the tutorial! I've been wrestling with this in NB 6.9 and there are some issues that need to be worked out. I had to add the class for my JnlpDownloadServlet by hand to the harness/jnlp.xml of my NetBeans install, since it was hardcoded. Once I addressed that, I'm able to get the jnlps to download and "launch". Unfortunately I hit another wall - after the app is done with the "load modules" phase of init, the core app can't find the required classes for my RCP modules, so i'm left with a very very basic netbeans IDE app. I'm poking around trying to figure out how the startup.jar would know what modules to load and what not; any advice is appreciated.

Posted by ph1g on July 25, 2010 at 11:52 PM PDT #

Advice is obvious: write to the mailing list (dev@platform.netbeans.org) and ask your question there.

Posted by Geertjan on July 25, 2010 at 11:58 PM PDT #

Do you know of a way of including the localized versions of the jar files located at http://bits.netbeans.org/6.9.1/jnlp/
for instance I would like to run core_sv.jar instead of http://bits.netbeans.org/6.9.1/jnlp/org-netbeans-core-startup/core.jar since I work in Swedish.

Im looking into having Ant copying all the jars into my jnlp build "manually" from local, localized, copies, but is this really the way to go?

Posted by Henry A on November 17, 2010 at 06:23 PM PST #

My jnlp file is not downloading fast..It doesn't have any database and all..just a structure..Even though it takes nearly 7 min to download..it responds very slow after downloading. i didnt use any compressio alogms lik pack200 and all..Could yo explain...?

Posted by Madasamy on January 20, 2011 at 01:17 PM PST #

I have created a web application using netbeans 7.1 version. I now want to deploy onto glass fish server and then link it to my website. can you please tell me how to do?

Posted by Nanda on June 22, 2012 at 01:37 AM PDT #

Join the mailing list nbusers@netbeans.org and ask your NetBeans IDE questions there.

Posted by Geertjan on June 22, 2012 at 04:53 AM PDT #

Hi Geertjan,

Greetings from CIMMYT, Mexico.

I have two questions for you, I hope you can help me.

1. I want to deploy an application in GlassFish but always I receive this message:

Exception while preparing the app : Invalid resource : jdbc/imicSeedRequest__pm.

Do you have some idea about what is the problem?

2. If I created an application using "GlassFish", is too difficult to change to Tomcat?, If it is possible, Do you have some references(links or documentation)?

Thanks in advance

regards,

Juan Carlos

Posted by guest on July 09, 2012 at 04:14 PM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
12
13
14
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today