spring项目在idea下使用jrebel热部署报错!

先上报错信息:

2019-06-04 10:30:45 JRebel: ERROR Class 'org.springframework.core.io.support.PathMatchingResourcePatternResolver' could not be processed by org.zeroturnaround.javarebel.integration.spring.core.cbp.PathMatchingResourcePatternResolverCBP@sun.misc.Launcher$AppClassLoader@14dad5dc: org.zeroturnaround.bundled.javassist.CannotCompileException: [source error] getURL() not found in java.net.URL
    at org.zeroturnaround.bundled.javassist.expr.MethodCall.replace(JRebel:241)
    at org.zeroturnaround.javarebel.integration.spring.core.cbp.PathMatchingResourcePatternResolverCBP$1.edit(PathMatchingResourcePatternResolverCBP.java:70)
    at org.zeroturnaround.bundled.javassist.expr.ExprEditor.loopBody(JRebel:192)
    at org.zeroturnaround.bundled.javassist.expr.ExprEditor.doit(JRebel:91)
    at org.zeroturnaround.bundled.javassist.CtBehavior.instrument(JRebel:712)
    at org.zeroturnaround.javarebel.integration.spring.core.cbp.PathMatchingResourcePatternResolverCBP.processClassPathScanning(PathMatchingResourcePatternResolverCBP.java:61)
    at org.zeroturnaround.javarebel.integration.spring.core.cbp.PathMatchingResourcePatternResolverCBP.process(PathMatchingResourcePatternResolverCBP.java:39)
    at org.zeroturnaround.javarebel.integration.support.JavassistClassBytecodeProcessor.process(JRebel:117)
    at com.zeroturnaround.javarebel.jS.a(JRebel:360)
    at com.zeroturnaround.javarebel.jS.a(JRebel:349)
    at com.zeroturnaround.javarebel.jS.a(JRebel:317)
    at com.zeroturnaround.javarebel.SDKIntegrationImpl.runBytecodeProcessors(JRebel:130)
    at com.zeroturnaround.javarebel.jD.transform(JRebel:57)
    at java.lang.ClassLoader.defineClass(ClassLoader.java)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at org.springframework.context.support.AbstractApplicationContext.getResourcePatternResolver(AbstractApplicationContext.java:438)
    at org.springframework.context.support.AbstractApplicationContext.(AbstractApplicationContext.java:217)
    at org.springframework.context.support.GenericApplicationContext.(GenericApplicationContext.java:104)
    at org.springframework.context.annotation.AnnotationConfigApplicationContext.(AnnotationConfigApplicationContext.java:60)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
    at java.lang.Class.newInstance(Class.java:442)
    at org.springframework.beans.BeanUtils.instantiate(BeanUtils.java:77)
    at org.springframework.boot.SpringApplication.createApplicationContext(SpringApplication.java:573)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:310)
    at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:134)
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.java:175)
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:98)
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:64)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:167)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:122)
    at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:73)
    at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54)
    at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:336)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1162)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1151)
    at io.hcbm.mdata.HcbmMdataServiceApplication.main(HcbmMdataServiceApplication.java:34)
Caused by: compile error: getURL() not found in java.net.URL
    at org.zeroturnaround.bundled.javassist.compiler.TypeChecker.atMethodCallCore(JRebel:749)
    at org.zeroturnaround.bundled.javassist.compiler.TypeChecker.atCallExpr(JRebel:695)
    at org.zeroturnaround.bundled.javassist.compiler.JvstTypeChecker.atCallExpr(JRebel:157)
    at org.zeroturnaround.bundled.javassist.compiler.ast.CallExpr.accept(JRebel:46)
    at org.zeroturnaround.bundled.javassist.compiler.CodeGen.doTypeCheck(JRebel:242)
    at org.zeroturnaround.bundled.javassist.compiler.CodeGen.atDeclarator(JRebel:743)
    at org.zeroturnaround.bundled.javassist.compiler.ast.Declarator.accept(JRebel:100)
    at org.zeroturnaround.bundled.javassist.compiler.CodeGen.atStmnt(JRebel:351)
    at org.zeroturnaround.bundled.javassist.compiler.ast.Stmnt.accept(JRebel:50)
    at org.zeroturnaround.bundled.javassist.compiler.Javac.compileStmnt(JRebel:569)
    at org.zeroturnaround.bundled.javassist.expr.MethodCall.replace(JRebel:235)
    ... 49 more

