2013-06-24 29 views
0

我修改了當前Web項目中的一些代碼以添加Spring事務管理。當我在Eclipse中部署它時,甚至當我在工作區中調用「Maven clean」和「Maven install」時,一切正常。然而,當我的持續集成服務器(詹金斯)嘗試重新部署我的遠程服務器上,我收到了java.lang.VerifyError的,它失敗:部署新版本的Java EE Web應用程序時發生java.lang.VerifyError

maven-glassfish-plugin:2.1:deploy (default-cli) @ myApp --- [INFO] asadmin --host localhost --port 4848 --user admin --passwordfile C:\Windows\TEMP\mgfp2047875868831547735.tmp --interactive=false --echo=true --terse=true deploy --name myApp --force=false --precompilejsp=false --verify=false --enabled=true --generatermistubs=false --availabilityenabled=false --keepreposdir=false --keepfailedstubs=false --logReportedErrors=true --upload=false --help=false C:\.jenkins\workspace\First_deploy\target\myApp-0.0.1.war 
[ERROR] com.sun.enterprise.admin.cli.CommandException: remote failure: Exception while loading the app : java.lang.Exception: java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'analysisDAO': Injection of persistence dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory': Post-processing of the FactoryBean's object failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.methodSecurityMetadataSourceAdvisor': Cannot resolve reference to bean 'org.springframework.security.access.method.DelegatingMethodSecurityMetadataSource#0' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.access.method.DelegatingMethodSecurityMetadataSource#0': Cannot create inner bean '(inner bean)' of type [org.springframework.security.access.prepost.PrePostAnnotationSecurityMetadataSource] while setting constructor argument with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)': Cannot create inner bean '(inner bean)' of type [org.springframework.security.access.expression.method.ExpressionBasedAnnotationAttributeFactory] while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)': Cannot resolve reference to bean 'expressionHandler' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'expressionHandler' defined in ServletContext resource [/WEB-INF/spring/security-config.xml]: Cannot resolve reference to bean 'projectPermissionEvaluator' while setting bean property 'permissionEvaluator'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'projectPermissionEvaluator': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: public fr.services.interfaces.IProjectService fr.services.security.ProjectPermissionEvaluator.projectService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'projectService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: public fr.services.interfaces.IProjectRightsService fr.services.impl.ProjectService.projectRightService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'projectRightService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: public fr.dao.IDAOFactory fr.services.impl.ProjectRightService.daoFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myAppDAOFactory': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'agriculturalToolDao' defined in ServletContext resource [/WEB-INF/spring/applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.VerifyError: Expecting a stackmap frame at branch target 43 in method fr.model.application.Projet.equals(Ljava/lang/Object;)Z at offset 4 

