AnsweredAssumed Answered

Maven repo project errors during startup with amp-to-war profile

Question asked by peterho on Aug 20, 2014
Latest reply on Aug 25, 2014 by gmccullough
When I start a freshly created repo project (alfresco.version 5.0.a, alfresco-sdk-parent version 2.0.0-SNAPSHOT) with the following command


mvn integration-test -Pamp-to-war


<em>I get the following errors on my console:</em>


[INFO] Scanning for projects…
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]                                                                        
[INFO] ————————————————————————
[INFO] Building t-wengi-repo AMP project 1.0-SNAPSHOT
[INFO] ————————————————————————
[INFO]
[INFO] — alfresco-maven-plugin:2.0.0-SNAPSHOT:set-version (default-set-version) @ t-wengi-repo —
[INFO] Removed -SNAPSHOT suffix from version - 1.0
[INFO] Added timestamp to version - 1.0.1408201608
[INFO]
[INFO] — build-helper-maven-plugin:1.8:add-test-resource (add-env-test-properties) @ t-wengi-repo —
[INFO]
[INFO] — maven-resources-plugin:2.6:resources (default-resources) @ t-wengi-repo —
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\peter\Documents\repos\Alfresco\t-wengi-repo\src\main\resources
[INFO] Copying 9 resources to ../t-wengi-repo
[INFO]
[INFO] — maven-compiler-plugin:3.1:compile (default-compile) @ t-wengi-repo —
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to C:\Users\peter\Documents\repos\Alfresco\t-wengi-repo\target\classes
[INFO]
[INFO] — maven-resources-plugin:2.6:testResources (default-testResources) @ t-wengi-repo —
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 1 resource
[INFO]
[INFO] — maven-resources-plugin:2.6:copy-resources (add-module-properties-to-test-classpath) @ t-wengi-repo —
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource to alfresco/module/t-wengi-repo
[INFO]
[INFO] — maven-compiler-plugin:3.1:testCompile (default-testCompile) @ t-wengi-repo —
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to C:\Users\peter\Documents\repos\Alfresco\t-wengi-repo\target\test-classes
[INFO]
[INFO] — maven-surefire-plugin:2.16:test (default-test) @ t-wengi-repo —
[INFO] Tests are skipped.
[INFO]
[INFO] — maven-dependency-plugin:2.8:unpack (unpack-alfresco) @ t-wengi-repo —
[INFO] Configured Artifact: org.alfresco:alfresco:5.0.a:war
[INFO] Unpacking C:\Users\peter\.m2\repository\org\alfresco\alfresco\5.0.a\alfresco-5.0.a.war to C:\Users\peter\Documents\repos\Alfresco\t-wengi-repo\target\t-wengi-repo-war with includes "" and excludes ""
[INFO]
[INFO] — alfresco-maven-plugin:2.0.0-SNAPSHOT:amp (default-amp) @ t-wengi-repo —
[INFO] Building jar: C:\Users\peter\Documents\repos\Alfresco\t-wengi-repo\target\t-wengi-repo\lib\t-wengi-repo.jar
[INFO] Adding directory to AMP package [ 'C:\Users\peter\Documents\repos\Alfresco\t-wengi-repo\target\t-wengi-repo' '']
[INFO] Building amp: C:\Users\peter\Documents\repos\Alfresco\t-wengi-repo\target\t-wengi-repo.amp
[INFO]
[INFO] — alfresco-maven-plugin:2.0.0-SNAPSHOT:install (amps-to-war-overlay) @ t-wengi-repo —
   - WARNING: The file '/WEB-INF/lib/log4j-1.2.17.jar' is being overwritten by this module. The original has been backed-up to '/WEB-INF/classes/alfresco/module/backup/c6e1e33b-2873-11e4-8030-5769066dbaa3.bin'
   - WARNING: The file '/WEB-INF/lib/slf4j-api-1.5.11.jar' is being overwritten by this module. The original has been backed-up to '/WEB-INF/classes/alfresco/module/backup/c6eedb8c-2873-11e4-8030-5769066dbaa3.bin'
   - WARNING: The file '/WEB-INF/lib/slf4j-log4j12-1.5.11.jar' is being overwritten by this module. The original has been backed-up to '/WEB-INF/classes/alfresco/module/backup/c6f236ed-2873-11e4-8030-5769066dbaa3.bin'
