javaws does not pass -J VM arguments when using remote jnlp file - java-8

when I launch my application with local JNLP file
javaws -J-Xmx64m myApplication.jnlp
the application will run with -Xmx64m.
When I launch my application with remote jnlp file
javaws -J-Xmx64m "http://myserver/myApplication.jnlp"
then the jp2launcher seems to download the JNLP file and spawn new jp2launcher that runs my application. However the -J parameters are not passed to the new spawned jp2launcher.
I can verify this with JVisualVM.
Is this expected behavior? How can I pass -Xmx and other options to my application without specifying them inside the JNLP file (e.g. max-heap-size)?
I am using Java 8 on Windows 7+.
Thank you, Jan

Related

How to run Spring Boot Application as a Service?

I have deployed my web application on company server by executing jar files then the project is running fine.But when i close the jar and again try to run the project on browser then client is not able to access the application.I want solution on this that if i close the jar then also client can access the application.
you can use this simple command to run a jar file as background service...
javaw -jar test.jar
after run this command you could not detect any change in cmd...and can close your command prompt. after 1 or 2 minute enter your URL in browser .. you will see your web program is running...
before run this command must be stop previously running jar for avoid same port conflict
for more details
When you close the cmd prompt, your java application will also be killed. To keep the java application running after closing the terminal you have to use the below command.
nohup java -jar app_name.jar &
just replace the app_name with your application name and run the command.

JHipster Spring Boot executable war config not recognized

I am trying to experiment with a JHipster 4.3 app using Hazelcast. I have a setup of 3 Linux/CentOS7 VMs, each with latest 8 131 java/jdk on them. I build my war file for -Pprod and deploy to a dir at:
/var/jhiphaze/jhiphaze-0.0.1-SNAPSHOT.war
I have set this up as a service using systemctl. I am able to start | restart | etc.
I now have a need to debug into the application and would like to start the app up in debug mode. I read in the Spring Boot docs that I can place a file of the same base name with the extension of ".conf" and Spring Boot executable script will read the settings in the conf and start the app up with that. So I have a file:
/var/jhiphaze/jhiphaze-0.0.1-SNAPSHOT.conf
with the following line:
JAVA_OPTS="-agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=y"
This has no effect on the run of the war, it starts up fine but does not listen and the console out indicates that the app is not listening on 8787 (or any port).
I also tried on my windows workstation, simply running from cli using:
java -jar jhiphaze-0.0.1-SNAPSHOT.war
in the project /build dir with the jhiphaze-0.0.1-SNAPSHOT.conf placed in the same directory. It is ignored there as well. The same argument in the conf file work at the cli:
java -jar -agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=y jhiphaze-0.0.1-SNAPSHOT.war
works fine, pauses and waits for me to connect. Note that I used suspend=n for most of my attempts as I did not want the service start to fail while waiting for debugger to connect.
How can I get the executable war to recognize its partner .conf file?

How to start tomcat server manually

I installed tomcat 7 in my windows 7.Then ran C:\apache-tomcat-7.0.57\binstartup.bat,one window will open for 1 second and closes.when i hit http //localhost/8080 ,its not dsiplaying anything.I just checked C:\apache-tomcat-7.0.57\conf/server.xml and port is 8080.
Can somebody help on this.
Read RUNNING.txt and create C:\apache-tomcat-7.0.57\bin\setenv.bat file that sets JRE_HOME (or JAVA_HOME) path for Tomcat.
Sample from Tomcat 7 RUNNING.txt file using Java 6 JRE:
set "JRE_HOME=%ProgramFiles%\Java\jre6"
exit /b 0
You need to set Java_Home in Cataline.bat first in order to run TomCat server.
Additional Information for running project using Tomcat Server.
You can cd into the folder where tomcatXX/bin is through command line and run "run startup". So, when you , run startup on command line it tries to run script from startup.bat file, probably it crashed because port to be used by TomCat to run server is already in use. If you try to point your url to localhost:8080, if TomCat's home page appears, that would be because your server is already running. You should ideally also try to point to Windows -> Preference -> Runtime Environment. Check if Tomcat server is added in list under Server Runtime Environment window, if not try to add that server by clicking Add button, and trying to locate where Tomcat/bin is stored. If that still doesn't help, I would suggest you to also try right clicking a project on your IDE then click Run As, then click Run Configuration, it will give you option to run application using TomcatServer. List of servers will be found on left side of Run Configuration window.

server not starting with NoServerDefinedException (RAD/WebSphere)

I am using RAD 7 with WebSphere 6.1, after creating a new profile and a new server I am unable to start the server. The server fails to start with this error:
ADMU0128I: Starting tool with the AppSrv03 profile ADMU3100I: Reading
configuration for server: newserver
ADMU0111E: Program exiting with
error:
com.ibm.websphere.management.exception.NoServerDefinedException: No
configuration defined for server: newserver
This implies that there is no server with the name newserver.
How did you create the profiles? If i recall correctly, if you create a standalone server profile in WAS 6.1 the name of the server is a sacred "server1".
You have to run scripts to change the name of the server from "server1" to anything meaningful. I am guessing you haven't done that.
Go to the runtimes directory of your RAD and run the command serverstatus.bat and this would list the server names for that profile (run it froom your profile's bin directory).
This should tell you the server names. Run start server from within the command line and ensure that the server runs's properly.
This is what I would do for a start to move forward
HTH
Manglu
What command are you using to start the server here? I am assuming "newserver" is the name of profile here, so you can start the server using the following command
startServer server1 -profileName newserver
If you have only one profile then you don't need to specify profile name
startServer server1

Can't setup remote debugging with JBoss Web 2.1.4 windows and eclipse

I'm unable to find an option to setup remote debugging in JBossWeb 2.1.4 on Windows. It is not installed as a service and there are no .bat scripts where I can edit the JAVA_OPTS environment variable to include:
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=4142
The only thing in the jboss web bin directory are jbossweb.exe files.
I've tried editing the run configuration in eclipse to start the container by running jbossweb.exe and setting the environment variable JAVA_OPTS to the above, but it doesn't listen on port 4142 on startup (ie, there seems to be no effect in adding the environment variable to the run configuration).
Any ideas here?
If you control the server from eclipse with for instance JBoss Tools, you can just click "debug" instead of "start" in the Server pane in order to start up in debug mode.
You can create such bat script by yourself. Just add jboss.bat file to bin subdirectory of JBoss install directory and put there:
java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=4142 -jar "D:\JBoss.org\JBoss Web 2.1\bin\bootstrap.jar" start
When you run this script, you will get JBoss running in debug mode. Probably, it won't help you in all situations, but it worked for me.

Resources