0

I'm working on this maven web (java) application (lwl-module), and deploying it to JBoss 7 via eclipse.

When I expanded web application's node under JBoss 7, it had 2 jar files under it, just like the one above it (bhr-module):

enter image description here

But after I made changes to one of these jar files (commons-web) and re-installed it, that jar file was gone from my application's node. And when I redeploy my web application JBoss complains that it can't find of of its classes.

I've run mvn install on the jar file and my web application, removed the module from JBoss and added it again, but the jar file is not added to my node or copied to my web application's WEB-INF/lib directory.

My jar's pom.xml looks like this:

<modelVersion>4.0.0</modelVersion>
<groupId>nl.zin</groupId>
<artifactId>commons-web</artifactId>
<version>1.0.6-SNAPSHOT</version>
<name>ZiN Commons Web Utilities</name>

And my dependency declaration in my web application's pom.xml:

    <dependency>
        <groupId>nl.zin</groupId>
        <artifactId>commons-web</artifactId>
        <version>1.0.6-SNAPSHOT</version>
    </dependency>

Both of these are projects in my eclipse workspace. And I've already tried removing the "-SNAPSHOT" from my jar and war, but no luck.

Another question is, how come JBoss/Eclipse only show me those 2 jars under my web applications when they depend on so many other jars which also get copied into their WEB-INF/lib directories?

And here's the full pom.xml for my web application:

<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>nl.cvz.azrportaal</groupId>
    <artifactId>lwl-module</artifactId>
    <version>1.4-SNAPSHOT</version>
    <name>CVZ LWL Module</name>
    <packaging>war</packaging>
    <properties>
        <java.version>1.7</java.version>
        <javax.servlet.version>3.1.0</javax.servlet.version>
        <javax.jsp.version>2.3.0</javax.jsp.version>
        <javax.jstl.version>1.2</javax.jstl.version>
        <!-- Spring 4.0 proven not compatible with Spring Data. -->
        <org.spring.version>3.2.8.RELEASE</org.spring.version>
        <org.spring.jdbc.version>3.2.8.RELEASE</org.spring.jdbc.version>
        <org.slf4j-version>1.6.6</org.slf4j-version>
        <!-- ZiN artifacts -->
        <nl.zin.commons-web.version>1.0.6-SNAPSHOT</nl.zin.commons-web.version>
    </properties>

<dependencies>
    <!-- ZiN -->
    <dependency>
        <groupId>nl.zin</groupId>
        <artifactId>commons-web</artifactId>
        <version>${nl.zin.commons-web.version}</version>
    </dependency>
    <!-- Log4j -->
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.15</version>
        <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>
    <!-- Java EE -->
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>${javax.servlet.version}</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet.jsp</groupId>
        <artifactId>javax.servlet.jsp-api</artifactId>
        <version>${javax.jsp.version}</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>${javax.jstl.version}</version>
    </dependency>

    <!-- Spring -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-beans</artifactId>
        <version>${org.spring.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>${org.spring.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context-support</artifactId>
        <version>${org.spring.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-jdbc</artifactId>
        <version>${org.spring.jdbc.version}</version>
    </dependency>
    <!-- DisplayTag -->
    <dependency>
        <groupId>displaytag</groupId>
        <artifactId>displaytag</artifactId>
        <version>1.2</version>
    </dependency>
    <dependency>
        <groupId>cglib</groupId>
        <artifactId>cglib</artifactId>
        <version>2.2</version>
    </dependency>
    <!-- CXF -->
    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-frontend-jaxws</artifactId>
        <version>2.2.6</version>
        <exclusions>
            <exclusion>
                <groupId>org.apache.geronimo.specs</groupId>
                <artifactId>geronimo-javamail_1.4_spec</artifactId>
            </exclusion>
            <exclusion>
                <artifactId>saaj-api</artifactId>
                <groupId>javax.xml.soap</groupId>
            </exclusion>
            <exclusion>
                <artifactId>saaj-impl</artifactId>
                <groupId>com.sun.xml.messaging.saaj</groupId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-transports-http</artifactId>
        <version>2.2.6</version>
    </dependency>
    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-transports-http-jetty</artifactId>
        <version>2.2.6</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-ws-security</artifactId>
        <version>2.2.6</version>
        <exclusions>
            <exclusion>
                <!-- Let op deze library mag niet mee verpakt worden maar moet in de 
                    /server/cvz/lib directory van JBoss geplaatst worden -->
                <groupId>org.bouncycastle</groupId>
                <artifactId>bcprov-jdk15</artifactId>
            </exclusion>
            <exclusion>
                <groupId>xalan</groupId>
                <artifactId>xalan</artifactId>
            </exclusion>
            <exclusion>
                <artifactId>saaj-api</artifactId>
                <groupId>javax.xml.soap</groupId>
            </exclusion>
        </exclusions>
    </dependency>
    <!-- 
    <dependency>
        <groupId>xerces</groupId>
        <artifactId>xercesImpl</artifactId>
        <version>2.10.0</version>
    </dependency>
     -->
    <!-- Commons -->
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-io</artifactId>
        <version>1.3.2</version>
    </dependency>
    <!-- Test -->
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.7</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-test</artifactId>
        <version>${org.spring.version}</version>
        <scope>test</scope>
    </dependency>

</dependencies>
<build>
    <finalName>landwachtlijstmodule</finalName>
    <plugins>
        <plugin>
            <artifactId>maven-eclipse-plugin</artifactId>
            <version>2.9</version>
            <configuration>
                <additionalProjectnatures>
                    <projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
                </additionalProjectnatures>
                <additionalBuildcommands>
                    <buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand>
                </additionalBuildcommands>
                <downloadSources>true</downloadSources>
                <downloadJavadocs>true</downloadJavadocs>
            </configuration>
        </plugin>           
        <plugin>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-codegen-plugin</artifactId>
            <version>2.7.11</version>
            <executions>
                <execution>
                    <id>generate-sources</id>
                    <phase>generate-sources</phase>
                    <configuration>
                        <sourceRoot>${basedir}/src/main/generated</sourceRoot>
                        <defaultOptions>
                            <frontEnd>jaxws21</frontEnd>
                        </defaultOptions>
                        <wsdlOptions>
                            <wsdlOption>
                                <wsdl>src/main/resources/AZRKetenpartijService.wsdl</wsdl>
                                <extraargs>
                                    <extraarg>-client</extraarg>
                                </extraargs>
                            </wsdlOption>
                            <wsdlOption>
                                <wsdl>src/main/resources/LandelijkeWachtlijst.wsdl</wsdl>
                                <extraargs>
                                    <extraarg>-client</extraarg>
                                </extraargs>
                            </wsdlOption>
                        </wsdlOptions>
                    </configuration>
                    <goals>
                        <goal>wsdl2java</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
    <extensions>
        <extension>
            <groupId>org.apache.maven.wagon</groupId>
            <artifactId>wagon-webdav-jackrabbit</artifactId>
            <version>1.0-beta-7</version>
        </extension>
    </extensions>
</build>

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
Henrique Ordine
  • 3,337
  • 4
  • 44
  • 70
  • please paste the output of maven when you build the commons-web JAR. and paste the FULL pom.xml of your WAR (is it snapshot? release?) – OhadR Feb 16 '15 at 14:00
  • It's a war and the version is 1.4-SNAPSHOT. – Henrique Ordine Feb 16 '15 at 14:24
  • I think there might be a problem with my commons-web-1.0.6, because if I change the dependency to the version 1.0.5, the jar file gets added to my application again. But if I run mvn clean install on my commons-web-1.0.6 it builds without any errors. I'll post the full pom.xml. – Henrique Ordine Feb 16 '15 at 14:31
  • what is the version of your WAR? is it a snapshot? if it is not (meaning, it is a release), then it cannot be dependent on "snapshot" versions, and your commons-web:1.0.6-snapshot is a snapshot... – OhadR Feb 16 '15 at 14:44
  • 1. if you change back the dependency to commons-web:1.0.5 it is working? 2. when you try to build (mvn clean install) 1.0.6-snapshot, are there any errors/warnings? paste them here – OhadR Feb 16 '15 at 14:56
  • Exactly, and I don't get any errors when running mvn clean install on 1.0.6-snapshot. – Henrique Ordine Feb 16 '15 at 15:50
  • did u check your LOCAL repo (.m2 dir)? is it there? – OhadR Feb 17 '15 at 05:42
  • 1
    Yes it does. See my answer below, I seem to have fixed it. Maven wouldn't fail but Eclipse wouldn't recognise commons-web as a web fragment. Thanks for thinking along. – Henrique Ordine Feb 17 '15 at 15:25

3 Answers3

1

Apparently those nodes under my web applications are Web fragments that my applications depend on.

There was a Java EE configuration problem with my Web fragment (commons-web), as I wrote here.

This error wasn't causing a maven build to fail but Eclipse wasn't recognising my project as a web fragment for JBoss.

Community
  • 1
  • 1
Henrique Ordine
  • 3,337
  • 4
  • 44
  • 70
0

You need to install the JBoss maven plugin from eclipse market place and create a new maven project and add your code to the application.

Once that is done, add the project the on jboss server that is imported in eclipse and check Build Actomatically.

Whenever you change the file, application requires publishing to the serve which copies latest jar files and updated class files.

All the jars mentioned as maven dependencies will be shown in eclipse.

Hope this helps.

Bharat
  • 31
  • 4
-1

You can also try mvn clean compile install

gauravoli
  • 74
  • 1
  • 3
  • 9