dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #20998
Re: Using jrebel to stop waiting for redeploying
I solved that issue just now after posting...
Thanks Thanh, your post helped a lot!!
I was using the following:
<plugin>
<groupId>org.zeroturnaround</groupId>
<artifactId>jrebel-maven-plugin</artifactId>
<version>1.1.3</version>
*<configuration>*
* <alwaysGenerate>true</alwaysGenerate>*
*
<addResourcesDirToRebelXml>true</addResourcesDirToRebelXml>*
* <showGenerated>true</showGenerated>*
* </configuration>*
<executions>
<execution>
<id>generate-rebel-xml</id>
<phase>process-resources</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
the <configuration>...</configuration> was the problem. Once I removed that
it works fine.
By the way, you forgot to mention that if using the command-line run *mvn
compile* after making changes to Java files for it to be reloaded by JRebel.
Unless you are using Netbeans and its awesome compile on save feature ;-)
... I'm also using the Netbeans jrebel plugin, which integrated nicely with
Run/debug and a button to switch on/switch off Jrebel monitoring.
---
Regards,
Saptarshi PURKAYASTHA
My Tech Blog: http://sunnytalkstech.blogspot.com
You Live by CHOICE, Not by CHANCE
On 19 February 2013 05:25, Saptarshi Purkayastha <sunbiz@xxxxxxxxx> wrote:
> Hey Thanh,
>
> Perfect timing since I've been doing the same over the last night...
> trying to run DHIS2 with JRebel and Maven!
>
> There is some problem with spring security and I have to disable the
> jrebel-spring-plugin with -Debel.spring_plugin=false when starting maven.
> There is also the following that I'm stuck at the moment.
>
> Following is an exception that I am getting:
> Unable to load configuration. - package -
> file:/C:/dhis2/dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/target/classes/struts.xml:9:123
> at
> com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:69)
> at
> org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:390)
> at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:436)
> at
> org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:193)
> at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97)
> at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
> at
> org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:713)
> at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
> at
> org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1282)
> at
> org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:518)
> at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:499)
> at
> org.mortbay.jetty.plugin.Jetty6PluginWebAppContext.doStart(Jetty6PluginWebAppContext.java:115)
> at
> org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
> at
> org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
> at
> org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:156)
> at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
> at
> org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
> at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
> at
> org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
> at org.mortbay.jetty.Server.doStart(Server.java:224)
> at
> org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
> at
> org.mortbay.jetty.plugin.Jetty6PluginServer.start(Jetty6PluginServer.java:132)
> at
> org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:454)
> at
> org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:396)
> at
> org.mortbay.jetty.plugin.AbstractJettyRunMojo.execute(AbstractJettyRunMojo.java:210)
> at org.mortbay.jetty.plugin.Jetty6RunMojo.execute(Jetty6RunMojo.java:184)
> at
> org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
> at
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
> at
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
> at
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
> at
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
> at
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
> at
> org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
> at
> org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
> at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
> at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
> at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
> at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
> at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:601)
> at
> org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
> at
> org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
> at
> org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
> at
> org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
> Caused by: The package name 'dhis-web-maintenance-user' at location
> package -
> file:/C:/dhis2/dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/target/classes/struts.xml:9:123
> is already been used by another package at location package -
> file:/C:/dhis2/dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/struts.xml:9:123
> - package -
> file:/C:/dhis2/dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/target/classes/struts.xml:9:123
> at
> com.opensymphony.xwork2.config.impl.DefaultConfiguration.addPackageConfig(DefaultConfiguration.java:150)
> at
> com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:494)
> at
> com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:278)
> at
> org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:112)
> at
> com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:230)
> at
> com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
> ... 46 more
>
>
> To which pom.xml are you adding the jrebel plugin to the build?
> to dhis-web-portal or dhis-web, so that all projects get the rebel.xml?
>
> PS: You can always hide the posting to your facebook profile when giving
> the application permissions make it to Only me!! :D
>
> ---
> Regards,
> Saptarshi PURKAYASTHA
>
> My Tech Blog: http://sunnytalkstech.blogspot.com
> You Live by CHOICE, Not by CHANCE
>
>
> On 19 February 2013 04:55, Ngoc Thanh Nguyen <thanh.hispvietnam@xxxxxxxxx>wrote:
>
>> Hi all,
>>
>> One of the most time consuming task when programming with dhis2 is
>> waiting for redeploying. When a small change on java code must take few
>> minutes for jvm to reload the context, coding becomes very arduous task,
>> especially building portal with a large number of modules.
>>
>> I have tried JRebel and it is a big surprise to me. Going beyond what the
>> company (ZeroTurnaround) advertises, JRebel is really rocks: Java code
>> change effects immediately, so do *.vm, js, css; super easy to getting
>> start (please see my tutorial below); and its completely free if you join
>> their social license, a license that integrates with Facebook so that
>> JRebel can post few message on your behalf claiming how much time you can
>> save using JRebel. Don't worry this posting is so rare, once a week or
>> month.
>>
>> Steps to start DHIS2 with JRebel.
>>
>> 1. Follow the following tutorial to register the license (it is just a
>> hashed string, you copy and paste into your license activation step)
>> http://zeroturnaround.com/software/jrebel/jrebel-social-tutorial/
>>
>> 2. Now steps to configure JRebel with dhis2. I know most of dhis2
>> developers use Maven instead of IDE to build. Documents on how to run
>> JRebel with Maven is a bit scarce however there is a few. This is a good
>> one.
>> *
>> http://padcom13.blogspot.com/2011/09/using-jrebel-from-pure-maven-in-web.html
>> *
>> *
>> *
>> *Remember:
>> 3. In the pom.xml, you need to set the maven jrebel plugin, i.e.*
>> <!-- enable generation of jrebel.xml - needed for the agent -->
>> <plugin>
>> <groupId>org.zeroturnaround</groupId>
>> <artifactId>jrebel-maven-plugin</artifactId>
>> <executions>
>> <execution>
>> <id>generate-rebel-xml</id>
>> <phase>process-resources</phase>
>> <goals>
>> <goal>generate</goal>
>> </goals>
>> </execution>
>> </executions>
>> </plugin>
>>
>> 4. In the environmental variables, set MAVEN_OPTS to have javaagent which
>> points to the folder of jrebel.
>> My MAVEN_OPTS as I extracted jrebel in C:/
>> [image: Inline image 1]
>> 5. Then use mvn jetty:run and enjoy autoredeploy of JRebel. Now all the
>> changes on classes and webapp will be watched and redeployed. Therefore, in
>> your IDE you must set on Build Automatically so that every change on source
>> will be compiled to classes.
>>
>> Note that dont use *maven jetty:**run-war* as Jrebel will watch changes
>> on target/classes and it is not what we want.
>> *
>> *
>> It might require several rounds of configuration until JRebel get run but
>> the result is so rewarded. Let me know if you have any issues.
>>
>> Thanh
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~dhis2-devs
>> Post to : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~dhis2-devs
>> More help : https://help.launchpad.net/ListHelp
>>
>>
>
References