好吧,weblogic的问题确实……
问题一:
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: URL [zip:E:/weblogic/user_projects/domains/base_domain/servers/AdminServer/tmp/_WL_user/_appsdir_scrcu_kstrap_war/a4dr3u/war/WEB-INF/lib/_wl_cls_gen.jar!/com/kayak/util/cache/loader/xxxxxx.class]; nested exception is java.lang.ArrayIndexOutOfBoundsException: 768
at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:303)
at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:248)
at org.springframework.context.annotation.ComponentScanBeanDefinitionParser.parse(ComponentScanBeanDefinitionParser.java:87)
at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:74)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1427)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1417)
……………………………………………………………………
org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
at weblogic.servlet.internal.EventsManager$FireContextListenerAction.run(EventsManager.java:481)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.EventsManager.notifyContextCreatedEvent(EventsManager.java:181)
at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1868)
at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3154)
at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1518)
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:484)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
weblogic.deploy.internal.targetserver.BasicDeployment.activateFromServerLifecycle(BasicDeployment.java:361)
………………………………………………………………………………………………weblogic.management.deploy.internal.DeploymentAdapter$1.doActivate(DeploymentAdapter.java:51)
at weblogic.management.deploy.internal.DeploymentAdapter.activate(DeploymentAdapter.java:200)
at weblogic.management.deploy.internal.AppTransition$2.transitionApp(AppTransition.java:30)
at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:240)
at weblogic.management.deploy.internal.ConfiguredDeployments.activate(ConfiguredDeployments.java:169)
at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:123)
at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:180)
at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:96)
at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
Caused By: java.lang.ArrayIndexOutOfBoundsException: 768
at org.springframework.asm.ClassReader.readClass(ClassReader.java:2462)
at org.springframework.asm.ClassReader.accept(ClassReader.java:544)
at org.springframework.asm.ClassReader.accept(ClassReader.java:508)
……………………………………………………………………………………………………
【解决】首先这个异常真是让我很。。查看错误日志,并非web项目的问题,而且该web项目在tomcat当中部署得很正常啊。。又看到有 java.lang.ArrayIndexOutOfBoundsException:更是让人一头雾水。试了网上所说的设置weblogic的内存之类,自己又用jd-gui.exe 去看底层jar包追踪错误源,但是还是一筹莫展。。
看到错误日志第一行红色部分,应该是未正确加载到xxx.class所致,跟踪:E:/weblogic/user_projects/domains/base_domain/servers/AdminServer/tmp/_WL_user/_appsdir_scrcu_kstrap_war/a4dr3u/war/WEB-INF/lib/_wl_cls_gen.jar,jd-gui.exe打开_wl_cls_gen.jar包,发现xxx.class确实是// INTERNAL ERROR //的错误(未正确解析);但发现项目启动并未指定要用到xxx.java啊。。
后来,换了一种文件形式,用WebRoot放在autodeploy下,这下终于可以正常部署了!!
至于为啥用war包不行(有的工程可以,但不知道这个工程为何不行)我也不知道原因。。
——注意到,E:/weblogic/user_projects/domains/base_domain/servers/AdminServer/tmp/_WL_user下会有一些临时文件。通过war包部署时,会自动生成一个名为_wl_cls_gen.jar的jar包;而通过WebRoot(或者说war包的解压文件)部署时,则不会有该jar包。。
当有的项目通过war包的方式部署失败,并出现Caused By: java.lang.ArrayIndexOutOfBoundsException这个奇怪的异常时,不妨改成它的解压文件形式部署,说不定可以成功。