0

I am facing an issue while running a Dynamic Web Project in Eclipse. I have created a Maven Project (archtype - webapp) and then added DWP behaviour in it by adding maven-eclipse-plugin (version 2.9). The I added my project dependencies in POM file which is as follows

<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>au.com.fairfaxdigital</groupId>
    <artifactId>accessloganalyzer</artifactId>
    <packaging>war</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>accessloganalyzer Maven Webapp</name>
    <url>http://maven.apache.org</url>  
    <dependencies>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.0.1</version>
        </dependency>
        <dependency>
            <groupId>net.sourceforge.wurfl</groupId>
            <artifactId>wurfl</artifactId>
            <version>1.4</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>3.8</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <repositories>
        <repository>
            <id>scientiamobile.public</id>
            <name>Scientia Mobile Public repository</name>
            <url>http://dev.scientiamobile.com/nexus/content/repositories/public-releases/</url>
        </repository>
    </repositories>
    <build>
        <finalName>accessloganalyzer</finalName>

        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-eclipse-plugin</artifactId>
                <version>2.9</version>
                <configuration>
                    <projectNameTemplate>accessloganalyzer-${project.version}</projectNameTemplate>
                    <downloadSources>true</downloadSources>
                    <downloadJavadocs>true</downloadJavadocs>
                    <wtpmanifest>true</wtpmanifest>
                    <wtpapplicationxml>true</wtpapplicationxml>
                    <wtpversion>2.0</wtpversion>
                    <manifest>${basedir}/src/main/resources/META-INF/MANIFEST.MF</manifest>
                </configuration>
            </plugin>

        </plugins>
    </build>
</project>

Then I build the project using maven command (clean install). I could see the generated war file in target folder. When try run this application on tomcat within eclipse (project->right click->run one server) tomcat starts with an error.

SEVERE: Exception sending context initialized event to listener instance of class net.sourceforge.wurfl.core.web.WURFLServletContextListener java.lang.NoClassDefFoundError: org/apache/commons/lang/StringUtils at net.sourceforge.wurfl.core.web.WURFLServletContextListener.contextInitialized(WURFLServletContextListener.java:81) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4765) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5260) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:866) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:842) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615) at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:649) at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1581) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) 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.ClassNotFoundException: org.apache.commons.lang.StringUtils at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1688) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1533) ... 15 more Starting Introspector initialization...

When I look into the Eclipse Folder from where tomcat runs the app (C:\Deepak\Study\Dev\Practicals\workspace.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\accessloganalyzer-1.0-SNAPSHOT), I didn't find any dependencies (including commons-lang which is being referenced in the error) for the third party library wurfl.1.4.jar that I am using in my project.

wurfl library uses the following dependencies which are not present in WEB-INF/lib and hence causing the issue

  • commons-collections-3.2.1
  • commons-lang-2.6
  • jackson-core-asl-1.8.2
  • jackson-mapper-asl-1.8.2
  • logback-classic-0.9.28
  • logback-core-0.9.28
  • slf4j-api-1.6.1

Can any one please point what I missing why these transitive dependencies are not being copied in WEB-INF/lib folder in the application WAR file?

Jason Sturges
  • 15,855
  • 14
  • 59
  • 80
  • Are you using m2e? If yes than you don't need the eclipse plugin? Are you sure about the 1.4 version of the wurf librare ? – khmarbaise Jun 24 '12 at 16:57
  • hi khmarbaise, thanks for responding to this thread. I tried removing eclipse plugin but the result is same. Yes I am sure about wurff 1.4. I have downloaded this library from wurfl site and installed it manually using maven manual install command. – user1477713 Jun 28 '12 at 21:29

1 Answers1

1

Install m2e wtp plugin. This plugin can be installed from the Eclipse Marketplace (Help -> Eclipse Marketplace...). That should get you most of the way there. You should then see your dependencies where you are expecting.

Lucas
  • 14,227
  • 9
  • 74
  • 124