Comments (14)
It looks like a bug in the agent. There is a methodCache in ReflectionHelper. This cache key is caclculated as the String:
clazz.getName() + "." + methodName + "(" + Arrays.toString(parameterTypes) + ")"
However, this does not take into count classloader. If you use Spring reloading inside two classloaders (e.g. multiple wars), there might be the ClassCastException. I did not test it, but it looks like reasonable explanation of this error.
Please try this version of the agent with bugfix.
from hotswapagent.
Thanks for the new version.
I tried again and I had the same errors (I think..)
Here you can find the full log from the point the class reloading starts.
from hotswapagent.
Which Spring version do you use?
According to the new error log class ClassPathBeanDefinitionScanner is not type of ClassPathScanningCandidateComponentProvider.
from hotswapagent.
We are using the following:
<spring.version>3.0.3.RELEASE</spring.version>
<spring.security.version>3.0.0.RC1</spring.security.version>
<spring.security.oauth.version>1.0.0.M2</spring.security.oauth.version>
<spring.batch.version>2.1.7.RELEASE</spring.batch.version>
<spring.jta.version>1.1.0</spring.jta.version>
<spring.commons.dbcp.version>1.2.2.osgi</spring.commons.dbcp.version>
<spring.commons.fileupload.version>1.2.0</spring.commons.fileupload.version>
<spring.jstl.version>1.2.0</spring.jstl.version>
<spring.servlet.version>2.5.0</spring.servlet.version>
<spring.roo.annotations.version>1.0.0.M1</spring.roo.annotations.version>
<spring.js.version>2.0.6.RELEASE</spring.js.version>
from hotswapagent.
Hmm, 3.0.3 is tested. I have completely disabled method cache in ReflectionHelper, performance penalty should be minor.
Please try this version and attach full log (including application/container startup).
from hotswapagent.
I tried again with this version.
Things changed a lot. No more exceptions.
But the reload failed with this message in IntelliJ:
5:25:28 PM Hot Swap failed
jetty-8000-dcevm: hierarchy change not implemented;
jetty-8000-dcevm: Operation not supported by VM
The log until line 6402 HOTSWAP AGENT: 17:27:37.019
is the first try of class reloading.
And from that point until the end of the file is the second try.
From what I see both tries had the exact same results.
from hotswapagent.
Change in class hiearchy is supported only by FULL dcevm versions. If you have the LIGHT version than you get this result.
from hotswapagent.
I am using the full dcevm.
Maybe this functionality is only working on oracle java and not openjdk ?
(see first post for JVM information)
from hotswapagent.
OK. It should work primary on openjdk, but someone reports it works on oracle as well
from hotswapagent.
This is probably related directly to DCEVM. Have you changed the class hierarchy (e.g. remove interface, change superclass, ...)?.
Why are so many files reloaded at once? Do you really change most of files and then hit apply changes or this is after change of one file? Can you try autoHotswap=true setting in hotswap-agent.properites instead?
There are some minor issues in the log file. Which version of Jetty do you use? One of these classes is missing:
contextHandlerClass = loader.loadClass("org.mortbay.jetty.handler.ContextHandler");
resourceClass = loader.loadClass("org.mortbay.resource.Resource");
fileResourceClass = loader.loadClass("org.mortbay.resource.FileResource");
resourceCollectionClass = loader.loadClass("org.mortbay.resource.ResourceCollection");
from hotswapagent.
The only change I made was add a single line of code System.out.println("some text");
inside a method (the usual functionality supported by all "normal" JVMs).
Then pressed compile file, and IntelliJ started compiling all these files.
I believe that so many classes are reloaded because it's a multi-module project supported by Nexus. So when I run jetty, it's picking up the war files from Nexus, unless my local build is newer.
So, most probably, the compiled code in IntelliJ is "older" from the code that's running in Jetty; thus reloading all these classes.
I would have to manually build around 50 modules in order to have the "latest" code compiled in IntelliJ, and run Jetty in "offline" mode, so it will not even try to get anything newer from Nexus (there will be because of the time required to build 50 modules).
I also tried without the hotswap-agent, and all classes reloaded correctly. Although there's no reloading in spring context. But my change was effective (the system out was printed).
Jetty is org.mortbay.jetty:jetty:6.1.25
.
I can see all of these 4 classes in the jar file of Jetty that is being used.
I tried to run with autoHotswap=true but the VM that runs Jetty dies when I press recompile in debug mode (I tried 3 times...).
It may be the resources.. I don't have any more ram to give it.
from hotswapagent.
autoHotswap=true is instead of debug mode. Just recompile the file and it should be triggered automatically.
from hotswapagent.
Oh OK. I will try that tomorrow then :)
from hotswapagent.
Please reopen if still valid.
from hotswapagent.
Related Issues (20)
- NullPointerException: Cannot invoke "java.net.URL.getFile()" because the return value of "org.hotswap.agent.javassist.ClassPool.find(String)" is null HOT 3
- Application run failed HOT 2
- java.lang.NullPointerException: Cannot invoke "java.net.URL.getFile()" because the return value of "org.hotswap.agent.javassist.ClassPool.find(String)" is null
- Some API cannot work well in spring 6, such as org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor#postProcessPropertyValues is removed in spring6
- JDK 21 support HOT 1
- 热更新application.properties配置文件出现找不到变量错误怎么解决
- An error occurred during hot update of application.properties configuration file HOT 3
- Why does the hotswapagent 1.4.2-SNAPSHOT version of the jar not contain the springboot plug-in? HOT 6
- Mybatis hot update xml error
- Multiple instances of MapperScannerRegistrar appear, causing subsequent updates to fail
- Added an interface method. After hot update, a parameter error occurred in the request interface.
- Whether jdk21 version is supported HOT 1
- Mybatis was introduced into the project, and the properties prompt was updated: No qualifying bean of type 'org.springframework.core.env.ConfigurableEnvironment' available HOT 3
- java -jar update mybatis failure HOT 2
- nested exception HOT 1
- Help, the new Controller API interface cannot be hot updated. HOT 2
- 1.4.2-SNAPSHOT (2024-03-16) release: org.hotswap.agent.javassist.NotFoundException: invokeCustomInitMethod(..) is not found in org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory HOT 4
- 1.4.2-SNAPSHOT inner class hotswap fail HOT 2
- final static variable values duplicates when hot swap HOT 1
- Update xml sql in mybatis + spring boot project error and will not take effect HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hotswapagent.