我用jdk1.7(我檢查了我的服務器上,這是仍然是在環境變量中的正確的JDK),maven和Glassfish。這是我的pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>means</groupId> 
    <artifactId>means</artifactId> 
    <version>0.0.1</version> 
    <packaging>war</packaging> 
    <profiles> 
     <profile> 
      <id>mavenplugin-server</id> 
      <activation> 
       <property> 
        <name>environment</name> 
        <value>server</value> 
       </property> 
      </activation> 
      <properties> 
       <glassfish.home>C:\MEANS\Glassfish\glassfish</glassfish.home> 
       <glassfish.adminPort>4848</glassfish.adminPort> 
       <glassfish.httpPort>8080</glassfish.httpPort> 
       <glassfish.httpsPort>8443</glassfish.httpsPort> 
      </properties> 
     </profile> 
     <profile> 
      <id>mavenplugin-server-production</id> 
      <activation> 
       <property> 
        <name>environment</name> 
        <value>server-production</value> 
       </property> 
      </activation> 
      <properties> 
       <glassfish.home>C:\MEANS\Glassfish\glassfish</glassfish.home> 
       <glassfish.adminPort>4949</glassfish.adminPort> 
       <glassfish.httpPort>8282</glassfish.httpPort> 
       <glassfish.httpsPort>8553</glassfish.httpsPort> 
      </properties> 
     </profile> 
     <profile> 
      <id>mavenplugin-local</id> 
      <activation> 
       <activeByDefault>true</activeByDefault> 
      </activation> 
      <properties> 
       <glassfish.home>C:\MEANS\Glassfish\glassfish</glassfish.home> 
       <glassfish.adminPort>4848</glassfish.adminPort> 
       <glassfish.httpPort>8080</glassfish.httpPort> 
       <glassfish.httpsPort>8443</glassfish.httpsPort> 
      </properties> 
     </profile> 
    </profiles> 
    <properties> 
     <org.springframework.version>3.0.5.RELEASE</org.springframework.version> 
     <eclipselink.version>2.4.0</eclipselink.version> 
    </properties> 
    <repositories> 
     <repository> 
      <id>EclipseLink Repo</id> 
      <url>http://download.eclipse.org/rt/eclipselink/maven.repo</url> 
     </repository> 
     <repository> 
      <id>com.springsource.repository.bundles.release</id> 
      <name>EBR Spring Release Repository</name> 
      <url>http:// repository.springsource.com/maven/bundles/release</url> 
     </repository> 
     <repository> 
      <id>com.springsource.repository.bundles.external</id> 
      <name>EBR External Release Repository</name> 
      <url>http:// repository.springsource.com/maven/bundles/external</url> 
     </repository> 
    </repositories> 
    <build> 
     <sourceDirectory>src</sourceDirectory> 
     <outputDirectory>build2</outputDirectory> 
     <testSourceDirectory>src/test</testSourceDirectory> 
     <plugins> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-war-plugin</artifactId> 
       <version>2.1</version> 
       <configuration> 
        <webXml>${basedir}\WebContent\WEB-INF\web.xml</webXml> 
        <warSourceExcludes>${basedir}\WebContent\*</warSourceExcludes> 
        <resource> 
         <excludes> 
          <directory>${basedir}/WebContent</directory> 
          <exclude>**/*.java</exclude> 
         </excludes> 
        </resource> 
        <webResources> 
         <resource> 
          <directory>${basedir}\src\fr</directory> 
          <targetPath>WEB-INF\classes\fr</targetPath> 
          <excludes> 
           <exclude>**/*.java</exclude> 
          </excludes> 
         </resource> 
         <resource> 
          <directory>${basedir}\build2\fr</directory> 
          <targetPath>WEB-INF\classes\fr</targetPath> 
         </resource> 
         <resource> 
          <directory>${basedir}/WebContent/WEB-INF/</directory> 
          <targetPath>WEB-INF/</targetPath> 
          <includes> 
           <include>dispatcher-servlet.xml</include> 
          </includes> 
          <excludes> 
           <exclude>log4j.properties</exclude> 
          </excludes> 
         </resource> 
         <resource> 
          <directory>${basedir}/WebContent/WEB-INF/</directory> 
          <targetPath>WEB-INF/</targetPath> 
          <includes> 
           <include>dispatcher-servlet.xml</include> 
          </includes> 
         </resource> 
         <resource> 
          <directory>${basedir}/WebContent/WEB-INF/</directory> 
          <targetPath>WEB-INF/classes/</targetPath> 
          <includes> 
           <include>log4j.properties</include> 
          </includes> 
         </resource> 
         <resource> 
          <directory>${basedir}/src/META-INF</directory> 
          <targetPath>WEB-INF/classes/META-INF/</targetPath> 
          <includes> 
           <include>persistence.xml</include> 
          </includes> 
         </resource> 
         <resource> 
          <directory>${basedir}/WebContent/</directory> 
          <targetPath></targetPath> 
         </resource> 
        </webResources> 

       </configuration> 
      </plugin> 
      <plugin> 
       <artifactId>maven-surefire-plugin</artifactId> 
       <version>2.1</version> 
       <configuration> 
        <argLine>-XX:-UseSplitVerifier</argLine> 
       </configuration> 
      </plugin> 
      <plugin> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <version>2.3.2</version> 
       <configuration> 
        <source>1.7</source> 
        <target>1.7</target> 
       </configuration> 
      </plugin> 

      <plugin> 
       <groupId>org.glassfish.maven.plugin</groupId> 
       <artifactId>maven-glassfish-plugin</artifactId> 
       <version>2.1</version> 
       <configuration> 
        <user>admin</user> 
        <echo>true</echo> 
        <adminPassword>means2012!</adminPassword> 
        <glassfishDirectory>${glassfish.home}</glassfishDirectory> 
        <components> 
         <component> 
          <name>${project.artifactId}</name> 
          <artifact>${project.build.directory}/${project.build.finalName}.war</artifact> 
         </component> 
        </components> 
        <domain> 
         <name>${project.artifactId}</name> 
         <adminPort>${glassfish.adminPort}</adminPort> 
         <httpPort>${glassfish.httpPort}</httpPort> 
         <httpsPort>${glassfish.httpsPort}</httpsPort> 
        </domain> 
       </configuration> 
      </plugin> 

     </plugins> 
    </build> 
    <dependencies> 
     <dependency> 
      <groupId>log4j</groupId> 
      <artifactId>log4j</artifactId> 
      <version>1.2.15</version> 
      <scope>compile</scope> 
       <exclusions> 
       <exclusion> 
        <groupId>javax.mail</groupId> 
        <artifactId>mail</artifactId> 
       </exclusion> 
       <exclusion> 
        <groupId>javax.jms</groupId> 
        <artifactId>jms</artifactId> 
       </exclusion> 
       <exclusion> 
        <groupId>com.sun.jdmk</groupId> 
        <artifactId>jmxtools</artifactId> 
       </exclusion> 
       <exclusion> 
        <groupId>com.sun.jmx</groupId> 
        <artifactId>jmxri</artifactId> 
       </exclusion> 
       </exclusions> 
    </dependency> 

     <dependency> 
      <groupId>org.aspectj</groupId> 
      <artifactId>aspectjrt</artifactId> 
      <version>1.6.11</version> 
     </dependency> 

     <dependency> 
      <groupId>org.aspectj</groupId> 
      <artifactId>aspectjweaver</artifactId> 
      <version>1.6.11</version> 
     </dependency> 

     <!-- <dependency> 
      <groupId>org.aspectj</groupId> 
      <artifactId>aspectjtools</artifactId> 
      <version>1.6.2</version> 
     </dependency> 
     --> 
     <dependency> 
      <groupId>org.eclipse.persistence</groupId> 
      <artifactId>eclipselink</artifactId> 
      <version>${eclipselink.version}</version> 
      <scope>compile</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.eclipse.persistence</groupId> 
      <artifactId>org.eclipse.persistence.core</artifactId> 
      <version>${eclipselink.version}</version> 
      <scope>compile</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.eclipse.persistence</groupId> 
      <artifactId>org.eclipse.persistence.jpa</artifactId> 
      <version>${eclipselink.version}</version> 
      <scope>compile</scope> 
     </dependency> 

     <dependency> 
      <groupId>org.eclipse.persistence</groupId> 
      <artifactId>org.eclipse.persistence.jpa.modelgen</artifactId> 
      <version>${eclipselink.version}</version> 
      <scope>compile</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.eclipse.persistence</groupId> 
      <artifactId>org.eclipse.persistence.moxy</artifactId> 
      <version>${eclipselink.version}</version> 
      <scope>compile</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.eclipse.persistence</groupId> 
      <artifactId>org.eclipse.persistence.sdo</artifactId> 
      <version>${eclipselink.version}</version> 
      <scope>compile</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.eclipse.persistence</groupId> 
      <artifactId>org.eclipse.persistence.oracle</artifactId> 
      <version>${eclipselink.version}</version> 
      <scope>compile</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-orm</artifactId> 
      <version>3.1.2.RELEASE</version> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-aop</artifactId> 
      <version>3.1.2.RELEASE</version> 
     </dependency> 
     <!-- <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-asm</artifactId> 
      <version>3.1.2.RELEASE</version> 
     </dependency> 
     --> 
     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-beans</artifactId> 
      <version>3.1.2.RELEASE</version> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-context</artifactId> 
      <version>3.1.2.RELEASE</version> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-context-support</artifactId> 
      <version>3.1.2.RELEASE</version> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-core</artifactId> 
      <version>3.1.2.RELEASE</version> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-expression</artifactId> 
      <version>3.1.2.RELEASE</version> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-jdbc</artifactId> 
      <version>3.1.2.RELEASE</version> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-jms</artifactId> 
      <version>3.1.2.RELEASE</version> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-tx</artifactId> 
      <version>3.1.2.RELEASE</version> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-web</artifactId> 
      <version>3.1.2.RELEASE</version> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-webmvc</artifactId> 
      <version>3.1.2.RELEASE</version> 
     </dependency> 
     <dependency> 
      <groupId>commons-logging</groupId> 
      <artifactId>commons-logging</artifactId> 
      <version>1.1.1</version> 
     </dependency> 
     <dependency> 
      <groupId>jstl</groupId> 
      <artifactId>jstl</artifactId> 
      <version>1.2</version> 
     </dependency> 
     <dependency> 
      <groupId>javax.validation</groupId> 
      <artifactId>validation-api</artifactId> 
      <version>1.1.0.Alpha1</version> 
     </dependency> 
     <dependency> 
      <groupId>org.glassfish</groupId> 
      <artifactId>maven-glassfish-plugin</artifactId> 
      <version>1.0-alpha-4</version> 
      <type>maven-plugin</type> 
     </dependency> 
     <dependency> 
      <groupId>com.google.code.gson</groupId> 
      <artifactId>gson</artifactId> 
      <version>2.2.2</version> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework.security</groupId> 
      <artifactId>spring-security-core</artifactId> 
      <version>3.1.3.RELEASE</version> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework.security</groupId> 
      <artifactId>spring-security-aspects</artifactId> 
      <version>3.1.3.RELEASE</version> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework.security</groupId> 
      <artifactId>spring-security-config</artifactId> 
      <version>3.1.3.RELEASE</version> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework.security</groupId> 
      <artifactId>spring-security-web</artifactId> 
      <version>3.1.3.RELEASE</version> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework.security</groupId> 
      <artifactId>spring-security-taglibs</artifactId> 
      <version>3.1.3.RELEASE</version> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-test</artifactId> 
      <version>3.2.0.RELEASE</version> 
     </dependency> 
     <dependency> 
      <groupId>net.sf.opencsv</groupId> 
      <artifactId>opencsv</artifactId> 
      <version>2.3</version> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.commons</groupId> 
      <artifactId>commons-io</artifactId> 
      <version>1.3.2</version> 
     </dependency> 
     <dependency> 
      <groupId>commons-fileupload</groupId> 
      <artifactId>commons-fileupload</artifactId> 
      <version>1.3</version> 
     </dependency> 
     <dependency> 
      <groupId>joda-time</groupId> 
      <artifactId>joda-time</artifactId> 
      <version>2.2</version> 
     </dependency> 
    </dependencies> 
