I am new to Payara Micro and following this tutorial
I notice I can run the demo micro app as : java -jar payara-micro.jar --port 8280 --noCluster –deploy /path/to/ CrudPersistence.war
But I would ask : How can I run in DEBUG mode from NetBeans ?
ok , I can run it fron NB with payara-micro-maven-plugin:start , but why there isn’t a debug goal ?
jmanko
2
You can add the following to you project files:
pom.xml
:
<plugin>
<groupId>fish.payara.maven.plugins</groupId>
<artifactId>payara-micro-maven-plugin</artifactId>
<version>1.4.0</version>
<configuration>
<useUberJar>false</useUberJar>
<contextRoot>/my-context-path</contextRoot>
<payaraVersion>${version.payara}</payaraVersion>
<deployWar>false</deployWar>
<artifactItem>
<groupId>fish.payara.extras</groupId>
<artifactId>payara-micro</artifactId>
<version>${version.payara.micro}</version>
</artifactItem>
<javaCommandLineOptions>
<option>
<value>-Xdebug</value>
</option>
</javaCommandLineOptions>
<commandLineOptions>
<option>
<key>--nocluster</key>
</option>
<option>
<key>--port</key>
<value>8280</value>
</option>
<option>
<key>--postbootcommandfile</key>
<value>${project.basedir}/src/main/resources/post-boot-commands.txt</value>
</option>
<option>
<key>--deploy</key>
<value>${project.build.directory}/${project.build.finalName}</value>
</option>
</commandLineOptions>
</configuration>
</plugin>
/src/main/resources/post-boot-commands.txt
:
set-hazelcast-configuration --enabled=false
nbactions.xml
(<Env.
properties are for adding environment variables to the running server):
<?xml version="1.0" encoding="UTF-8"?>
<actions>
<action>
<actionName>debug</actionName>
<packagings>
<packaging>war</packaging>
</packagings>
<goals>
<goal>resources:resources</goal>
<goal>compiler:compile</goal>
<goal>war:exploded</goal>
<goal>payara-micro:stop</goal>
<goal>payara-micro:start</goal>
</goals>
<properties>
<exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address}</exec.args>
<jpda.listen>true</jpda.listen>
<netbeans.deploy.debugmode>true</netbeans.deploy.debugmode>
<netbeans.deploy>false</netbeans.deploy>
<Env.IS_DATABASE_USER>xxx</Env.IS_DATABASE_USER>
<Env.IS_DATABASE_PASS>xxx</Env.IS_DATABASE_PASS>
<Env.IS_DATABASE_NAME>xxx</Env.IS_DATABASE_NAME>
<Env.IS_DATABASE_SERVER>xxx</Env.IS_DATABASE_SERVER>
<Env.IS_DATABASE_SERVER_PORT>xxx</Env.IS_DATABASE_SERVER_PORT>
</properties>
</action>
<action>
<actionName>run</actionName>
<packagings>
<packaging>war</packaging>
</packagings>
<goals>
<goal>resources:resources</goal>
<goal>compiler:compile</goal>
<goal>war:exploded</goal>
<goal>payara-micro:stop</goal>
<goal>payara-micro:start</goal>
</goals>
<properties>
<netbeans.deploy>false</netbeans.deploy>
<Env.IS_DATABASE_USER>xxx</Env.IS_DATABASE_USER>
<Env.IS_DATABASE_PASS>xxx</Env.IS_DATABASE_PASS>
<Env.IS_DATABASE_NAME>xxx</Env.IS_DATABASE_NAME>
<Env.IS_DATABASE_SERVER>xxx</Env.IS_DATABASE_SERVER>
<Env.IS_DATABASE_SERVER_PORT>xxx</Env.IS_DATABASE_SERVER_PORT>
</properties>
</action>
</actions>
Then, just right click on the project and chose either Run
or Debug
.
1 Like