How to run VisualVM Eclipse Plugin - java

I am trying to run Visual Plugin in Eclipse Juno. Visual VM usage instructions are confusing. Running my application on Tomcat server and I have no idea how to point it to Visual VM.
Usage Instructions:
Create a new application configuration
Choose the "VisualVM Launcher" as the application launcher
Run/Debug the application with the created configuration to have VisualVM started automatically.
How would I choose Visual VM Launcher for my application which is running on Tomcat?

The VisualVM plugin for Eclipse is only useful when you can start the application from within Eclipse (i.e. when it's a plain Java application, not Tomcat or something that is to be deployed in Tomcat).
In your case, just start jvisualvm (which you can find the same folder as javac) and select the Tomcat process in the dialog.
Note that you may have to configure Tomcat to allow VisualVM to connect.
Alternatively, you can create a launch config for Tomcat but to do this, you will have to read the startup files, collect all JARs that have to go into the classpath manually and correctly, collect startup parameters, use the correct "current directory", set a couple of system properties ... it's possible but you probably don't want to try.

Related

Tomcat. dynamic extend heap memory

I have a task to automaticly extend heap memory for our tomcat application. I know it isn't possible by JDK features, and I'm looking for any dirty(or not) hack to make that kinda feature. The main reason of that demand is minimal configuration of tomcat before start demo version of our application. In other word no user of our application will have any access to configuration of JVM/tomcat.
Application required ~1024M of heap memory, default value for tomcat8 is 256M, which isn't appropriate for our goals.
At this moment I have two possible solutions:
An a .sh/.bat script which will configure tomcat. pros - it will do the work, cons - it's another point of configuration demo stand(copying of a script)
An wrapper for our application, which goes in the same war file and configure tomcat if required. pros - it will do the work, and no new configuration point(Just install tomcat and copy the war file),
Is there another way to do that in more... common and simple way?
EDIT The main goal is to make installation of our application in following steps:
Install tomcat
Copy war file
Start tomcat
no any additional configuration, just copy war and start tomcat
That is commonly solved by wrapping the installation and configuration of tomcat in an installation script. Pros: the end user just download the installer and runs it; cons: the installation script must be tailored for the final environment (one for Windows, one for Linux) and can be hard to write. A sometimes simpler way is to provide a zip containing a readme.txt file and a install.bat (or install.sh)
An alternate way if the configuration is really complex is to directly configure a VM (VMDK is a de facto standard), and let the users install the virtualizer they prefere.

How can I package a Tomcat server into a standalone, double-clickable package?

I have a simple Tomcat Server set up in Eclipse on a Windows 7 machine. Eclipse by default uses metadata to deploy Tomcat server instances without having to take over the Tomcat installation folder (and allowing multiple parallel servers, provided they don't try to use the same ports). In order to start my server up, I have to open Eclipse, build my project, and start the server my project is assigned to in the Servers view.
I would like to start this same server up:
Without having to open Eclipse
With a single action, preferably double-clicking a file on my desktop.
With its own console window
I've looked into making Java programs into standalones, and the most common suggestion is to package it into a runnable .jar file. This uses a Launch configuration, which doesn't really work for my case because the server has no associated Launch configuration; to run it you start a Server rather than clicking run.
Is there a built-in way in Eclipse to make the server equivalent of a runnable .jar? That is, is there a built-in way in Eclipse to package a Tomcat server to run as a stand-alone?

How to test web project from eclipse to jboss as7 without mvn jboss-as:deploy

My firm is change the development environment, looking for some tricks and tips on how to work in the new environment.
The current environment is Eclipse and Tomcat. We are developing web applications with Spring, Web Flow, and MySQL..
The new environment is going to be Eclipse, Jboss AS7 and Maven.
Question 1:
Now for the questions as the current time we run tomcat on the local workstations and I can use eclipse to write my code and then just click on “Run On Server” and eclipse will build the war file and start tomcat.
With the new environment it does not look like Eclipse can start and stop and depoy right to Jboss AS so we are running a command line: mvn jboss-as:deploy does anyone know a better way?
Question 2:
Debugging.. Does anyone know how to get debugging working with eclipse and jboss as7
1) You can use "Run On server" with JBoss As 7 just like you do it with Tomcat. Just add new server in Eclipse for JBoss As. One difference comparing to adding new server for Tomcat is that during new server definition you should also create new runtime Environment for JBoss (if you haven't done this before) but this is very easy and intuitive. And there is a lot of examples in internet.
2) Debug is working with JBoss As very good too. If you start server from eclipse, then you can use debugger like you have used it before for Tomcat. If you run your server from command line without Eclipse, you can use remote debug from eclipse (as I remember Dubug as.. -> Remote Java Application and then specify there project, host and port).

How to debug ant build war files

I use ant script to create a war file of my application. Is there a way to debug my application in eclipse?
If you are using tomcat server. Install Mongrel plug-in to your eclipse. After building ant script, just add break points to code and click on tomcat start button provided by Mongrel plug-in. Your app will be automatically running in debug mode. And Mongrel(Tomcat) automatically deploys your war file.
I am currently using the same for my projects.
If you have all the source code in Eclipse and merely use the ant script for building, you should be able to do debugging by just putting the generated war in the deploy folder of your server (or doing whatever else your server requires to deploy a war), and then simply start up your server via Eclipse.
Eclipse wouldn't 'know' that anything has been deployed to the server it has just started, but the connection between WTP's deployer and JDT's debugger is pretty weak anyway. It will simply try to match classes in the JVM to Java files in your workspace. If you have the actual source there this will of course match and you can debug.

Auto start glassfish with RESTless service

I've been looking for instructions on how to automatically start my GlassFish server with my RESTful application on top of it. I have it installed via the NetBeans IDE and I normally control it through NetBeans but I need to transition away from the dev environment to a test environment. Links to tutorials would be appriciated.
How to start a Glassfish instance when the server starts: that's operating system dependent, on Windows it involves registering Glassfish as a service, for Linux you can follow this tutorial.
How to start an application with Glassfish, or how to migrate an application from the instance embedded in Netbeans to a production server: two easy ways
register your production server in Netbeans, in project properties change the Run target to that newly registered server and deploy via right click on the project in the Projects view, option Deploy.
When you Build a project in Netbeans, a dist subdirectory will be created in the project directory - switch to the Files tab to see it. That directory will contain the compiled and packaged projet (jar, war or ear depending on the project type). Point your browser to the administrative interface of the production Glassfish (in most installations http://yourproductionserver:4848 ), select the correct application type in the tree on the left, click Deploy and upload the file from the dist subdirectory.
Personally I prefer option 2 but that may be a matter of taste. Thorbjørn already explained yet another possibility, via the autodeploy folder. Whichever you choose, the application will start once deployed and will automatically start every time the Glassfish server starts.
Create a WAR or EAR and put it in the autodeploy folder in the domain.
Then it will start every time Glassfish is started.
Additionally under Windows you can use the asadmin create-service facility to create a service (.NET required).

Categories