无法将Java Web应用程序从java7迁移到Java8

时间:2017-08-21 18:55:37

标签: java hibernate java-8 java-7 weblogic12c

您好我正在尝试通过Struts2,Spring 3,基于Hibernate 3的应用程序从java 7到8迁移到weblogic 12.1.3服务器上。代码编译时没有任何问题,但是当我尝试运行它时。我收到了很多错误,如下面的错误,

        end public class org.hibernate.cfg.Mappings

            at org.aspectj.bridge.MessageWriter.handleMessage(MessageWriter.java:47)
            at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageWriter.handleMessage(WeavingAdaptor.java:737)
            at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHolder.handleMessage(WeavingAdaptor.java:682)
            at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1699)
            at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1618)
            at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1379)
            at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1173)
            at org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:467)
            at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:318)
            at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:96)
            at org.aspectj.weaver.loadtime.ClassPreProcessorAgentAdapter.transform(ClassPreProcessorAgentAdapter.java:54)
            at org.springframework.context.weaving.AspectJWeavingEnabler$AspectJClassBypassingClassFileTransformer.transform(AspectJWeavingEnabler.java:97)
            at org.springframework.instrument.classloading.weblogic.WebLogicClassPreProcessorAdapter.preProcess(WebLogicClassPreProcessorAdapter.java:76)
            at org.springframework.instrument.classloading.weblogic.WebLogicClassPreProcessorAdapter.invoke(WebLogicClassPreProcessorAdapter.java:65)
            at com.sun.proxy.$Proxy181.preProcess(Unknown Source)
            at weblogic.utils.classloaders.ClassPreProcessor$ClassPreProcessorSupport.preProcess(ClassPreProcessor.java:105)
            at weblogic.utils.classloaders.GenericClassLoader.doPreProcess(GenericClassLoader.java:432)
            at weblogic.utils.classloaders.GenericClassLoader.defineClass(GenericClassLoader.java:406)
            at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:366)
            at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:318)
            at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:80)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
            at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:186)
            at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:50)
            at org.hibernate.cfg.Configuration.createMappings(Configuration.java:677)
            at org.hibernate.cfg.Configuration.add(Configuration.java:669)
            at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:504)
            at org.hibernate.cfg.Configuration.addResource(Configuration.java:566)
            at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1587)
            at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1555)
            at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1534)
            at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1508)
            at org.hibernate.cfg.Configuration.configure(Configuration.java:1443)
            at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:642)
            at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
            at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
            at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
            at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
            at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
            at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:398)
            at org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:275)
            at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.detectPersistenceExceptionTranslators(PersistenceExceptionTranslationInterceptor.java:139)
            at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.<init>(PersistenceExceptionTranslationInterceptor.java:79)
            at org.springframework.dao.annotation.PersistenceExceptionTranslationAdvisor.<init>(PersistenceExceptionTranslationAdvisor.java:70)
            at org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor.setBeanFactory(PersistenceExceptionTranslationPostProcessor.java:99)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeAwareMethods(AbstractAutowireCapableBeanFactory.java:1439)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1408)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
            at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
            at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
            at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
            at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
            at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:710)
            at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:410)
            at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
            at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
            at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
            at weblogic.servlet.internal.EventsManager$FireContextListenerAction.run(EventsManager.java:678)
            at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
            at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
            at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57)
            at weblogic.servlet.internal.EventsManager.executeContextListener(EventsManager.java:243)
            at weblogic.servlet.internal.EventsManager.notifyContextCreatedEvent(EventsManager.java:200)
            at weblogic.servlet.internal.EventsManager.notifyContextCreatedEvent(EventsManager.java:185)
            at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1838)
            at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:2876)
            at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1661)
            at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:823)
            at weblogic.application.internal.ExtensibleModuleWrapper$StartStateChange.next(ExtensibleModuleWrapper.java:360)
            at weblogic.application.internal.ExtensibleModuleWrapper$StartStateChange.next(ExtensibleModuleWrapper.java:356)
            at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:42)
            at weblogic.application.internal.ExtensibleModuleWrapper.start(ExtensibleModuleWrapper.java:138)
            at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:124)
            at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:216)
            at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:211)
            at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:42)
            at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:73)
            at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:24)
            at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:729)
            at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:42)
            at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:258)
            at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:61)
            at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:165)
            at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:80)
            at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:587)
            at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:150)
            at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:116)
            at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:339)
            at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:846)
            at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1275)
            at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:442)
            at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:176)
            at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:195)
            at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:13)
            at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:68)
            at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:548)
            at weblogic.work.ExecuteThread.execute(ExecuteThread.java:311)
            at weblogic.work.ExecuteThread.run(ExecuteThread.java:263)
        > 
        ####<20-Aug-2017 09:58:46 o'clock GST> <Error> <org.aspectj.weaver.loadtime.Aj> <DTLT0019> <DefaultServer> <[ACTIVE] ExecuteThread: '5' for queue: 'weblogic.kernel.Default (self-tuning)'> <weblogic> <> <75e399ab-c0f7-41c9-97d8-22d52c8b07db-00000020> <1503208726262> <BEA-000000> <org.hibernate.cfg.HbmBinder
        org.aspectj.bridge.AbortException: trouble in: 
        public final class org.hibernate.cfg.HbmBinder extends java.lang.Object:
          private static final org.apache.commons.logging.Log log
          static Class class$org$hibernate$cfg$HbmBinder [Synthetic]
          static Class class$org$hibernate$persister$entity$UnionSubclassEntityPersister [Synthetic]
          static Class class$org$hibernate$persister$entity$SingleTableEntityPersister [Synthetic]
          static Class class$org$hibernate$persister$entity$JoinedSubclassEntityPersister [Synthetic]
          private void <init>():
                            ALOAD_0     // Lorg/hibernate/cfg/HbmBinder; this   (line 94)
                            INVOKESPECIAL java.lang.Object.<init> ()V
            constructor-execution(void org.hibernate.cfg.HbmBinder.<init>())
            |               RETURN   (line 95)
            constructor-execution(void org.hibernate.cfg.HbmBinder.<init>())
          end private void <init>()

          public static void bindRoot(org.dom4j.Document, org.hibernate.cfg.Mappings, java.util.Map) throws org.hibernate.MappingException:
                            ALOAD_0     // Lorg/dom4j/Document; doc   (line 109)
                            ALOAD_1     // Lorg/hibernate/cfg/Mappings; mappings
                            INVOKESTATIC org.hibernate.cfg.HbmBinder.getExtendsNeeded (Lorg/dom4j/Document;Lorg/hibernate/cfg/Mappings;)Ljava/util/List;
                            ASTORE_3
                            ALOAD_3     // Ljava/util/List; names   (line 110)
                            INVOKEINTERFACE java.util.List.isEmpty ()Z
                            IFNE L3
                            ALOAD_0     // Lorg/dom4j/Document; doc   (line 112)
                            INVOKEINTERFACE org.dom4j.Document.getRootElement ()Lorg/dom4j/Element;
                            ASTORE 4
                            ALOAD 4     // Lorg/dom4j/Element; hmNode   (line 113)
                            LDC "package"
                            INVOKEINTERFACE org.dom4j.Element.attribute (Ljava/lang/String;)Lorg/dom4j/Attribute;
                            ASTORE 5
                            ACONST_NULL   (line 114)
                            ASTORE 6
                            ALOAD 5     // Lorg/dom4j/Attribute; packNode   (line 115)
                            IFNULL L0
                            ALOAD 5     // Lorg/dom4j/Attribute; packNode   (line 116)
                            INVOKEINTERFACE org.dom4j.Attribute.getValue ()Ljava/lang/String;
                            ASTORE 6     // Ljava/lang/String; packageName
                        L0: ALOAD_3     // Ljava/util/List; names   (line 118)
                            INVOKEINTERFACE java.util.List.iterator ()Ljava/util/Iterator;
                            ASTORE 7
                        L1: ALOAD 7     // Ljava/util/Iterator; itr   (line 119)
                            INVOKEINTERFACE java.util.Iterator.hasNext ()Z
                            IFEQ L2
                            ALOAD 7     // Ljava/util/Iterator; itr   (line 120)
                            INVOKEINTERFACE java.util.Iterator.next ()Ljava/lang/Object;
                            CHECKCAST java.lang.String
                            ASTORE 8
                            ALOAD_1     // Lorg/hibernate/cfg/Mappings; mappings   (line 121)
                            NEW org.hibernate.cfg.ExtendsQueueEntry
                            DUP
                            ALOAD 8     // Ljava/lang/String; extendsName
                            ALOAD 6     // Ljava/lang/String; packageName
                            ALOAD_0     // Lorg/dom4j/Document; doc
                            INVOKESPECIAL org.hibernate.cfg.ExtendsQueueEntry.<init> (Ljava/lang/String;Ljava/lang/String;Lorg/dom4j/Document;)V
                            INVOKEVIRTUAL org.hibernate.cfg.Mappings.addToExtendsQueue (Lorg/hibernate/cfg/ExtendsQueueEntry;)V
                            GOTO L1   (line 122)
                        L2: RETURN   (line 123)
                        L3: ALOAD_0     // Lorg/dom4j/Document; doc   (line 126)
                            INVOKEINTERFACE org.dom4j.Document.getRootElement ()Lorg/dom4j/Element;
                            ASTORE 4
                            ALOAD 4     // Lorg/dom4j/Element; hmNode   (line 128)
                            ALOAD_2     // Ljava/util/Map; inheritedMetas
                            ICONST_1
                            INVOKESTATIC org.hibernate.cfg.HbmBinder.getMetas (Lorg/dom4j/Element;Ljava/util/Map;Z)Ljava/util/Map;
                            ASTORE_2     // Ljava/util/Map; inheritedMetas
                            ALOAD 4     // Lorg/dom4j/Element; hmNode   (line 129)
                            ALOAD_1     // Lorg/hibernate/cfg/Mappings; mappings
                            INVOKESTATIC org.hibernate.cfg.HbmBinder.extractRootAttributes (Lorg/dom4j/Element;Lorg/hibernate/cfg/Mappings;)V
                            ALOAD 4     // Lorg/dom4j/Element; hmNode   (line 131)
                            INVOKEINTERFACE org.dom4j.Element.elementIterator ()Ljava/util/Iterator;
                            ASTORE 5
                        L4: ALOAD 5     // Ljava/util/Iterator; rootChildren   (line 132)
                            INVOKEINTERFACE java.util.Iterator.hasNext ()Z
                            IFEQ L16
                            ALOAD 5     // Ljava/util/Iterator; rootChildren   (line 133)
                            INVOKEINTERFACE java.util.Iterator.next ()Ljava/lang/Object;
                            CHECKCAST org.dom4j.Element
                            ASTORE 6

道歉我还没有看到启动时发送字节代码的日志。 我不知道如何解决这个问题。请协助

1 个答案:

答案 0 :(得分:0)

在我看来,类似于加载问题,尝试添加weblogic.xml文件,如果你已经没有在你的webapp中,然后在文件中添加下面的文件。

<container-descriptor>
    <prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>