dcevm
Dynamic Code Evolution VM for Java 7/8
I am going to develop custom HotswapAgent plugin, but I don't know where it should be deployed.
All standard plugins are bundled within agent jar file. Is there any directory where should I put my plugin jar file or do I have to embed it in the agent jar file?
Source: (StackOverflow)
I have dynamic web project which is deployed as part of EAR on weblogic server. I am using eclipse IDE. I have used jar available on http://dcevm.github.io/ to configure DCEVM as alternated JVM for JDk1.7.0_45. After starting my server and publishing my application, if I make changes to java files(add new methods, rename methods) I don't see the change. I still see the error in eclipse as "Hot code replace failed.
Am I missing any step/setting? Please help
Source: (StackOverflow)
I'm using dcevm + run-jetty-run + livereload , try to develop a web app without restarting jetty when modifing java sources.
Everything works fine. When I modified a java class, livereload monitored the change, and triggered the browser refreshing opened pages to see the modified result.
But I found it still not that convenient: When browser reloads, dcevm and jetty may have not reloaded that modified classes yet. I have to manually refresh the page again, but I'm not sure if it shows the modified result this time, without checking the content carefully.
So I wonder is there any way to let jetty blocks the request when I modified some classes and dcevm is reloading. It will make sure the pages displayed are always modified.
Source: (StackOverflow)
I am using Freemarker and DCEVM+HotSwapManager agent. This basically allows me to hotswap classes even when adding/removing methods.
Everything works like charm until Freemarker uses hotswapped class as model. It's throwing freemarker.ext.beans.InvalidPropertyException: No such bean property on me even though reflection shows that the method is there (checked during debug session).
I am using
final Method clearInfoMethod = beanWrapper.getClass().getDeclaredMethod("removeIntrospectionInfo", Class.class);
clearInfoMethod.setAccessible(true);
clearInfoMethod.invoke(clazz);
to clear the cache, but it does not work. I even tried to obtain classCache member field and clear it using reflection but it does not work too.
What am I doing wrong?
I just need to force freemarker to throw away any introspection on model class/classes he has already obtained.
Is there any way?
UPDATE
Example code
Application.java
// Application.java
public class Application
{
public static final String TEMPLATE_PATH = "TemplatePath";
public static final String DEFAULT_TEMPLATE_PATH = "./";
private static Application INSTANCE;
private Configuration freemarkerConfiguration;
private BeansWrapper beanWrapper;
public static void main(String[] args)
{
final Application application = new Application();
INSTANCE = application;
try
{
application.run(args);
}
catch (InterruptedException e)
{
System.out.println("Exiting");
}
catch (IOException e)
{
System.out.println("IO Error");
e.printStackTrace();
}
}
public Configuration getFreemarkerConfiguration()
{
return freemarkerConfiguration;
}
public static Application getInstance()
{
return INSTANCE;
}
private void run(String[] args) throws InterruptedException, IOException
{
final String templatePath = System.getProperty(TEMPLATE_PATH) != null
? System.getProperty(TEMPLATE_PATH)
: DEFAULT_TEMPLATE_PATH;
final Configuration configuration = new Configuration();
freemarkerConfiguration = configuration;
beanWrapper = new BeansWrapper();
beanWrapper.setUseCache(false);
configuration.setObjectWrapper(beanWrapper);
try
{
final File templateDir = new File(templatePath);
configuration.setTemplateLoader(new FileTemplateLoader(templateDir));
}
catch (IOException e)
{
throw new RuntimeException(e);
}
final RunnerImpl runner = new RunnerImpl();
try
{
runner.run(args);
}
catch (RuntimeException e)
{
e.printStackTrace();
}
}
public BeansWrapper getBeanWrapper()
{
return beanWrapper;
}
}
RunnerImpl.java
// RunnerImpl.java
public class RunnerImpl implements Runner
{
@Override
public void run(String[] args) throws InterruptedException
{
long counter = 0;
while(true)
{
++counter;
System.out.printf("Run %d\n", counter);
// Application.getInstance().getFreemarkerConfiguration().setObjectWrapper(new BeansWrapper());
Application.getInstance().getBeanWrapper().clearClassIntrospecitonCache();
final Worker worker = new Worker();
worker.doWork();
Thread.sleep(1000);
}
}
Worker.java
// Worker.java
public class Worker
{
void doWork()
{
final Application application = Application.getInstance();
final Configuration freemarkerConfiguration = application.getFreemarkerConfiguration();
try
{
final Template template = freemarkerConfiguration.getTemplate("test.ftl");
final Model model = new Model();
final PrintWriter printWriter = new PrintWriter(System.out);
printObjectInto(model);
System.out.println("-----TEMPLATE MACRO PROCESSING-----");
template.process(model, printWriter);
System.out.println();
System.out.println("-----END OF PROCESSING------");
System.out.println();
}
catch (IOException e)
{
e.printStackTrace();
}
catch (TemplateException e)
{
e.printStackTrace();
}
}
private void printObjectInto(Object o)
{
final Class<?> aClass = o.getClass();
final Method[] methods = aClass.getDeclaredMethods();
for (final Method method : methods)
{
System.out.println(String.format("Method name: %s, public: %s", method.getName(), Modifier.isPublic(method.getModifiers())));
}
}
}
Model.java
// Model.java
public class Model
{
public String getMessage()
{
return "Hello";
}
public String getAnotherMessage()
{
return "Hello World!";
}
}
This example does not work at all. Even changing BeansWrapper during runtime won't have any effect.
Source: (StackOverflow)
I have been using docker for a few weeks on my development environment, and it is quite nice, I do not have to worry about config neither I need to run a full virtual machine to just run an application server (JBoss in my case).
However I seem to have gone back to the old days with compile, deploy, wait, test.
Now question is, is there any way to use tools such as jrebel or dcevm in order to speed this up? Further more, does this question make sense at all?
Source: (StackOverflow)
I'm working on EJB 3.0 with Jboss 6.1 at the moment. All the time after I change someshing in EJB modules (server side) I have to export JAR file to /jboss-6.1.0.Final/server/default/deploy
it's very uncomortable. I know that DCEVM can make that automatically. I've just install Dynamic Code Evolution VM but now I dont undestand what should I do now? Do I need any DCEVM plugin for Eclipse?
this is my Screen, i use Ubuntu 12.04:
http://i.stack.imgur.com/ixcku.png
Source: (StackOverflow)
I'm using Netbeans 8 to write sample application based on Maven and Java FX. I want to set up HotSwap with DCEVM and check if it's working with my project.
Sample application
public class FXMLController implements Initializable {
@FXML
private Label label;
@FXML
private void handleButtonAction(ActionEvent event) {
System.out.println("You clicked me!");
}
@Override
public void initialize(URL url, ResourceBundle rb) {
// TODO
}
}
I've installed and configured DCEVM and HotSwap agent.This is my running configuration:
runfx.args=-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -jar "${project.build.directory}/${project.build.finalName}.jar"
jpda.listen=true
Env.MAVEN_OPTS=-XXaltjvm=dcevm -javaagent:c:\\TEST\\hotswap-agent.jar=autoHotswap=true
I've also cliked "Compile on save" option in netbeans.
This is log from console during app start.
NetBeans: JPDA Listening Start...
JPDA Address: MC0WKJ3C:50469
Port:50469
cd C:\dev\java\MavenFxHotSwap; "MAVEN_OPTS=-XXaltjvm=dcevm -javaagent:c:\\\\TEST\\\\hotswap-agent.jar=autoHotswap=true" JAVA_HOME=C:\\TEST\\Java\\jdk1.8.0_05 cmd /c "\"\"C:\\Program Files\\NetBeans 8.0.2\\java\\maven\\bin\\mvn.bat\" -Drunfx.args=\"-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=50469 -jar \\\"${project.build.directory}/${project.build.finalName}.jar\\\" \" -Djpda.listen=true -Djpda.address=50469 -Dmaven.ext.class.path=\"C:\\Program Files\\NetBeans 8.0.2\\java\\maven-nblib\\netbeans-eventspy.jar\" -Dfile.encoding=UTF-8 org.codehaus.mojo:exec-maven-plugin:1.2.1:exec\""
Running **NetBeans Compile On Save execution**. Phase execution is skipped and output directories of dependency projects (with Compile on Save turned on) will be used instead of their jar artifacts.
HOTSWAP AGENT: 11:43:17.728 INFO (org.hotswap.agent.HotswapAgent) - Loading Hotswap agent {0.2} - unlimited runtime class redefinition.
HOTSWAP AGENT: 11:43:18.085 INFO (org.hotswap.agent.config.PluginRegistry) - Plugin 'org.hotswap.agent.plugin.hotswapper.HotswapperPlugin' initialized in ClassLoader 'sun.misc.Launcher$AppClassLoader@58644d46'.
HOTSWAP AGENT: 11:43:18.124 INFO (org.hotswap.agent.config.PluginRegistry) - Discovered plugins: [Hotswapper, AnonymousClassPatch, WatchResources, Hibernate, Spring, Jersey2, Jetty, Tomcat, ZK, Logback, JSF, Seam, ELResolver, OsgiEquinox]
HOTSWAP AGENT: 11:43:19.472 INFO (org.hotswap.agent.config.PluginRegistry) - Plugin 'org.hotswap.agent.plugin.hotswapper.HotswapperPlugin' initialized in ClassLoader 'ClassRealm[plexus.core, parent: null]'.
Scanning for projects...
------------------------------------------------------------------------
Building MavenFxHotSwap 1.0-SNAPSHOT
------------------------------------------------------------------------
HOTSWAP AGENT: 11:43:20.164 INFO (org.hotswap.agent.config.PluginRegistry) - Plugin 'org.hotswap.agent.plugin.hotswapper.HotswapperPlugin' initialized in ClassLoader 'ClassRealm[maven.ext, parent: ClassRealm[plexus.core, parent: null]]'.
--- exec-maven-plugin:1.2.1:exec (default-cli) @ MavenFxHotSwap ---
HOTSWAP AGENT: 11:43:21.068 INFO (org.hotswap.agent.config.PluginRegistry) - Plugin 'org.hotswap.agent.plugin.hotswapper.HotswapperPlugin' initialized in ClassLoader 'ClassRealm[maven.ext, parent: ClassRealm[plexus.core, parent: null]]'.
HOTSWAP AGENT: 11:43:21.563 INFO (org.hotswap.agent.config.PluginRegistry) - Plugin 'org.hotswap.agent.plugin.hotswapper.HotswapperPlugin' initialized in ClassLoader 'ClassRealm[plugin>org.codehaus.mojo:exec-maven-plugin:1.2.1, parent: sun.misc.Launcher$AppClassLoader@58644d46]'.
When I'm debuging code and making some changes adding method or something no changes are made. I can apply changes via netbeasn interface but no log from HotswapperPlugin is visible.
Is there is any way to make it work? Am I doing something wrong?
Source: (StackOverflow)
I'm trying to setup DCEVM (JDK 1.8 51) and HotSwap-Agent with my GWT/Maven project to be able to reload changes without restarting GWT's Super Devmode. To start with, my project is setup like so:
project
-core
-data
-i18n
where core is the main module where I run mvn gwt:run. It depends on the i18n and data modules, so I'd like those to be reloaded as well. So in my hotswap-agent.properties, I put:
extraClasspath=<pathto>/i18n/target/classes,<pathto>/data/build/target/classes
I've gotten as far as installing DCEVM as the alt jvm, and setup my MAVEN_OPTS like so:
SET MAVEN_OPTS=-XXaltjvm=dcevm -javaagent:<pathto>/hotswap-agent.jar -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+EnableInvokeDynamic
From here I do mvn gwt:run to start dev mode. HotSwap-Agent seems to properly initialize as evidenced by these lines:
HOTSWAP AGENT: 10:43:6.444 INFO (org.hotswap.agent.HotswapAgent) - Loading Hotswap agent {0.3.0-SNAPSHOT} - unlimited runtime class redefinition.
HOTSWAP AGENT: 10:43:6.663 INFO (org.hotswap.agent.config.PluginRegistry) - Discovered plugins: [Hotswapper, WatchResources, AnonymousClassPatch, Hibernate, Spring, Jersey2, Jetty, Tomcat, ZK, Logback, JSF, Seam, ELResolver, OsgiEquinox, Proxy, WebObjects, Weld]
HOTSWAP AGENT: 11:17:46.400 INFO (org.hotswap.agent.config.PluginRegistry) - Plugin 'org.hotswap.agent.plugin.hotswapper.HotswapperPlugin' initialized in ClassLoader 'java.net.URLClassLoader@4d49f239'.
And then devmode is started, I can run my application and all that.
Now, when I go to do a mvn clean install on data, for example, HotSwap-Agent seems to detect the changes, but this is what I get:
HOTSWAP AGENT: 11:2:38.541 WARNING (org.hotswap.agent.watch.nio.WatcherNIO2) - WatchKey 'sun.nio.fs.WindowsWatchService$WindowsWatchKey@7d9da813' overflowed
And then, a huge list of (it looks like I get a trace for every class in the module):
HOTSWAP AGENT: 11:2:43.945 ERROR (org.hotswap.agent.annotation.handler.WatchEventCommand) - Unable create CtClass for URI 'file:///<pathto>/data/build/target/classes/<packageto>/DashboardWidget$DashboardWidgetMetaData.class'.
java.lang.IllegalArgumentException: java.io.FileNotFoundException: <pathto>\data\build\target\classes\<packageto>\DashboardWidget$DashboardWidgetMetaData.class (The system cannot find the file specified)
at org.hotswap.agent.util.IOUtils.toByteArray(IOUtils.java:50)
at org.hotswap.agent.annotation.handler.WatchEventCommand.createCtClass(WatchEventCommand.java:191)
at org.hotswap.agent.annotation.handler.WatchEventCommand.onWatchEvent(WatchEventCommand.java:120)
at org.hotswap.agent.annotation.handler.WatchEventCommand.executeCommand(WatchEventCommand.java:51)
at org.hotswap.agent.command.impl.CommandExecutor.run(CommandExecutor.java:25)
Caused by: java.io.FileNotFoundException: <pathto>\data\build\target\classes\<packageto>\DashboardWidget$DashboardWidgetMetaData.class (The system cannot find the file specified)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at java.io.FileInputStream.<init>(FileInputStream.java:93)
at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:90)
at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188)
at java.net.URL.openStream(URL.java:1038)
at org.hotswap.agent.util.IOUtils.toByteArray(IOUtils.java:44)
... 4 more
HOTSWAP AGENT: 11:2:43.945 ERROR (org.hotswap.agent.annotation.handler.WatchEventCommand) - Unable create CtClass for URI 'file:///<pathto>/data/build/target/classes/<packageto>/ItemImage.class'.
java.lang.IllegalArgumentException: java.io.FileNotFoundException: <pathto>\data\build\target\classes\<packageto>\ItemImage.class (The system cannot find the file specified)
at org.hotswap.agent.util.IOUtils.toByteArray(IOUtils.java:50)
at org.hotswap.agent.annotation.handler.WatchEventCommand.createCtClass(WatchEventCommand.java:191)
at org.hotswap.agent.annotation.handler.WatchEventCommand.onWatchEvent(WatchEventCommand.java:120)
at org.hotswap.agent.annotation.handler.WatchEventCommand.executeCommand(WatchEventCommand.java:51)
at org.hotswap.agent.command.impl.CommandExecutor.run(CommandExecutor.java:25)
Caused by: java.io.FileNotFoundException: <pathto>\data\build\target\classes\<packageto>\ItemImage.class (The system cannot find the file specified)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at java.io.FileInputStream.<init>(FileInputStream.java:93)
at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:90)
at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188)
at java.net.URL.openStream(URL.java:1038)
at org.hotswap.agent.util.IOUtils.toByteArray(IOUtils.java:44)
... 4 more
This all occurs when hotswap-agent notices a change in my core module as well.
After all that, the program resumes properly, but the changes don't take affect, even if I refresh the browser. I get no search results when I look up the overflow message or the filenotfound exceptions (in reference to hotswap-agent). So, I don't really know what's going on. Any help would be great!
Source: (StackOverflow)
I want to be able to use DCEVM without running the Installer to modify JVM in my machine. Is there a DCEVM JRE zip file or something which can be unzipped and ready to be used as a JRE in Eclipse ?
Source: (StackOverflow)
I had configured DCEVM on intellij, but I think the way I did it is wrong as when I made some change in the java file and ctrl + shift + f9, the tomcat is getting restarted. Can someone please tell me the correct way to configure it.
Source: (StackOverflow)
I have been using the dynamic code evaluation for dynamic loading of my changed classes in my Jboss server ,
I have found this tool very helpful and interesting , but it have a problem that it works with jdk 1.6 , but As i am trying to use java 7 in my project it fails .
Can anyone suggest similar type of tool with java7 support
Source: (StackOverflow)
What my Requirement is: When doing any sort of modification in my project's file(s), I want those particular files to get redeployed automatically without manually doing rebuild/redeploy/restart.
That is, I want changes to reflect on my webpage as soon as I change any file and save it. Changed file should automatically be redeployed in server.
What I've tried so far:
Changed standalone.xml file in JBoss for redeploying the app whenever any files gets changed. But this does not fulfill my requirement properly. Also this method generated Out of Memory error many a times.
Thought of using JRebel but it is not available for free.
Tried using DCE VM, but no help.
Please suggest any alternate as redeploying project manually takes a lot of time. I want to automate this process by deploying only the changed files in the exploded ear. I don't want to use any IDE.
Source: (StackOverflow)
I run JBoss on java7 DCEVM http://dcevm.github.io/
It's possible to Hot Swap any type of code changes from IntelliJ connecting to standalone Swing application (using remote debug; VM startup parameters -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=2222).
But when I try to do something similar when debugging application running on JBoss (connecting debugger remotely same VM parameters as previously) IntelliJ claims that hot code replace succeeded, however application doesn't change behavior as it should.
Do you have any ideas what could be the reason?
Is it connected somehow with the Java EE classloading model?
Has anyone experienced such problem?
Is it possible to hot swap code with DCEVM in JBoss using remote debug?
Source: (StackOverflow)
I'm using Tomcat 7 with DCEVM and HotAgent. Tomcat is starting normally wiht HotSwap log.
HOTSWAP AGENT: 11:4:10.958 INFO (org.hotswap.agent.HotswapAgent) - Loading
Hotswap agent {0.2} - unlimited runtime class redefinition.
HOTSWAP AGENT: 11:4:11.145 INFO (org.hotswap.agent.config.PluginRegistry) - Discovered plugins: [Hotswapper, AnonymousClassPatch, WatchResources, Hibernate, Spring, Jersey2, Jetty, Tomcat, ZK, Logback, JSF, Seam, ELResolver, OsgiEquinox]
I'm connecting to Tomcat via remote debuger. Eclipse is using save DCEVM as runtime env.
When change is made in eclipse this log appears:
HOTSWAP AGENT: 11:23:53.322 RELOAD (org.hotswap.agent.plugin.jvm.AnonymousClassPatchPlugin) - Class 'PATH/LoginView' has been enhanced with anonymous classes for hotswap.
No change is made. Running debuger, it is not going through new line which is simple System.out.println("test").
setenv.bat below:
set JAVA_HOME=C:\Program Files\Java\jdk1.7.0_67
set JRE_HOME=C:\Program Files\Java\jdk1.7.0_67\jre
set JAVA_OPTS=-javaagent:hotswap-agent.jar
Java version:
java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Dynamic Code Evolution 64-Bit Server VM (build 24.71-b01-dcevmlight-2, mixed mode)
Source: (StackOverflow)
I need help in configuring hotswap agent in my project for hot deploying class files.
In my project we have project setup like below :
WebProject (war)
|
|_ _ Service Project(jar)
Service project is used as a jar file in web project. So whenever I do changes in a java file inside service project i want hotswap agent to reload/replace its class file with the latest one without the need of deploying the entire project again.
I have downloaded dcevm(dynamic code evolution vm) for jdk 1.7.51 and hotswap-agent.jar file as well and also done eclipse configuration. Whenever I do changes in WebProject's .java, .properties files it reloads it automatically without deploying the application again. Now I just want to configure my hotswap agent in such a way that If i am doing changes in java file inside service project which is used as a jar file inside Web Project, it should reload that .class file or .jar file again.
Do I need to add one more hotswap-agent.properties file in resource folder of service project? Currently i have added it in resource folder of web project.
Any help is very much appreciated.
Source: (StackOverflow)