</project> 

我嘗試添加了Maven的萬無一失,插件作爲在這篇文章指出:How do I get unit test to run in java 7: java.lang.VerifyError: Expecting a stackmap frame at branch target,但沒有成功......至於我不是行家高手,這是非常困難的找出我的配置有什麼問題,所以任何幫助將不勝感激!在此先感謝

+0

你保留在數據庫或LDAP安全信息? –

+0

我建議你將'-XX:-UseSplitVerifier'作爲配置添加到maven-glassfish-plugin中,而不是當然。 Surefire是用於運行JUnit測試,並且您的構建在部署到glassfish時失敗 – JoseK

+0

我按照您的建議修正了配置,但沒有成功,但仍然有相同的錯誤...現在我的配置爲: org.apache.maven.plugins \t \t \t \t Maven的戰爭插件 \t \t \t \t 2。1 \t \t \t \t <配置> \t \t \t \t \t -XX:-UseSplitVerifier Coralie

回答

1

萬一它可能會幫助別人有那麼一天,我解決了這個問題的一切與現在我的應用程序再次工程... 的問題在GlassFish安裝來得如此,它沒有什麼做我的代碼(即使這個奇怪的「VerrifyError」指出了一些代碼行)。我發現,如果我將它部署在另一個glassfish上,它就會工作,所以我重新安裝了我的Glassfish服務器,並解決了我的問題!太糟糕了,我花了一個多星期的時間...感謝您的幫助!

