使用 spring 4.3 和 JRebel 在 tomcat8 中部署 Java 应用程序时出现异常

Exception when deploying Java app in tomcat8 with spring 4.3 and JRebel

正在使用...

最近我从 Spring 4.2 升级到 4.3.4.RELEASE

当我尝试在启用 jrebel 的情况下在 eclipse 中部署(运行 或调试)我的 tomcat 服务器时,出现以下错误:

2016-12-19 12:10:43 JRebel: ERROR Class 'org.springframework.core.io.support.PathMatchingResourcePatternResolver' could not be processed by org.zeroturnaround.javarebel.integration.spring.core.cbp.PathMatchingResourcePatternResolverCBP@org.apache.catalina.loader.WebappClassLoader@28cb48ca: org.zeroturnaround.bundled.javassist.CannotCompileException: [source error] getURL() not found in java.net.URL
at org.zeroturnaround.bundled.javassist.expr.MethodCall.replace(SourceFile:241)
at org.zeroturnaround.javarebel.integration.spring.core.cbp.PathMatchingResourcePatternResolverCBP.edit(PathMatchingResourcePatternResolverCBP.java:69)
at org.zeroturnaround.bundled.javassist.expr.ExprEditor.loopBody(SourceFile:192)
at org.zeroturnaround.bundled.javassist.expr.ExprEditor.doit(SourceFile:91)
at org.zeroturnaround.bundled.javassist.CtBehavior.instrument(SourceFile:712)
at org.zeroturnaround.javarebel.integration.spring.core.cbp.PathMatchingResourcePatternResolverCBP.processClassPathScanning(PathMatchingResourcePatternResolverCBP.java:60)
at org.zeroturnaround.javarebel.integration.spring.core.cbp.PathMatchingResourcePatternResolverCBP.process(PathMatchingResourcePatternResolverCBP.java:38)
at org.zeroturnaround.javarebel.integration.support.JavassistClassBytecodeProcessor.process(SourceFile:71)
at com.zeroturnaround.javarebel.ic.a(SourceFile:344)
at com.zeroturnaround.javarebel.ic.a(SourceFile:333)
at com.zeroturnaround.javarebel.ic.a(SourceFile:311)
at com.zeroturnaround.javarebel.SDKIntegrationImpl.runBytecodeProcessors(SourceFile:31)
at com.zeroturnaround.javarebel.hh.transform(SourceFile:88)
at java.lang.ClassLoader.defineClass(ClassLoader.java)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2494)
at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:860)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1302)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1167)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at com.zeroturnaround.javarebel.hm.a(SourceFile:91)
at com.zeroturnaround.javarebel.hm.a(SourceFile:257)
at com.zeroturnaround.javarebel.hh.transform(SourceFile:104)
at java.lang.ClassLoader.defineClass(ClassLoader.java)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2494)
at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:860)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1302)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1167)
at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.getResourcePatternResolver(AbstractRefreshableWebApplicationContext.java:183)
at org.springframework.context.support.AbstractApplicationContext.<init>(AbstractApplicationContext.java:217)
at org.springframework.context.support.AbstractRefreshableApplicationContext.<init>(AbstractRefreshableApplicationContext.java:80)
at org.springframework.context.support.AbstractRefreshableConfigApplicationContext.<init>(AbstractRefreshableConfigApplicationContext.java:50)
at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.<init>(AbstractRefreshableWebApplicationContext.java:95)
at org.springframework.web.context.support.AnnotationConfigWebApplicationContext.<init>(AnnotationConfigWebApplicationContext.java:82)
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 org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:142)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:102)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:380)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:313)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4793)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5236)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: compile error: getURL() not found in java.net.URL
at org.zeroturnaround.bundled.javassist.compiler.TypeChecker.atMethodCallCore(SourceFile:749)
at org.zeroturnaround.bundled.javassist.compiler.TypeChecker.atCallExpr(SourceFile:695)
at org.zeroturnaround.bundled.javassist.compiler.JvstTypeChecker.atCallExpr(SourceFile:157)
at org.zeroturnaround.bundled.javassist.compiler.ast.CallExpr.accept(SourceFile:46)
at org.zeroturnaround.bundled.javassist.compiler.CodeGen.doTypeCheck(SourceFile:242)
at org.zeroturnaround.bundled.javassist.compiler.CodeGen.atDeclarator(SourceFile:743)
at org.zeroturnaround.bundled.javassist.compiler.ast.Declarator.accept(SourceFile:100)
at org.zeroturnaround.bundled.javassist.compiler.CodeGen.atStmnt(SourceFile:351)
at org.zeroturnaround.bundled.javassist.compiler.ast.Stmnt.accept(SourceFile:50)
at org.zeroturnaround.bundled.javassist.compiler.Javac.compileStmnt(SourceFile:569)
at org.zeroturnaround.bundled.javassist.expr.MethodCall.replace(SourceFile:235)
... 53 more

有人遇到同样的问题吗?

您确定您使用的是 7.0.1 版本的 JRebel 代理吗?根据堆栈跟踪,它看起来是 6.2.5 或更早版本,特定错误应该已在 6.4.4 中修复。检查服务器启动时 JRebel 横幅中显示的版本号。也许 Eclipse 当前配置为使用较旧的外部代理 - 转到帮助 > JRebel > 配置 > 高级到 select 与 JRebel Eclipse 插件捆绑的代理。