1 2 Previous Next 21 Replies Latest reply: Feb 8, 2012 2:50 PM by Rafik F RSS

maven and jboss hot deployment does not work correctly

nimo stephan Master

I use maven with jboss tools 3.2 cr1 and the hot-deployment does not work correctly.

 

When deploying after a mvn-rebuild, the source-folders are all empty only the static-resources are deployed. I looked in my target-folder after build and all sources are correctly there, but rf tools does not transport it. A full publish does not make any changes - source folders are empty in my deploy-dir. When deleting the war manually and stopping the server and republish again, then it works - but not very time-friendly. By the way, when stopping the server while hot-deploying a resource via jboss tools, my server hangs so long and so the eclipse gui - it hangs often more than a few minutes. Why is that so? I only have a little war file (~3mb) deployed and nothing more in my local deploy-dir.

  • 1. maven and jboss hot deployment does not work correctly
    Max Rydahl Andersen Master

    You don't say *how* you deploy.

     

    are you using mvn for it ?

    WTP project ?

    Project Archives ?

    is m2eclipse involved ?

  • 2. maven and jboss hot deployment does not work correctly
    Snjezana Peco Expert

    Could you please provide us with some more info?

    What server are you using?

    How did you create your project - using JBoss Tools 3.2.0.CR1, any older JBoss Tools version or in any other way?

    What do you mean by "mvn-rebuild"?

    Could you also please explain the meaning of "when stopping the server while hot-deploying a resource via jboss tools"?

    It would be good if you could provide an example of your project.

  • 3. Re: maven and jboss hot deployment does not work correctly
    nimo stephan Master

    sorry, here more facts:

     

    I use mvn, it is a wtp-jsf-project, war-archive and m2eclipse with maven-jboss tools support and jboss 3.2 cr1 is included in eclipse 3.6. I use jee6 with jboss 6, weld, jsf.

     

     

    Here are the steps:

    1. I use "mvn -package", which compiles and packages my little war (~3MB) in the target-folder of my maven-archetype-structure (archetype is called "jboss-weld-jsf-jee6").(I cannot use mvn -deploy, cos then jboss tools hot deployement does not work.)

    2. Then I go to the "server-view of jboss tools", "add" this war file press the "publish"-button.

    3. I start jboos as and wait (about 2 Minutes !)

    4. I go to the webpage of my war on the browser and get the failure "no source NPE".

    5. I found out, that "jboss publish" did not publish any class-files. It published all other files and even all directories, but no class-files. However, these class files does exist in my target-folder.

    6. So I deleted the war-file from the deploy-directory via jboss-undeploy-button and redeployed again via "deploy"+"publish"-button.

    7. All files and directories are copied  - but no class-files.

    8. I clicked also the "full publish"-button - no class files are copied.

    9. I stopped the jboss-server and tried again with full publish - and now class files are copied.

    10. I started the jboss-server, wait ~2 minutes and made a change of a java-file and use mvn-package and "full publish"-button - my class file was not updated (!), but jboss tools forces the jboss instance to start again (with the old files) - so I have to wait and loose 2 minutes again.

    11. Static sources (xhtml) are republished successfully in hot-deployement without problems. However, I do not know, when and why, sporadically the hot-deployment of java-class-files works.

     

    The other thing is:

    When stopping the server instance, then I have to wait very very often more than 5 Minutes - jboss tools brings a pop up with the info - "problems by stopping the server" - however, the log of the server told me that it was already stopped, but it hangs and my eclipse ide hangs while jboss tools tries to stop the already stopped server.

     

    If I made anything wrong, please let me know. Should I use mvn-deploy (or mvn-harddeploy) before hot-deployement (incremental publish). When java-sources are changed, then it has to be compiled, but jboss-tools does not compile it - I have to use mvn to compile my sources before I can use jboss-hot deployement, am I right?

     

    My big problem is:

    I spend time more to wait than to develop - I wait 2-3 minutes to start the server - I wait 3-5 minutes to stop the server. If I make in one hour only 5 little changes in my source-code (java-files) which I want to view in my browser, then I have to wait ~5*3+5*3 minutes in one hour - ~30 minutes in one hour is lost and not productive!! It is really not exaggerated!

     

    While waiting and trying, I can not be productive and I loose the focus of my business logic. It is really frustrating to wait and wait and (re)try again only to view the result of a little change of my source code.

     

    Sorry, I am really not sure, if jboss tools or eclipse or jboss AS is the problem. My PC is a dual core 2.66 ghz with 300 mb ram. I found out that glassfish with netbeans only need about 8-12 seconds for hot-deployement of exactly the same war-file (which is about 3 MB) on my machine.

  • 5. maven and jboss hot deployment does not work correctly
    Snjezana Peco Expert

    If you want to use maven and JBoss Tools, I would propose you to do the following:

     

    - install the JBoss Maven Integration feature using the http://download.jboss.org/jbosstools/updates/development/ update site (the Maven support category)

    - import your Maven project using File>Import>Maven>Existing Maven Projects

     

    This way, you will have a standard WTP project that can be deployed if you right-click the server in the Servers view and call the Add and Remove... action.

    All the JBoss features (VPE editor, CDI ...) will be available to you.

    You won't have to use maven to rebuild the project after changing something. For more details see http://community.jboss.org/people/snjeza/blog/2011/02/02/getting-started-with-jboss-tools-jboss-maven-integration-and-weld

     

    I suppose the problem happens because maven recreates the complete application and the JBoss AS servers tries to redeploy it.

    If you develop the application the way I described, JBoss Tools will deploy only those files that are changed.

    Hot deployment will work for xhtml files. JBoss AS doesn't support hot deployment of Java files.

    You can start the server in the debug mode and use the standard JDK Hotswap.

  • 6. Re: maven and jboss hot deployment does not work correctly
    nimo stephan Master

    I have already installed JBoss Maven Integration.

     

    I will try it as you described, thanks!

     

    I will let you know the results in few days.

  • 7. Re: maven and jboss hot deployment does not work correctly
    nimo stephan Master

    You won't have to use maven to rebuild the project after changing something.

     

    This was my failure - I rebuild it by maven after source changed. Now, it let it "build automatically" and jboss tools transports these changes. It works:)

     

    If you develop the application the way I described, JBoss Tools will deploy only those files that are changed.

     

    Yes, it works perfect! Thank you !!

  • 10. Re: maven and jboss hot deployment does not work correctly
    u j Novice

    The link works, thanks.

     

    However, I use jboss tools 3.2 for a RichFaces 4 web application with Maven and do everything as described, but in the jboss deploy folder appears only a myapp.war folder without the xhtml-, web.xml and faces-config.xml files. Only the Java class-files are deployed.

    I created the application with Maven and imported it into Eclipse, so the project has the standard Maven layout.

     

    On the other hand, if I mark as deployable the war created by Maven, it is deployed correctly, but in that case I have to build it each time with Maven. As above, the idea is to avoid this.

     

    Thanks,

    Ulrich

  • 11. Re: maven and jboss hot deployment does not work correctly
    Snjezana Peco Expert

    Could you please send your .project, .classpath files and .settings directory and if it is possible the pom.xml file or, at least, the configuration of the maven-war-plugin plugin?

  • 12. Re: maven and jboss hot deployment does not work correctly
    u j Novice

    Here we go.

    I am not sure which plugin you mean exactly.

     

    Thanks in advance,

    Ulrich

  • 13. Re: maven and jboss hot deployment does not work correctly
    Snjezana Peco Expert

    For some reason your warSourceDirectory isn't set correctly.

    Try to right-click the project and call Maven>Update Project Configuration.

    If this doesn't help, probably there is a bug in the m2eclipse-wtp integration.

     

    A workaround is to replace

    <wb-resource deploy-path="/" source-path="/smsurbano-1.0-SNAPSHOT"/>

    with

    <wb-resource deploy-path="/" source-path="/src/main/webapp"/>

    in the .settings/org.eclipse.wst.common.component.

     

    BTW, since you are using Java EE 6 and JDK 6, you have to set the compiler target and source to 1.6.

    ...

    <plugin>

         <artifactId>maven-compiler-plugin</artifactId>

         <configuration>

             <source>1.6</source>

             <target>1.6</target>

         </configuration>

    </plugin>

    ...

  • 14. Re: maven and jboss hot deployment does not work correctly
    u j Novice

    Okay, I corrected source and target jdk in pom.xml and got it to deploy correctly, but although all files are now in an exploded directory below default/deploy, I get an http 404 error if I access the URL. The jboss console confirmed the deployment. No error message is shown.

    On the other hand, if I copy the war manually, the application works.

     

    BTW, I am new to Maven and don't understand why it created two directories (...-SNAPSHOT and src/main/webapp) with duplicated web.xml etc. files. What is the purpose of the ...-SNAPSHOT directory?

     

    Thanks,

    Ulrich

1 2 Previous Next