0

從我看到您的堆棧跟蹤中,我認爲該應用程序無法連接到數據庫或LDAP來判斷。這導致其中一個bean的自動裝配失敗,然後級聯到其他bean中。

確保應用程序可以正確連接到bean所需的任何外部資源。

+0

我保留安全信息在數據庫中...我沒有改變我的數據庫配置中的任何東西,一切都很好。我會再檢查一次...... – Coralie

+0

@Coralie當你說它在eclipse或服務器上的意思之前工作正常嗎? –

+0

在服務器上以及在Eclipse中...我已經使用這個maven配置定期更新服務器上的應用程序一年,沒有任何問題。這是我第一次得到這個錯誤。 – Coralie

0

AFAIK,AspectJ僅支持從版本1.7.0開始的Java 7及更高版本。

您可以嘗試將您的AspectJ版本從1.6.11升級到1.7.3(這是最新版本)。

+0

我做了升級,但並沒有解決問題......我仍然得到相同的錯誤。 – Coralie

0

我發現你的問題尋找與openCSV 2.3和Java 7相關的異常。在我的情況下,通過反射實例化引用opencsv類的類時引發異常。也許你有類似的問題。我決定我的切換到jcsv

+0

這不是我的問題的原因(請參閱我的解決方案),但無論如何感謝提示! – Coralie

0

我已經通過將應用程序類加載器更改爲「PARENT LAST」來解決此問題。

應用程序 - >企業應用 - > --classloader模式=母公司LAST