0
votes

I'm new to maven.

When trying to deploy WAR app on Glassfish Server 3.1.2.2 Web Profile build with maven 3.0.4 on Linux the following error occur: "org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [...]".

There is nothing wrong with CDI on the classes that this error acuses. The proof is: the same build works on Glassfish Server 3.1.2.2 Full Profile. The project has beans.xml on main/webapp/WEB-INF.

An interesting detail is, when i remove the "provided" scope from the dependencies, the error disappear and the deploy works fine.

The generated WAR with default scope "compile" give me a 24MB file. The generated WAR with "provided" scope give me a 11MB file.

Please correct me if i'm wrong, but i think there is no need to put libs inside war that will be provided by the application server. What am i missing here?

The application uses JSF 2.1, EJB 3.1, CDI 1.0, JPA 2.0 and JTA specifications.

So here's my pom.xml:

 <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>alfabr</groupId>
    <artifactId>AlfaBR</artifactId>
    <packaging>war</packaging>
  <version>1.2.0-SNAPSHOT</version>
  <name>AlfaBR Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <repositories>
    <repository>
        <id>prime-repo</id>
        <name>PrimeFaces Maven Repository</name>
        <url>http://repository.primefaces.org</url>
        <layout>default</layout>
    </repository>
  </repositories>

  <pluginRepositories>
    <pluginRepository>
      <id>maven.java.net</id>
      <name>Java.net Maven2 Repository</name>
      <url>http://download.java.net/maven/2</url>
    </pluginRepository>
  </pluginRepositories>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.eclipse.persistence</groupId>
        <artifactId>javax.persistence</artifactId>
        <version>2.1.0</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.inject</groupId>
        <artifactId>javax.inject</artifactId>
        <version>1</version>
            <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.primefaces</groupId>
        <artifactId>primefaces</artifactId>
        <version>3.4</version>
    </dependency>
    <dependency>
        <groupId>javax.faces</groupId>
        <artifactId>jsf-api</artifactId>
        <version>2.1</version>
            <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <type>maven-plugin</type>
    </dependency>
    <dependency>
        <groupId>com.itextpdf</groupId>
        <artifactId>itextpdf</artifactId>
        <version>5.4.3</version>
    </dependency>
    <dependency>
        <groupId>javax.ejb</groupId>
        <artifactId>javax.ejb-api</artifactId>
        <version>3.2</version>
            <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>3.1</version>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>3.1.0</version>
            <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.el</groupId>
        <artifactId>javax.el-api</artifactId>
        <version>3.0.0</version>
            <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.enterprise</groupId>
        <artifactId>cdi-api</artifactId>
        <version>1.0</version>
            <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.eclipse.persistence</groupId>
        <artifactId>org.eclipse.persistence.jpa</artifactId>
        <version>2.4.2</version>
            <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.directory.studio</groupId>
        <artifactId>org.apache.commons.codec</artifactId>
        <version>1.8</version>
    </dependency>
    <dependency>
        <groupId>javax.xml.rpc</groupId>
        <artifactId>javax.xml.rpc-api</artifactId>
        <version>1.1</version>
            <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.persistence</groupId>
        <artifactId>persistence-api</artifactId>
        <version>1.0.2</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.glassfish.main</groupId>
        <artifactId>javax.transaction</artifactId>
        <version>4.0-b33</version>
            <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.primefaces.themes</groupId>
        <artifactId>bootstrap</artifactId>
        <version>1.0.9</version>
    </dependency>
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-io</artifactId>
        <version>1.3.2</version>
    </dependency>
    <dependency>
        <groupId>commons-fileupload</groupId>
        <artifactId>commons-fileupload</artifactId>
        <version>1.3</version>
    </dependency>
    <dependency>
        <groupId>org.apache.axis</groupId>
        <artifactId>axis</artifactId>
        <version>1.4</version>
    </dependency>
  </dependencies>
  <build>
      <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
                <compilerArguments>
                    <verbose />
                    <bootclasspath>${java.home}/lib/rt.jar${path.separator}${java.home}/lib/jce.jar</bootclasspath>
                </compilerArguments>
            </configuration>
        </plugin>       
       </plugins>
    <finalName>AlfaBR</finalName>
  </build>
</project>
1
Please provide the full stacktrace.John Ament
And the offending class code - you're probably injecting something that's not part of the Java EE Web Profile. Also, it is highly unlikely that this has anything to do with maven.rdcrng
You are right. Thank you, sorry for the inconvenience.user1934440

1 Answers

0
votes

@rdcrng is right. This has nothing to do with maven.

We are moving the application from Glassfish Full Profile to Web Profile and starting to use maven.

So i found a JAX-WS 2.2 annotation in one of the injected dependencies. JAX-WS is not included in Glassfish 3.1.2.2 Web Profile as says here.

I remove it and the build was deployed successfully.