Payara for Beginners – Adding Payara Server to NetBeans

Uncategorized

This blog uses NetBeans 11.1. If you’re using an older version, you may need to perform slightly different steps to get the same result.

When testing an app to be run on Payara Server, it can be extremely useful to be able to test your app continuously from your IDE. If you’re using NetBeans this is made very easy. Follow the steps in this blog to setup NetBeans to use Payara Server for running your web apps.

{{cta(‘9db7e8b3-2b4b-494a-a061-c7f91684544f’,’justifycenter’)}}

If you haven’t made a project to test yet, carry on to the first section of this guide. If you already have an app to run, then you can skip this section.

Creating a Test Maven Application

This first section will guide you through creating a Maven project which can be deployed to Payara Server. If you already have one in mind, you can skip to the next section.

  1. First, create a project using the new project wizard. Go to the Java with Maven category, and select Web Application. Click next.

Web Application” width=”734″ style=”width: 734px;”>

  1. Select a project name and location. The bottom 4 settings are for maven. For naming conventions use the following page: https://maven.apache.org/guides/mini/guide-naming-conventions.html

  1. The final section will give you an option to select a server. You can select Payara Server here if it’s already configured. If not, click add and continue to the next section.

Adding the Payara Server Plugin to NetBeans

Since NetBeans 11.1 the Payara Server plugins are installed by default. If the plugins are already installed, you can skip to the next section, otherwise this section will demonstrate how to install the plugins.

  1. From the top menu, go to ToolsPlugins.
  2. In the ‘Available Plugins’ tab search for Payara, then check following plugins:
    1. Payara Server – the main plugin, and contains the server plugin features
    2. Payara Common – common shared code between server and micro plugins
    3. Payara EE Common – API and SPI code for both plugins
    4. Payara Tooling – UI related source for both plugins
  3. Click install once all the relevant plugins are selected, and follow the installation wizard.

  1. After the plugin installation, click the Finish button to restart the NetBeans IDE.

Using the Payara Server NetBeans Plugin

Now that you’ve got your project set up and the plugins installed, you need to setup Payara Server in NetBeans.

Setting up Payara Server in NetBeans

  1. Go to ToolsServers and click Add Server (if you created a project as per the earlier section you’re already here).
  2. Select Payara Server, and name the server whatever you want. For this example I’ve named it ‘Payara’. Click Next.

  1. From this menu you can either select an empty directory and a Payara Server version to download, or you can select an existing Payara Server install directory. Accept the license agreement and click Next to continue.
  2. Select a domain. A domain is essentially a server at runtime. Unless you’ve created your own, you can use domain1 as it’s the default domain. Enter admin as the username and leave the password field blank.

  1. The server is now created!
  2. If you want to add the server to an already existing project, right click the project and select properties. From this menu, go to Run and select the new Payara Server as a target.

Running the Payara Server Application

After exiting this window, right click your test project and select Run (or click the green ‘Run’ arrow at the top of the window). The server will start up and you should eventually be greeted with a ‘Hello World!’ message in your browser.

To stop the server, switch to the server log at the bottom of the window under Output‘server name’. Click the stop sign in this window.

Debugging the Payara Server Application

Instead of clicking Run from the right click menu or the top of the NetBeans window, you can instead click Debug from similar locations to automatically run the program and attach the debugger to Payara Server.

Conclusion

That’s how to use the Payara Server NetBeans plugin! With a web application in NetBeans setup in this fashion you can deploy, undeploy and debug your application, amongst other things, and all from the NetBeans IDE.

{{cta(‘b515e79e-d13e-489f-8bc0-230da7e083c5’)}}

Comments (32)

Post a comment

Your email address will not be published. Required fields are marked *