[INFO]
[INFO] >>> tomcat7-maven-plugin:2.1:run (run-embedded) @ t-wengi-repo >>>
[INFO]
[INFO] — alfresco-maven-plugin:2.0.0-SNAPSHOT:set-version (default-set-version) @ t-wengi-repo —
[INFO] Removed -SNAPSHOT suffix from version - 1.0
[INFO] Added timestamp to version - 1.0.1408201610
[INFO]
[INFO] — build-helper-maven-plugin:1.8:add-test-resource (add-env-test-properties) @ t-wengi-repo —
[INFO]
[INFO] — maven-resources-plugin:2.6:resources (default-resources) @ t-wengi-repo —
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\peter\Documents\repos\Alfresco\t-wengi-repo\src\main\resources
[INFO] Copying 9 resources to ../t-wengi-repo
[INFO]
[INFO] — maven-compiler-plugin:3.1:compile (default-compile) @ t-wengi-repo —
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] <<< tomcat7-maven-plugin:2.1:run (run-embedded) @ t-wengi-repo <<<
[INFO]
[INFO] — tomcat7-maven-plugin:2.1:run (run-embedded) @ t-wengi-repo —
[INFO] Running war on http://localhost:8080/t-wengi-repo
[INFO] Creating Tomcat server configuration at C:\Users\peter\Documents\repos\Alfresco\t-wengi-repo\target\tomcat
[INFO] setting SystemProperties:
[INFO]  java.io.tmpdir=C:\Users\peter\Documents\repos\Alfresco\t-wengi-repo\target
[INFO] create webapp with contextPath: /alfresco
Aug 20, 2014 4:10:52 PM org.apache.coyote.AbstractProtocol init
INFORMATION: Initializing ProtocolHandler ["http-bio-8080"]
Aug 20, 2014 4:10:52 PM org.apache.catalina.core.StandardService startInternal
INFORMATION: Starting service Tomcat
Aug 20, 2014 4:10:52 PM org.apache.catalina.core.StandardEngine startInternal
INFORMATION: Starting Servlet Engine: Apache Tomcat/7.0.37
Aug 20, 2014 4:11:01 PM org.apache.catalina.startup.TaglibUriRule body
INFORMATION: TLD skipped. URI: http://java.sun.com/jsp/jstl/core is already defined
Aug 20, 2014 4:11:01 PM org.apache.catalina.core.StandardContext addApplicationListener
INFORMATION: The listener "org.apache.myfaces.webapp.StartupServletContextListener" is already configured for this context. The duplicate definition has been ignored.
[INFO] Reading standard config org/apache/myfaces/resource/standard-faces-config.xml
[INFO] Reading config /WEB-INF/faces-config-app.xml



[INFO] Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@672817b1: defining beans  propertyValueCache,propertyUniqueContextCache,contentDataCache,immutableEntityCache,node.rootNodesCache,node.allRootNodesCache,…
[ERROR] Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'propertyValueCache' defined in class path resource [alfresco/tx-cache-context.xml]: Cannot resolve reference to bean 'propertyValueSharedCache' while setting bean property 'sharedCache'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'propertyValueSharedCache' defined in class path resource [alfresco/cache-context.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.alfresco.repo.cache.SimpleCache org.alfresco.repo.cache.DefaultCacheFactory.createCache(java.lang.String)] threw exception; nested exception is java.lang.NoSuchMethodError: com.google.common.cache.CacheBuilder.maximumSize(J)Lcom/google/common/cache/CacheBuilder;
   at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
   at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1325)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
   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:190)
   at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
   at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
   at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
   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 org.alfresco.web.app.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:63)
   at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4797)
   at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5291)
   at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
   at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
   at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
   at java.util.concurrent.FutureTask.run(FutureTask.java:262)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
   at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'propertyValueSharedCache' defined in class path resource [alfresco/cache-context.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.alfresco.repo.cache.SimpleCache org.alfresco.repo.cache.DefaultCacheFactory.createCache(java.lang.String)] threw exception; nested exception is java.lang.NoSuchMethodError: com.google.common.cache.CacheBuilder.maximumSize(J)Lcom/google/common/cache/CacheBuilder;
   at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:581)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:983)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:879)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
   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:190)
   at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)
   … 25 more
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.alfresco.repo.cache.SimpleCache org.alfresco.repo.cache.DefaultCacheFactory.createCache(java.lang.String)] threw exception; nested exception is java.lang.NoSuchMethodError: com.google.common.cache.CacheBuilder.maximumSize(J)Lcom/google/common/cache/CacheBuilder;
   at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:157)
   at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:570)
   … 34 more
