2 Replies Latest reply: Mar 29, 2012 9:38 AM by Silvestre Losada RSS

    CONFIGURATION FAILED! duplicate key: interface javax.validation.constraints.Size

    Silvestre Losada Newbie

      Hi,

      I have been trying to run an arquilian test using an existing war. The error happens during deployment and the war is deployed without problems tomcat server.

       

        

         @Deployment
         public static WebArchive createDeployment() {
                   ZipFile existingZipFile;
                try {
                          existingZipFile = new ZipFile("target/newmedia-permissions.war");
                             WebArchive war = ShrinkWrap.create(ZipImporter.class, "media.war")
                         .importFrom(existingZipFile)
                         .as(WebArchive.class);
                                return war;
                } catch (IOException e) {
                          // TODO Auto-generated catch block
                          e.printStackTrace();
                }
      
      
      //      System.out.println(war.toString(true)); // for debugging
            return null;
         }
      


      Im using embebbed tomcat to run the test, when I run the test I get the following error

      com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! duplicate key: class javax.faces.validator.Size

                at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:375)

                at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:225)

                at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4723)

                at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5226)

                at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5221)

                at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)

                at java.util.concurrent.FutureTask.run(FutureTask.java:138)

                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

                at java.lang.Thread.run(Thread.java:662)

      Caused by: java.lang.IllegalArgumentException: duplicate key: class javax.faces.validator.Size

                at com.google.common.base.Preconditions.checkArgument(Preconditions.java:115)

                at com.google.common.collect.RegularImmutableMap.<init>(RegularImmutableMap.java:72)

                at com.google.common.collect.ImmutableMap$Builder.fromEntryList(ImmutableMap.java:221)

                at com.google.common.collect.ImmutableMap$Builder.build(ImmutableMap.java:207)

                at org.richfaces.javascript.ClientServiceConfigParser.parseConfig(ClientServiceConfigParser.java:54)

                at org.richfaces.application.ValidatorModule.createClientScriptService(ValidatorModule.java:68)

                at org.richfaces.application.ValidatorModule.configure(ValidatorModule.java:62)

                at org.richfaces.application.ServicesFactoryImpl.init(ServicesFactoryImpl.java:28)

                at org.richfaces.application.InitializationListener.createFactory(InitializationListener.java:136)

                at org.richfaces.application.InitializationListener.onStart(InitializationListener.java:110)

                at org.richfaces.application.InitializationListener.processEvent(InitializationListener.java:152)

                at javax.faces.event.SystemEvent.processListener(SystemEvent.java:106)

                at com.sun.faces.application.ApplicationImpl.processListeners(ApplicationImpl.java:2129)

                at com.sun.faces.application.ApplicationImpl.invokeListenersFor(ApplicationImpl.java:2105)

                at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:300)

                at com.sun.faces.config.ConfigManager.publishPostConfigEvent(ConfigManager.java:600)

                at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:369)

                ... 9 more

       

       

      I've been reading about the error and it happens if there is duplicated libraries inside the application in this case validation-api. In this particular case validation jar is not packaged inside the application.