在spring项目中使用idea自带的debug是可以运行项目的但是使用jrebel启动项目就报错,报错信息如上。
经过查询资料:https://segmentfault.com/q/1010000006068898
评论区发现:
这是jrebel的一个bug,原因是jrebel不支持高于spring4.2.7以上的版本。
解决办法:
将spring降到4.2.7以下
或者
升级jrebel的版本至最新
然后我查看自己项目中的spring版本,发现确实是高于4.2.7版本的

image.png

这是我spring-boot的依赖,显然我不能更换spring的依赖版本,于是尝试更新Jrebel。
image.png

然后选中右边的update按钮,更新到最新版本,最后一步重启idea,然后启动项目,发现完美解决问题。
如果没有破解,请继续浏览:
image.png

上面是我用URl破解的方式:
http://139.199.89.239:1008/88414687-3b91-4286-89ba-2dc813b107ce
邮箱随便填写即可。

但是话又说回来了,Jrebel官方更新的版本中并未说明不支持高版本的spring依赖。

下面是官方更新的所有日志:

Change Notes
2019.1.2
Improvement: updated the "JRebel activated" notification.
Improvement: added tooltip for the Setup Guide reload step.
Bug fix: fixed a rebel.xml generation issue with special characters not being properly escaped.
Bug fix: fixed an issue when starting a run configuration with Debug with JRebel didn't start up if pre-launch tasks contained "Run Another Configuration" step.
2019.1.1
Improvement: improved enabling the automatic compilation to align with new IDE settings as of IntelliJ IDEA 2018.2.0+.
Bug fix: fixed an issue where notifications were shown with the JRebel Setup Guide open.
2019.1.0
Improvement: updated activation dialog for ZTLM team evaluation flow.
Bug fix: fixed an issue where Net Promoter Score notification was rendered incorrectly on Windows.
2018.2.7
Bug fix: fixed an issue that could cause JRebel notfications show up in wrong project window.
Bug fix: fixed an issue with incorrectly escaped space character in the Run instructions.
Bug fix: fixed an issue where generating rebel.xml for many modules caused IntelliJ to freeze.
Update: updated the EULA.
2018.2.6
Bug fix: fixed an issue where applications did not start in case custom path was targeting missing jrebel.jar.
Bug fix: fixed the documentation for running the remote Tomcat as Windows service.
Update: updated the trial period length to 10 days.
2018.2.5
Improvement: added warning in case rebel.xml is excluded from a Hybris backoffice build.
Bug fix: fixed an issue where the JRebel facet was sometimes added to non-Java modules.
Bug fix: fixed an issue where debugger occasionally did not break on breakpoints if the JRebel agent was not attached to the application being debugged.
2018.2.4
Feature: added support for automatic project-specific path variables in rebel.xml.
Bug fix: fixed an issue where debug with JRebel was not starting if run configuration contained npm script running step.
Bug fix: fixed an issue with occasional deadlocks when enabling remote servers in JRebel options.
Bug fix: fixed JRebel plugin state inconsistency when creating/deleting/moving rebel.xml manually.
Bug fix: fixed an issue causing incorrect hyphenation in the support form.
2018.2.3
Feature: dedicated dialog to ask for time saved per redeploy is now generally available.
Bug fix: fixed an issue where Net Promoter Score notification was rendered incorrectly on high DPI.
Bug fix: fixed an issue where debugger did not stop on the breakpoints for Grails process for versions prior to 3.1.5.
2018.2.2
Bug fix: fixed an issue where request made by JRebel failed if the client had an NTLM proxy.
2018.2.1
Bug fix: fix UI freezings when applying changes to rebel.xml generation settings.
2018.2.0
Improvement: added option for permanently hiding the JRebel Setup Guide.
Bug fix: don't show the JRebel Setup Guide if there is no Java project in the workspace.
2018.1.7
Feature: IntelliJ/Maven integration for rebel.xml generation is now generally available.
Improvement: for license server licensing, email is now requested on IDE startup if it was not previously provided.
Improvement: removed support for License Server floating licenses.
Bug fix: fixed occasional NullPointerExceptions when opening the JRebel Setup Guide.
Bug fix: fixed an issue where JRebel plugin was crashing with IntelliJ Ultimate 14.0.
2018.1.6
Feature: added support for automatic renewal of offline seats.
Improvement: added JRebel setup guide. Available as a pilot for randomly selected subset of users.
2018.1.5
Feature: Added the "Run with JRebel" and "Debug with JRebel" buttons to the Application Servers tool window.
Improvement: added feedback messages in UI for external rebel.xml generation.
Bug fix: fixed an issue where clicking on Select All in JRebel Panel caused exception messages in the IDE error log.
2018.1.4
Improvement: updated Startup instructions for latest WildFly versions.
Improvement: added UI to enable IntelliJ IDEA's automatic build option (pilot completed, enabling for all users).
Improvement: requests proxy credentials when proxy authentication is required.
Improvement: added shortcut to enable/disable JRebel and remote server support from project's context menu.
Improvement: updated the order of licensing options in activation dialog (license server licensing is now topmost).
Improvement: direct users to proxy guide when obtaining a license fails due to proxy configuration.
Improvement: improved JRebel startup instructions for macOS when path contains spaces.
2018.1.3.1
Bug fix: fixed an issue where disabled Gradle plugin breaks JRebel plugin initialization.
Bug fix: fixed a NPE when calling maven project lookup too early.
2018.1.3
Feature: Maven users can now configure JRebel plugin to generate rebel.xml with JRebel Maven plugin.
Improvement: JRebel 2018.1.3 dropped support for IntelliJ IDEA version 13.
Bug fix: Excessive modules for source sets not filtered out if Gradle option "Store generated project files externally" is selected.
Bug fix: fixed a MissingFormatArgumentException that caused notifications not to be shown.
Bug fix: fixed an issue where Consent radio button state was not updated after activating from JRebel Configuration.
2018.1.2
Bug fix: fixed an issue where proxy authentication fails when different configurations are used for HTTP and HTTPS proxy settings.
Bug fix: fixed an issue where proxy authentication fails on Windows with a wrong username.
2018.1.1
Feature: added a dedicated dialog to ask for time saved per redeploy (pilot for subset of users).
Feature: added UI to enable IntelliJ IDEA's automatic build (pilot for subset of users).
Improvement: removed the forum links from the About widget.
Improvement: separated the proxy configuration for licensing as used by JRebel Agent vs IDE.
Improvement: updated the Startup tab to include setup instructions for Spring Boot 2.x, Payara 4 and 5 and GlassFish 5.
Improvement: updated the Startup tab to better handle white spaces in JRebel paths in code snippets on Linux and macOS.
Improvement: generic plugin errors are now visible in jrebel-intellij.log.
Improvement: implemented a new rebel.xml lookup algorithm and generation scenarios.
Bug fix: updated the changelog link.
Bug fix: fixed lease not being updated when first update attempt fails with a soon-to-be-invalid lease.
Bug fix: fixed startup problems when using an automatic proxy.
Bug fix: JRebel project settings are now kept when disabling/re-enabling JRebel for a project.
Bug fix: fixed high DPI problems in the activation dialog.
Bug fix: corrected an error that occurred while creating the JRebel context menu.
Bug fix: improved UI behavior when the external jrebel.jar is missing.
Bug fix: fixed rebel.xml location when Maven integration plugin is disabled.
2018.1.0
Feature: added support for Java 10.
Feature: added integration for the new Run Dashboard component.
Improvement: removed the Legacy Agent.
Improvement: added better proxy support for connecting to the License Server. Best available proxy settings will be used automatically.
Improvement: implemented notifications reminding to redeploy the applications after enabling JRebel or remote server support for a project.
Improvement: disabled the "delete missing files from remote server" setting by default.
Improvement: redesigned tabs in project settings.
Bug fix: fixed scaling issues in JRebel settings for high DPI screens.
Bug fix: fixed an issue where the offline lease would become invalid when user had activated twice.
Bug fix: fixed an issue with remote synchronization getting stuck when the request failed for multiple projects and servers.
Bug fix: proxy credentials are no longer requested when checking for updates.
Bug fix: fixed an issue where adding JRebel facet to a module without facet in project settings would fail.
Bug fix: fixed an issue where the activation dialog would show an incorrect state when JRebel is configured with License Server, but is currently without a license.
Bug fix: fixed an issue that allowed specifying duplicate remote server URLs.

你可能感兴趣的:(spring项目在idea下使用jrebel热部署报错!)