Caused by: java.lang.NoSuchMethodError: com.google.common.cache.CacheBuilder.maximumSize(J)Lcom/google/common/cache/CacheBuilder;
   at org.alfresco.repo.cache.DefaultSimpleCache.<init>(DefaultSimpleCache.java:77)
   at org.alfresco.repo.cache.DefaultCacheFactory.createLocalCache(DefaultCacheFactory.java:52)
   at org.alfresco.repo.cache.DefaultCacheFactory.createCache(DefaultCacheFactory.java:43)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:606)
   at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:145)


<em>pom.xml</em>

<?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>
    <groupId>de.lurse</groupId>
    <artifactId>t50-repo</artifactId>
    <version>1.0-SNAPSHOT</version>
    <name>t50-repo AMP project</name>
    <packaging>amp</packaging>
    <description>Manages the lifecycle of the t50-repo AMP (Alfresco Module Package)</description>

    <parent>
        <groupId>org.alfresco.maven</groupId>
        <artifactId>alfresco-sdk-parent</artifactId>
        <version>2.0.0-SNAPSHOT</version>
    </parent>

    <!–
       | SDK properties have sensible defaults in the SDK parent,
       | but you can override the properties below to use another version.
       | For more available properties see the alfresco-sdk-parent POM.
       –>
    <properties>
        <!– Defines the alfresco edition to compile against. Allowed values are [org.alfresco|org.alfresco.enterprise]–>
        <alfresco.groupId>org.alfresco</alfresco.groupId>
        <!– Defines the alfresco version to compile against –>
        <alfresco.version>5.0.a</alfresco.version>
        <app.log.root.level>WARN</app.log.root.level>
        <alfresco.data.location>alf_data_dev</alfresco.data.location>
        <!– Defines the target WAR artifactId to run this amp, only used with the -Pamp-to-war switch
        .    | Allowed values: alfresco | share. Defaults to a repository AMP, but could point to your foundation WAR –>
        <alfresco.client.war>alfresco</alfresco.client.war>
        <!– Defines the target WAR groupId to run this amp, only used with the -Pamp-to-war switch
        .    | Could be org.alfresco | org.alfresco.enterprise or your corporate groupId –>
        <alfresco.client.war.groupId>org.alfresco</alfresco.client.war.groupId>
        <!– Defines the target WAR version to run this amp, only used with the -Pamp-to-war switch –>
        <alfresco.client.war.version>5.0.a</alfresco.client.war.version>
        <!– This controls which properties will be picked in src/test/properties for embedded run –>
        <env>local</env>
    </properties>

    <!– Here we realize the connection with the Alfresco selected platform
        (e.g.version and edition) –>
    <dependencyManagement>
        <dependencies>
            <!– This will import the dependencyManagement for all artifacts in the selected Alfresco version/edition
                (see http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Importing_Dependencies)
                NOTE: You still need to define dependencies in your POM, but you can omit version as it's enforced by this dependencyManagement. NOTE: It defaults
                to the latest version this SDK pom has been tested with, but alfresco version can/should be overridden in your project's pom –>
            <dependency>
                <groupId>${alfresco.groupId}</groupId>
                <artifactId>alfresco-platform-distribution</artifactId>
                <version>${alfresco.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <!– Following dependencies are needed for compiling Java code in src/main/java;
         <scope>provided</scope> is inherited for each of the following;
         for more info, please refer to alfresco-platform-distribution POM –>
    <dependencies>
        <dependency>
            <groupId>${alfresco.groupId}</groupId>
            <artifactId>alfresco-repository</artifactId>
        </dependency>
        <!– Test dependencies –>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.8.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <!– This repository is only needed to retrieve Alfresco parent POM.
        NOTE: This can be removed when/if Alfresco will be on Maven Central
       
        NOTE: The repository to be used for Alfresco Enterprise artifacts is
        https://artifacts.alfresco.com/nexus/content/groups/private/. Please check
        with Alfresco Support to get credentials to add to your ~/.m2/settings.xml
        if you are a Enterprise customer or Partner 
        –>
    <repositories>
        <repository>
            <id>alfresco-public</id>
            <url>https://artifacts.alfresco.com/nexus/content/groups/public</url>
        </repository>
        <repository>
            <id>alfresco-public-snapshots</id>
            <url>https://artifacts.alfresco.com/nexus/content/groups/public-snapshots</url>
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>daily</updatePolicy>
            </snapshots>
        </repository>
    </repositories>
</project>


<em>Maven:</em> 3.2.3
<em>JDK:</em> 1.7.0_60

What's wrong? Can somebody help me?

Outcomes