hotswapExample plain-java throw error, mvn test in eclipse

595 views
Skip to first unread message

bgmall

unread,
Feb 16, 2016, 5:38:10 AM2/16/16
to HotswapAgent


HOTSWAP AGENT: 18:22:25.789 DEBUG (org.hotswap.agent.config.PluginConfiguration) - Unable to set extraClasspath to [file:/E:/program/hotswap/HotswapAgentExamples/plain-java/target/extra/] on classLoader null. Only URLClassLoader is supported.
*** extraClasspath configuration property will not be handled on JVM level ***
HOTSWAP AGENT: 18:22:25.892 ERROR (org.hotswap.agent.config.PluginRegistry) - Error in plugin initial processing for plugin package 'org.hotswap.agent.plugin'
java.lang.ClassNotFoundException: org/hotswap/agent/plugin/hotswapper/HotswapperPlugin
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:278)
at org.hotswap.agent.config.PluginRegistry.scanPlugins(PluginRegistry.java:89)
at org.hotswap.agent.config.PluginManager.init(PluginManager.java:123)
at org.hotswap.agent.HotswapAgent.premain(HotswapAgent.java:42)
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:606)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:382)
at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:397)

vladimir dvorak

unread,
Feb 16, 2016, 10:58:18 AM2/16/16
to HotswapAgent
Could you specify your setup in more detailed level?  Project-framework-app server + HotswapAgent version

bgmall

unread,
Feb 16, 2016, 8:57:17 PM2/16/16
to HotswapAgent
i just test plain-java example which running under JDK 1.7.0_80 with hotswap-agent.jar version 0.3.0-SNAPSHOT.

before that, i do steps as below.
1. install dcevm, java -jar DCEVM-full-7u79-installer.jar, choose altjvm
2. mvn install hotswap-agent-core-0.3.0-SNAPSHOT.jar and hotswap-agent-0.3.0-SNAPSHOT.jar, build from source code;
3. mvn test hotswapExample.plain-java example, then throw error

在 2016年2月16日星期二 UTC+8下午11:58:18,vladimir dvorak写道:

vladimir dvorak

unread,
Feb 17, 2016, 3:02:03 AM2/17/16
to HotswapAgent
Which application server or servlet container do you have?

bgmall

unread,
Feb 17, 2016, 4:36:26 AM2/17/16
to HotswapAgent
nothing, just run in eclipse, debug as maven test.
it's normal java code, not need application server or servlet container

在 2016年2月17日星期三 UTC+8下午4:02:03,vladimir dvorak写道:

bgmall

unread,
Feb 17, 2016, 10:29:28 PM2/17/16
to HotswapAgent
follow Quick start steps, it doesn't work.
Couldn't have a simple example. i can't find any useful information.

在 2016年2月16日星期二 UTC+8下午6:38:10,bgmall写道:

vladimir dvorak

unread,
Feb 18, 2016, 2:47:25 AM2/18/16
to HotswapAgent
Could you create a simple example project and post the code here or to https://github.com/skybber/HotswapAgentExamples .?

bgmall

unread,
Feb 18, 2016, 4:53:15 AM2/18/16
to HotswapAgent
ok.  

1. install dcevm, java -jar DCEVM-full-7u79-installer.jar, choose altjvm
2. download hotswap-agent.jar
3. make a TestClass.java file, the content is:
     public class TestClass {

public static void main(String[] args) {
System.out.println("hello world");
}
}

在 2016年2月18日星期四 UTC+8下午3:47:25,vladimir dvorak写道:

bgmall

unread,
Feb 18, 2016, 4:58:02 AM2/18/16
to HotswapAgent
ok.  

1. install dcevm, java -jar DCEVM-full-7u79-installer.jar, choose altjvm
2. download hotswap-agent.jar
3. make a TestClass.java file, the content is:
     public class TestClass {

public static void main(String[] args) {
System.out.println("hello world");
}
}
4. javac TestClass.java
5. java -XXaltjvm=dcevm -javaagent:hotswap-agent.jar TestClass

then throw error:
HOTSWAP AGENT: 11:53:35.926 INFO (org.hotswap.agent.HotswapAgent) - Loading Hotswap agent {0.3.0-SNAPSHOT} - unlimited runtime class redefinition.
HOTSWAP AGENT: 11:53:36.264 ERROR (org.hotswap.agent.config.PluginRegistry) - Error in plugin initial processing for plugin package 'org.hotswap.agent.plugin'
java.lang.ClassNotFoundException: org/hotswap/agent/plugin/hotswapper/HotswapperPlugin
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:278)
        at org.hotswap.agent.config.PluginRegistry.scanPlugins(PluginRegistry.java:89)
        at org.hotswap.agent.config.PluginManager.init(PluginManager.java:123)
        at org.hotswap.agent.HotswapAgent.premain(HotswapAgent.java:47)
        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:606)
        at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:382)
        at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:397)

hello world

addition: windows 7 x86, jdk_1.7.0_80
TestClass.java and hotswap-agent.jar are the same directory.

在 2016年2月18日星期四 UTC+8下午5:53:15,bgmall写道:

vladimir dvorak

unread,
Feb 18, 2016, 11:24:26 AM2/18/16
to HotswapAgent
I didn't notice any problem with it.

lada@skybber ~/workspace/HelloWorld/bin $ java -XXaltjvm=dcevm -javaagent:/path_to/hotswap-agent.jar TestClass      
HOTSWAP AGENT: 17:19:18.489 INFO (org.hotswap.agent.HotswapAgent) - Loading Hotswap agent {0.3.0-SNAPSHOT} - unlimited runtime class redefinition.
HOTSWAP AGENT: 17:19:18.994 INFO (org.hotswap.agent.config.PluginRegistry) - Discovered plugins: [Hotswapper, AnonymousClassPatch, WatchResources, Hibernate, Spring, Jersey2, Jetty, Tomcat, ZK, Logback, JSF, Seam, ELResolver, OsgiEquinox, Proxy, WebObjects, Weld, JBossModules, Resteasy, Gae]
hello world

May be you have invalid hotswap-agent.jar. Make sure if org.hotswap.agent.plugin.hotswapper.HotswapperPlugin.class exists in hotswap-agent.jar

bgmall

unread,
Feb 18, 2016, 10:02:19 PM2/18/16
to HotswapAgent
yes, hotswapperPlugin.class exists in hotswap-agent.jar.
maybe it's some problem for my PC enviroment. 

在 2016年2月19日星期五 UTC+8上午12:24:26,vladimir dvorak写道:

vladimir dvorak

unread,
Feb 19, 2016, 2:28:43 AM2/19/16
to HotswapAgent
You can upgrade openjdk to java8, may be there is some change between 1.7u79 /1.7u80. I did some changes to better support bootstrap classloader, it is in repository now. May be it can help.

lx

unread,
Feb 25, 2016, 6:58:39 AM2/25/16
to HotswapAgent
Hi Vladimir,

I have the same problem when I use jdk1.7.0_80. It works with jdk1.7.0_79.
The problematic change from u79 to u80 seems to be that getClassloader() returns null for the BootstrapClassloader with u80 (as documented in the javadoc: "[...] Some implementations may use null to represent the bootstrap class loader. This method will return null in such implementations if this class was loaded by the bootstrap class loader.")
In PluginRegistry.scanPlugins() I get null for the first param and null for the agentClassLoader. With u79 I get the classloader there.
Maybe that's the problem?

Bye, Alex
Reply all
Reply to author
Forward
Message has been deleted
0 new messages