2016-09-01 5 views
0

Ниже приведена ошибка, которую я получаю, когда делаю mvn clean install проекта. Это простое приложение AEM в AEM 6.1, где я пытаюсь использовать WCMUse.java.lang.VerifyError при использовании WCMUsePojo в простом приложении AEM

[ERROR] Failed to execute goal org.apache.felix:maven-scr-plugin:1.7.4:scr (gene 
rate-scr-descriptor) on project myproject-bundle: Execution generate-scr-descrip 
tor of goal org.apache.felix:maven-scr-plugin:1.7.4:scr failed: An API incompati 
bility was encountered while executing org.apache.felix:maven-scr-plugin:1.7.4:s 
cr: java.lang.VerifyError: Constructor must call super() or this() before return 

[ERROR] Exception Details: 
[ERROR] Location: 
[ERROR] com/adobe/cq/sightly/WCMUsePojo.<init>()V @1: return 
[ERROR] Reason: 
[ERROR] Error exists in the bytecode 
[ERROR] Bytecode: 
[ERROR] 0x0000000: 2ab1 
[ERROR] 
[ERROR] ----------------------------------------------------- 
[ERROR] realm = plugin>org.apache.felix:maven-scr-plugin:1.7.4 
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy 
[ERROR] urls[0] = file:/D:/Maven_Repo/org/apache/felix/maven-scr-plugin/1.7.4/ma 
ven-scr-plugin-1.7.4.jar 
[ERROR] urls[1] = file:/D:/Maven_Repo/org/apache/maven/maven-archiver/2.2/maven- 
archiver-2.2.jar 
[ERROR] urls[2] = file:/D:/Maven_Repo/org/codehaus/plexus/plexus-utils/1.0.4/ple 
xus-utils-1.0.4.jar 
[ERROR] urls[3] = file:/D:/Maven_Repo/junit/junit/3.8.1/junit-3.8.1.jar 
[ERROR] urls[4] = file:/D:/Maven_Repo/org/codehaus/plexus/plexus-archiver/1.0-al 
pha-7/plexus-archiver-1.0-alpha-7.jar 
[ERROR] urls[5] = file:/D:/Maven_Repo/org/apache/felix/org.apache.felix.scr.gene 
rator/1.1.4/org.apache.felix.scr.generator-1.1.4.jar 
[ERROR] urls[6] = file:/D:/Maven_Repo/com/thoughtworks/qdox/qdox/1.12/qdox-1.12. 
jar 
[ERROR] urls[7] = file:/D:/Maven_Repo/asm/asm-all/3.1/asm-all-3.1.jar 
[ERROR] Number of foreign imports: 1 
[ERROR] import: Entry[import from realm ClassRealm[project>my-group-id:myprojec 
t-bundle:1.0-SNAPSHOT, parent: ClassRealm[maven.api, parent: null]]] 
[ERROR] 
[ERROR] ----------------------------------------------------- 
[ERROR] -> [Help 1] 
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit 
ch. 
[ERROR] Re-run Maven using the -X switch to enable full debug logging. 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please rea 
d the following articles: 
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContaine 
rException 

Ниже приведен код, в котором я использую WCMUsePojo.

package com.mycompany.myproject.controllers; 
import com.adobe.cq.sightly.WCMUsePojo;; 
public class TestController extends WCMUsePojo{ 

    @Override 
    public void activate() throws Exception { 
     // TODO Auto-generated method stub 
     testMethod(); 
    } 

    void testMethod() 
    { 
     System.out.println("test method"); 
    } 

} 

Если я удаляю расширение WCMUsePojo, ошибок нет, и сборка выполняется нормально.

Вы найдете ниже ПОМ, который я использую:

<?xml version="1.0" encoding="UTF-8"?> 
<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/maven-v4_0_0.xsd "> 
    <modelVersion>4.0.0</modelVersion> 
    <!-- ====================================================================== --> 
    <!-- P A R E N T P R O J E C T D E S C R I P T I O N --> 
    <!-- ====================================================================== --> 
    <parent> 
     <groupId>my-group-id</groupId> 
     <artifactId>myproject</artifactId> 
     <version>1.0-SNAPSHOT</version> 
    </parent> 

    <!-- ====================================================================== --> 
    <!-- P R O J E C T D E S C R I P T I O N --> 
    <!-- ====================================================================== --> 

    <artifactId>myproject-bundle</artifactId> 
    <packaging>bundle</packaging> 
    <name>My Project Bundle</name> 

    <dependencies> 

     <dependency> 
      <groupId>org.osgi</groupId> 
      <artifactId>org.osgi.compendium</artifactId> 
     </dependency> 
     <dependency> 
      <groupId>org.osgi</groupId> 
      <artifactId>org.osgi.core</artifactId> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.felix</groupId> 
      <artifactId>org.apache.felix.scr.annotations</artifactId> 
     </dependency> 
     <dependency> 
      <groupId>biz.aQute</groupId> 
      <artifactId>bndlib</artifactId> 
     </dependency> 
     <dependency> 
      <groupId>org.slf4j</groupId> 
      <artifactId>slf4j-api</artifactId> 
     </dependency> 
     <dependency> 
      <groupId>junit</groupId> 
      <artifactId>junit</artifactId> 
     </dependency> 
     <dependency> 
      <groupId>javax.servlet</groupId> 
      <artifactId>servlet-api</artifactId> 
     </dependency> 
     <dependency> 
      <groupId>javax.jcr</groupId> 
      <artifactId>jcr</artifactId> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.sling</groupId> 
      <artifactId>org.apache.sling.api</artifactId> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.sling</groupId> 
      <artifactId>org.apache.sling.jcr.api</artifactId> 
     </dependency>   
     <dependency> 
      <groupId>com.adobe.aem</groupId> 
      <artifactId>uber-jar</artifactId> 
      <version>6.1.0</version> 
      <classifier>obfuscated-apis</classifier> 
      <scope>provided</scope> 
     </dependency> 
    </dependencies> 

    <!-- ====================================================================== --> 
    <!-- B U I L D D E F I N I T I O N --> 
    <!-- ====================================================================== --> 
    <build> 
     <plugins> 
      <plugin> 
       <groupId>org.apache.felix</groupId> 
       <artifactId>maven-scr-plugin</artifactId> 
       <executions> 
        <execution> 
         <id>generate-scr-descriptor</id> 
         <goals> 
          <goal>scr</goal> 
         </goals> 
        </execution> 
       </executions> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.felix</groupId> 
       <artifactId>maven-bundle-plugin</artifactId> 
       <extensions>true</extensions> 
       <configuration> 
        <instructions> 
         <Bundle-SymbolicName>my-group-id.myproject-bundle</Bundle-SymbolicName> 
        </instructions> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.sling</groupId> 
       <artifactId>maven-sling-plugin</artifactId> 
       <configuration> 
        <slingUrl>http://${crx.host}:${crx.port}/apps/myproject/install</slingUrl> 
        <usePut>true</usePut> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-javadoc-plugin</artifactId> 
       <configuration> 
        <excludePackageNames> 
         *.impl 
        </excludePackageNames> 
       </configuration> 
      </plugin> 
     </plugins> 
    </build> 

    <profiles> 
     <profile> 
      <id>auto-deploy</id> 
      <build> 
       <plugins> 
        <!-- Use the sling plugin to automatically deploy the bundle to the 
         JCR tree --> 
        <plugin> 
         <groupId>org.apache.sling</groupId> 
         <artifactId>maven-sling-plugin</artifactId> 
         <executions> 
          <execution> 
           <id>install-bundle</id> 
           <goals> 
            <goal>install</goal> 
           </goals> 
           <configuration> 
            <slingUrl>http://${cq.host}:${cq.port}</slingUrl> 
            <slingUrlSuffix>/apps/myproject/install</slingUrlSuffix> 
            <user>${cq.user}</user> 
            <password>${cq.password}</password> 
            <usePut>true</usePut> 
            <failOnError>true</failOnError> 
           </configuration> 
          </execution> 
         </executions> 
        </plugin> 

       </plugins> 

      </build> 
     </profile> 
    </profiles> 
</project> 
+0

попробуйте добавить конструктор 'public WCMUsePojo()'. – VAr

+0

@VAr Пробовал. Такая же ошибка, в то время как mvn clean install – shanky442

ответ

0

Это происходит главным образом из-за запутанным убер-банку, который обеспечивает только интерфейсы зависимых классов, в то время как WcmUsePojo является классом, а не интерфейса вы видите это вопрос. Один из способов решить эту проблему - либо получить unbfascated jar для Adobe и использовать его, другой - явно добавить видимые зависимости к вашему pom. Вы можете проверить номер версии и другие данные в консоли пучков. В вашем случае вам понадобится только com.adobe.cq.sightly.cq-wcm-sightly-extension пакет в зависимости от вашего POM

+0

Я не мог найти ящик с видимым расширением в репозитории adobe. Пожалуйста, найдите ошибку ниже: '[ERROR] Не удалось выполнить цель в проекте myproject-bundle: Не удалось разрешить отклонения для my my group group id: myproject-bundle: bundle: 1.0-SNAPSHOT: Could n ot найти артефакт com.adobe.cq.sightly: cq-wcm-sightly-extension: jar: 1.2.30 in ado be (http://repo.adobe.com/nexus/content/groups/public/) -> [ Help 1] ' – shanky442

+0

обновил репозиторий в pom до ' http: // repo.adobe.com/nexus/content/repositories/releases/com/adobe/aem/aem-api/6.0.0.1/', но все тот же ошибка – shanky442