X

Geertjan's Blog

  • April 22, 2009

How to Deploy NetBeans Platform Applications to GlassFish

Geertjan Wielenga
Product Manager
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.

Join the discussion

Comments ( 18 )
  • guest Wednesday, April 22, 2009

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


  • Geertjan Wednesday, April 22, 2009

    Exactly, 12.30.196.14.


  • biblast Tuesday, January 19, 2010

    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


  • Geertjan Wielenga Tuesday, January 19, 2010

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


  • biblast Tuesday, January 19, 2010

    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


  • Geertjan Wielenga Tuesday, January 19, 2010

    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.


  • Chiss Wednesday, January 20, 2010

    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!


  • Rob Egan Tuesday, March 9, 2010

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


  • ph1g Monday, July 26, 2010

    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.


  • Geertjan Monday, July 26, 2010

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


  • Henry A Thursday, November 18, 2010

    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?


  • Madasamy Thursday, January 20, 2011

    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...?


  • Nanda Friday, June 22, 2012

    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?


  • Geertjan Friday, June 22, 2012

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


  • guest Monday, July 9, 2012

    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


  • dave Wednesday, March 25, 2015

    Hi please I need your help I use netbeans 8.2 IDE I cerated new web application and added an entity class from database and session beans for entity classes to the project with some Html code s, then try to deploy and run it , then it refuses to deploy . on the output window it was showing an error message the module has not been deployed

    BUILD FAILD (total time 0 seconds) please how can I fixed this. What could be the problem

    please help me


  • Geertjan Wednesday, March 25, 2015

    Read your comment and pretend you're me. Now try to imagine how you'd try to help -- it would be impossible, wouldn't it? It would be impossible to help you with the description you've provided, wouldn't it? How can I reproduce the problem based on the description you've provided?


  • guest Tuesday, December 27, 2016

    @Juan Carlos

    your problem is probably at the connexion pool configuration!! your server didn't have enough information to acces the Database.


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha