Glassfish step by step hot deploy - netbeans

Hello i would like ask how it is possible configure glassfish server for something like live, hot deployment:
every time when i change some code of my jsp,html,js or css file i always need to clean and build project than deploy project to glassfish and again, again and again. That cost a lot of my time. I waste time for that. It will be easy when i could work on files which already use a started glasfish (deployed). But this files is in WAR file "project.war" and through my IDE (Netbeans) i cant edit this files (jsp,css,html or js). Netbeans made this file non editable.
Do you have idea how to speed up my development? I Will grateful for help.
Here is my glasfish home folder and all of 2 deployed applications are empty

yes, you can. if you need change xhtml, js, css only you can do this after your war was deployed. You can find all the files in the folder of your application
****\glassfish-4.1\glassfish\domains\domain1\applications\MyWebApplication\
when you complete your changes you need copy them to project folder and rebuild war

Related

Eclipse + Wildfly + Maven EAR project, is it possible to have files update without redeploy?

I'm working on my first JavaEE/JSF project. It's currently set up with maven so that several jars and a war are deployed inside an EAR container. I spent a lot of time trying to get some kind of hot/autoredeploy type setup going a few weeks ago but gave up and have been doing it manually. The problem i'm having is the maven build has grown to be time consuming and it takes upwards of a full two minutes to build and deploy. When i'm making a small change to an xhtml or css file it would be nice to not have to redeploy the app. I assume to do this i need both the ear and the war to be deployed exploded. How can i accomplish this with maven and eclipse? Is there a tutorial that i haven't found? Thanks for any insight.
Don't wan't to disagree with BlagusC (the one and only here ;-) ) but for normal changes "hotdeployment" should work fine. Only if you change backing beans structure (e.g.: add methods, add classes) restart is needed.
Important thing is that you start the server in debug mode - here are my server settings:
Overview Tab:
Deployment Tab:
For xhtml and css files this works fine!

How to do hot deployment in Jboss5

I have got a maven project.
So when ever there is a changes done in java file, we take a rebuild of the application .
Put our ear file in deploy folder of jboss and restart the Jboss.
This waste our lot of time in restarting jboss again and again .
I heard about hot deployment in Jboss .
Can any one tell how to do in my case .
Hot deploy is enabled by default in JBoss AS 5.
It should start automatically a couple of seconds after you put ear in deploy folder.
Maybe someone had previously disabled hot deployment on your instance.
Then see Turning off JBoss hot deploy service? and do the opposite.
As I understand, u need a class reloading solution, not auto redeployment.
I recently work out a solution with JBoss 4.x. It probably work with JBoss5.x too. In most of time when I change my code, it reflects immediatly and no redeployment in JBoss.
Here is how:
Turn off JBoss hot deploy service, u can google how.
Create a folder named project.war under JBoss deploy folder, it just works like a war file.
User a file sychronize tools(like FreeFileSync) to sychronize your_project_web_root folder to the project.war folder.
The most important part, use spring-loaded. It's easy and no need to change anything in your project.
4.1 Download springloaded.jar
4.2 If u are using eclipse, just add the following code in the VM arguments of the JBoss Run Configuration.
-javaagent:/springloaded-{VERSION}.jar -noverify
That's it. Now u modify/add methods or fields in a class and then sychronize the class file to the project.war folder, JBoss will reload it and the changes reflect immediately. But springloaded still got some limitation, read the FAQ.

How to Pick up CSS Changes in GWT Application

Using Tomcat, I build a new WAR via Maven. Then I copy the output WAR to $TOMCAT_HOME/webapps. Then, ROOT.war becomes exploded and ROOT appears.
If I modify ROOT/style/core.css, will those changes be picked up by my web app at run-time when I re-run $TOMCAT_HOME/bin/catalina.sh start?
Note, this is a GWT application.
If you change files in the exploded WAR directory inside your webapps folder, the changes will immediately be visible. You don't even have to restart Tomcat for this to work.
I think there is a dev mode for GWT that will load the CSS as a static file distinct from the rest of the app. This wold enable normal editing of the file on disk to be seen in your gui.
https://developers.google.com/web-toolkit/doc/latest/DevGuideCompilingAndDebugging#DevGuideDevMode

Deploy a War file with Eclipse and Tomcat 6 without a build file

I know there are a bunch of posts on this topic, but I can't seem to figure it out. Here is my setup:
- Eclipse Indigo
- Tomcat 6
- Struts WAR file that I imported into Eclipse from http://www.manning.com/dbrown/SampleApplication.zip
I added the server to Eclipse, and added the project to the server. It runs fine, but I'd like to make some changes to the XML and java files (not the jsp files). I was under the impression that Eclipse takes care of the deployment after I save and restart the server, but I guess this isn't the case. I looked into creating an ant file to do a custom build, but I'm not really sure how to make it since I don't even know how to do a deployment "manually". How would I go about doing a manual deployment? Thanks.
A war file is usually created by exporting it from an IDE like eclipse, netbeans, etc.
While generating a war file there is 2 options,
You can include your java files with it
You can avoid java files from it.
In both the cases class files will be there which are created from java files. Class files will be able to take care of the actions of java class.
If the war file which you down loaded is not having those java files, you will not be able to use it with eclipse, where as it will work fine if you are putting it into tomcat directory for running.
For running a war file manually just put it into tomcat webapps folder and run tomcat.
Then you can access the pages using the url.
http://localhost:8080/yourprojectname/
If you want to check whether the war file contains any java files, after starting the tomcat server it will extract the war file into the same directry, where you can search for java files.
If you want to run the project from eclipse,
import it into eclipse, open index.jsp page
right click-> run as-> run on server
if you have not yet configured the server yet,select the server in the list, specify its installation path, then add projects into server in next step, finish it. then it will load your project.
Please provide little more details so that we can help you better.
manual: copy the war in the tomcat folder then start tomcat.
if you want to use eclipse you need to click redeploy war first by right clickling the deployed war in the servers tab under tomcat.

Efficient dev cycle with Maven, Tomcat/Glassfish, Archetype?

So far i've been using tomcat and glassfish to develop a testing webapp, without maven. And the usual development-till-deploy cycle is simple :
develop in eclipse ide, with a WebContent folder, which is the root webapp folder that has the WEB-INF, web.xml, WEB-INF/lib, n all. The compiled classes location in eclipse is set to WEB-INF/classes.
after coding, i could just click on the reload button in glassfish admin console for that specific webapp. In tomcat, i believe it's reload also in the tomcat manager.
i could access the web application in the browser
Now if i would like to create a new webapp, that'll make use of latest stuffs of jsf, spring, jpa, hibernate, postgresql :
what recommendation of archetype should i use in the creation of the project ?
can i still use my previous steps of development? because i think it's very easy without having to repackage everything into a war file, or copying it into the tomcat's webapp folder everytime i want to test. Saving the files in eclipse, hit on the reload in the admin console / tomcat manager, and i could instantly test the updated webapp.
Or what do you usually do in the webapp development cycle ? Please share your experiences, =)
Thank you !
Development Cycle with Maven and Friends
Use Maven to drive your code-build-test-deploy-release cycle.
Start with Maven Archetype that suits closest to your web-app. This will create the whole folder structure for you and will add Jar depencies.
Use an embeded light-weight server like Jetty, this will be very fast on dev machine without sucking resources and is highly configurable. Plus, you can set it to auto-reload changes.
Most of Maven project are supposed to be test-driven. Of which Maven takes care of using it's surefire plug-in. So, every build will have a test phase.
You can define multiple profile for various environments (test, dev, prod, Win, Unix..). These profile will alter the behaviour of the project to be compatible with the environment.
Use Cargo, again a Maven plugin to deploy your builds on test or production server, which can be Glassfish, Tomcat, Jetty or any oter webserver.
Use Liquibase with or without Maven :) to manage your database changes the same way you manage your code change.
I came from almost similar project as yours in my previous company. Development with Maven makes things so smooth and the change is appreciable.
A little Google search shows that someone has worked on archetypes for JSF and JPA with Spring
Edit#1 -- added more details
Feasibility and Ease of Use
Maven is born out of neccessity to simplify the dev process for large and distributed code.
Maven is very well integrated with Eclipse -- so it's painless.
Jetty keeps monitoring source folders, so your changes gets deployed almost immediately.
You can customize the build to skip tests, to not build dependecies. When you just edit a UI component, Jetty will silently copy it to "target" folder.
If you're worried about copying and redeploying. You must read THIS to see how efficiently things are done, keeping in mind that you don't have to compile-test-deploy everytime you change a JSP or HTML.
That said, I would like to mention that Maven might be a challanging learning. This is an object oriented way of development cycle, to say. Most of us, who are used to build script, can find a bit tedious/verbose initially.
Resources
I would suggest to go through the following resources
Maven Book - Maven basics
Automated Deployment with Maven - going the whole nine yards If you can, literally follow this pattern.
Maven 2 Effective Implementation -- this book really helped us a lot.
for the q2 :
You can still run/debug app with tomcat from within the IDE (eclipse) even if you change the directory structure. (like the maven dir structure instead of eclipse's dynamic web dir structure)
Project properties - >
project facets - >
Dynamic Web Module ->
Click the appearing "further configuration available"
and set your content dir and context root.
You dont have to package everytime you want to run/debug it.
Another option is using Jetty
And I am sure there are more options others will tell as well.