Payara needs the contact information you provide to us to contact you about our products and services. You may unsubscribe from these communications at any time. For information on how to unsubscribe, as well as our privacy practices and commitment to protecting your privacy, please review our Legal & Privacy Policy.

  1. Larry Robinson

    This is like most of your blogs INCOMPLETE there has to be some steps missing because there is no way to follow along and have it work…A person can go up to selecting glassfish but from there on NO WORKEE

    1. Mike Croft

      Hi Larry,

      What part of the blog are you struggling with? It looks like all the necessary steps are there for me. Are you using the right version of NetBeans?

      Thanks,
      Mike

      1. nazmul prince

        What version of netbeans is needed there to do the exact you’re listed for adding payara server in netbeans?
        You should mention the ide’s version as it matters 🙂

        1. Matt Gill

          Hi Nazmul,

          Thank you for your comment. I’m using NetBeans 8.2, and I’ve updated the first paragraph of the blog to reflect this. As I’m aware NetBeans used to have a bug where it wouldn’t recognise Payara Server as a valid server, and the fix was as you mentioned below. Thankfully this has been fixed now, although I couldn’t find the exact version this fix happened. Because of this I would highly suggest using the latest version of NetBeans when integrating Payara Server; it makes things easier!

          Thanks,
          Matt

    2. nazmul prince

      Hello Larry
      Change the name console-core-4.1.1.jar to (path unzipped_payara_directory/glassfish/lib/install/applications/__admingui/WEB-INF/lib) console-core-4.1.jar

  2. Larry Robinson

    I thought bog was very good…I would like to see one thing added and, that is all of the ports payara41 uses
    I thought the blog was very good but needs one thing, IMOP, and that is all of the ports payara41 uses

  3. Larry Robinson

    I thought bog was very good…I would like to see one thing added and, that is all of the ports payara41 uses Yes and I figured out how to get it done…I will write back later today and tell you the missing steps…I do thank you and all there for what you all do May God Bless all of you and my best wishes
    I thought the blog was very good but needs one thing, IMOP, and that is all of the ports payara41 uses

    1. Matt Gill

      Hi Larry,

      I’m glad you’ve got it working now. Did you update NetBeans or rename the console-core.jar? Unless they’re manually changed, the ports used by Payara should be automatically filled into the fields by NetBeans.

      Thanks,
      Matt

  4. Ken

    How do you use the maven pom.xml dependency for this? Can you avoid the manual download if you set it up in maven?

  5. Matt Gill

    Hi Ken,

    In this project I just downloaded a Maven archetype from NetBeans to keep things simple. If you want to use a different project, then you can create it manually and import it into NetBeans. For a simple test project without archetypes, try this tutorial: http://blog.payara.fish/create-a-restful-web-service-with-payara-server-netbeans.

    I hope this helps.
    Matt

  6. Ahmed Ibrahim

    is there any specific extra feature that the payara Plugins provide when compared to the standard glass fish plugins included in netbeans?

    1. Gaurav Gupta

      With Payara plugin, developer can install and connect the latest version of Payara Server (e.g Payara Server 5.0.0.173-SNAPSHOT etc) and developer can also configure the SQL trace listener, log JDBC call, SQL query log threshold etc.

  7. Allen Conquest

    I had been successfully using the Payara NetBeans 1.0 plugin with NetBeans 8.2. But today I just noticed there was an update to version 1.1. After installing that the server no longer recognises my remote payara domain.

    Is there a problem with the new version of the plugin?

    1. Gaurav Gupta

      Hi Allen,

      Thanks for reporting the issue, Can you please share the screenshot of error, check the server.log for any exception wire trace and steps to reproduce the issue.

  8. Gabriel Disi

    This steps don’t work for Netbean 8.0.2. Is there a way around it or must I download Netbeans 8.2 ?

    Thanks in advance of your response.

    1. Gaurav Gupta

      Hi Gabriel,

      Payara Server plugin is only available for NetBeans IDE v8.1 & v8.2.
      I would highly recommend you to use the latest NetBeans IDE v8.2.

      Thanks,
      Gaurav Gupta

  9. Fahim

    While deploying the project then it says “/home/fahim/Payara_Server/glassfish/domains/payaradomain/autodeploy/bundles does not exist, please create it.”
    then it does not do anything. I am using “Payara Server 5.0.0.173-SNAPSHOT” version.
    Thanks.

    1. Matt Gill

      Hi Fahim, Unfortunately I can’t reproduce this with the latest Payara 5 Snapshot build. If you could raise this as an issue on our GitHub (https://github.com/payara/Payara/issues), we could address this more thoroughly. Kind regards, Matt

  10. Paul Henninger

    How do I get Payara to show up in NetBeans IDE 8.2 as an available plug in? I have unzipped the download to C:payara-5.182. The add plug ins window is looking for a .nbm file but one does not exist in the download. So basically nothing in this blog is working for me.

    1. Gaurav Gupta

      Hi Paul,

      You may download the nbm files from here : http://plugins.netbeans.org/plugin/72263/payara-server

      ** NetBeans plugins are not available in Payara Server folder.

  11. Erik Östlund

    I’m on Windows 10 and Netbeans 8.2 and for some reason Payara didn’t show up in the list of available plugins (or under updated or installed for that matter). As a workaround I downloaded it manually from http://plugins.netbeans.org/plugin/72263/payara-server, unpacked the archive and registered the plugins in Netbeans under the “Downloaded” tab of Tools -> Plugins.

    I vaguely remember trying an older version of this plugin some time ago so there could be something with my environment preventing Payara from showing up.

    1. Ondro Mihalyi

      Hi Erik,

      It seems that Netbeans removed the Payara plugin from the marketplace. You can still install it manually – download it from http://plugins.netbeans.org/plugin/72263/payara-server. It’s not bundled with Payara Server so you need to download it separately from the netbeans web page.

      1. Ondro Mihalyi

        Hi Erik,

        You can also add our Update Center to Netbeans until Payara plugins are available in the main Netbeans Update Center. So before searching for Payara plugins, do the following:

        1. On the Plugins window, switch to the Settings tab.
        2.. On the Settings tab, click *Add* button and the *Update Center Customizer* dialog box appears.
        3.. In the Name field, enter *Payara Update Center*.
        4. In the URL field, enter *https://github.com/payara/ecosystem-netbeans-plugin/releases/download/NB_8.2/updates.xml* and Click *OK* button.

  12. Ondro Mihalyi

    We’ve now published updated documentation of installing and using Payara Netbeans plugins: https://docs.payara.fish/documentation/ecosystem/netbeans-plugin/

  13. Chris Brown

    This guide is failing to work for myself, the Payara server fails to start meaning the project fails to connect when run. All plugins are installed, up to date and enabled.

    1. Matt Gill

      Hi Chris,

      I would suggest raising an issue on our Github or the Payara Google Forum. Make sure to post the error you’re getting.

      Kind regards,

      Matt

  14. Jasper de Vries

    Apparently you need NetBeans 8.2 (which I had to find out reading the comments). Any way to get Payara 4.2.x working with NB 9.0 and JDK 10+? Or is this not at all possible?

    1. Matt Gill

      Hi Jasper,

      I’ve added a comment to the blog mentioning this requirement. Unfortunately, Payara does not currently have JDK 10 support, although we hope to do so at some point in the future. The plugin does however work with NetBeans 9. To get it working, refer to our documentation: https://docs.payara.fish/documentation/ecosystem/netbeans-plugin/. You’ll need need to add our update center to install it.

      Kind regards,

      Matt

  15. jude

    I added payara server 5.193 to Netbeans 8.2 and when I tried to run a test web application the server did not start due to this error : Could not restart server Payara Server: Could not initialize server state listener
    C:UsersjudeDocumentsNetbeansProjectsTestingnbprojectbuild-impl.xml:1045: The module has not been deployed.

    See the server log for details aiso below:
    Error: Could not find or load main class Filespayara5glassfish.lib.grizzly-npn-bootstrap-1.6.jar

    1. Matt Gill

      Hi Jude,

      This could potentially be a problem with the NB plugin, but I’d need more information to know for sure. Can you raise this either on our forum https://groups.google.com/forum/#!forum/payara-forum or our GitHub https://github.com/payara/Payara/, and post it with some information from the server log and reproducer steps?

      Kind regards,

      Matt

  16. David

    I am using a remote payara server but I am having trouble getting netbeans to connect to it. It seems to find it but when I try to debug, it says ‘The target server does not support debugging’ – now what ? Your help would be greatly appreciated. Thanks.

    1. Matthew Gill

      Hi David,

      Firstly, have you made sure that debugging is enabled on the Payara Server instance and that the host is right in NetBeans? If you’re still having problems, please raise an issue on our GitHub and we’ll be able to assist you.

      Best regards,

      Matthew

Related Posts

4 minutes
Uncategorized

Leading the Way: Payara Platform Community 7 Beta Now Fully Jakarta EE 11 Certified

We’re excited to announce that Payara Platform Community 7 Beta application server is now fully certified as Jakarta EE 11 […]

Understanding the Security Issues of Aging Middleware 6 minutes
Community

Boost Developer Productivity with Payara Server Maven Plugin + AI Agent

Managing Payara Server Just Got Smarter  Imagine managing your Jakarta EE applications not just with Maven goals, but by […]

What Is a Java Application Server? A Short Guide 6 minutes
Jakarta EE

What Is a Java Application Server? A Short Guide

Enterprise Java applications power global commerce, healthcare, government and countless other industries. These systems must be scalable, secure and […]