Issues with Weld are fixed in Weblogic 12.1.2 which uses newer version of Weld library
http://docs.oracle.com/middleware/1212/wls/NOTES/index.html#NOTES254
Weblogic 12.1.1 is strictly checking all injections at deployment time
Utility project jar used by Weld must also have beans.xml file
http://docs.jboss.org/weld/reference/1.1.0.Final/en-US/html_single/#d0e4697
Following error is thrown for failed injection validation WELD-001408 Unsatisfied dependencies for type
Creating Shared Java EE Libraries and Optional Packages http://docs.oracle.com/cd/E24329_01/web.1211/e24368/libraries.htm#autoId2
https://cn.forums.oracle.com/forums/thread.jspa?threadID=2485198&start=0&tstart=1
https://forums.oracle.com/forums/thread.jspa?threadID=2506170&tstart=0
http://stackoverflow.com/questions/5060314/inject-a-stateless-ejb-with-inject-into-cdi-weld-managedbean-jsf-1-2-ejb-appli
Three projects are created:
- Web project using Weld injection from utility jar
- utility jar project with class for injection
- ear projected packaging war and utility jar
Create Java EE project with Maven
http://www.adam-bien.com/roller/abien/entry/creating_java_ee_6_projects
Maven Weblogic plugin
http://docs.oracle.com/cd/E21764_01/web.1111/e13702/maven_deployer.htm
Kepler Java EE already comes with m2e Maven Eclipse plugin
http://www.eclipse.org/downloads/packages/eclipse-ide-java-ee-developers/keplerrc2
ear project
web project
utility project
building ear with Maven
generated application.xml file
ear content
war content
utility jar content
deploy project
Test application at http://localhost:7001/weld-web/TestServlet
http://docs.oracle.com/middleware/1212/wls/NOTES/index.html#NOTES254
Weblogic 12.1.1 is strictly checking all injections at deployment time
Utility project jar used by Weld must also have beans.xml file
http://docs.jboss.org/weld/reference/1.1.0.Final/en-US/html_single/#d0e4697
CDI doesn't define any special deployment archive. You can package beans in jars, ejb jars or wars—any
deployment location in the application classpath. However, the archive must be a "bean archive". That means
each archive that contains beans must include a file named
In an embeddable EJB container, beans may be deployed in any location in which EJBs may be deployed. Again, each location must contain a
beans.xml
in
the META-INF
directory of the classpath or WEB-INF
directory of the web
root (for war archives). The file may be empty. Beans deployed in archives that do not have a
beans.xml
file will not be available for use in the application.
In an embeddable EJB container, beans may be deployed in any location in which EJBs may be deployed. Again, each location must contain a
beans.xml
file.
Following error is thrown for failed injection validation WELD-001408 Unsatisfied dependencies for type
<May 11, 2013 7:34:08 PM CEST> <Warning> <Deployer> <BEA-149004> <Failures were detected while initiating deploy task for application "weld-ear-1.0-SNAPSHOT".>
<May 11, 2013 7:34:08 PM CEST> <Warning> <Deployer> <BEA-149078> <Stack trace for message 149004
weblogic.management.DeploymentException:
at weblogic.application.internal.BaseDeployment.throwAppException(BaseDeployment.java:123)
at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:239)
at weblogic.application.internal.EarDeployment.prepare(EarDeployment.java:61)
at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:158)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:60)
Truncated. see log file for complete stacktrace
Caused By: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [String] with qualifiers [@Default] at injection point [[field] @Inject private dave.TestServlet.injectedValue]
at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:258)
at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:105)
at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:125)
at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:324)
at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:309)
Truncated. see log file for complete stacktrace
>
Creating Shared Java EE Libraries and Optional Packages http://docs.oracle.com/cd/E24329_01/web.1211/e24368/libraries.htm#autoId2
https://cn.forums.oracle.com/forums/thread.jspa?threadID=2485198&start=0&tstart=1
https://forums.oracle.com/forums/thread.jspa?threadID=2506170&tstart=0
http://stackoverflow.com/questions/5060314/inject-a-stateless-ejb-with-inject-into-cdi-weld-managedbean-jsf-1-2-ejb-appli
Three projects are created:
- Web project using Weld injection from utility jar
- utility jar project with class for injection
- ear projected packaging war and utility jar
Create Java EE project with Maven
http://www.adam-bien.com/roller/abien/entry/creating_java_ee_6_projects
Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): 278: 479
Choose org.codehaus.mojo.archetypes:webapp-javaee6 version:
1: 1.0
2: 1.0.1
3: 1.0.2
4: 1.1
5: 1.2
6: 1.3
7: 1.4
8: 1.5
Choose a number: 8:
Downloading: http://repo.maven.apache.org/maven2/org/codehaus/mojo/archetypes/webapp-javaee6/1.5/webapp-javaee6-1.5.jar
Downloaded: http://repo.maven.apache.org/maven2/org/codehaus/mojo/archetypes/webapp-javaee6/1.5/webapp-javaee6-1.5.jar (2 KB at 13.3 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/codehaus/mojo/archetypes/webapp-javaee6/1.5/webapp-javaee6-1.5.pom
Downloaded: http://repo.maven.apache.org/maven2/org/codehaus/mojo/archetypes/webapp-javaee6/1.5/webapp-javaee6-1.5.pom (918 B at 3.0 KB/sec)
Define value for property 'groupId': : weld-web
Define value for property 'artifactId': : weld-web
Define value for property 'version': 1.0-SNAPSHOT: :
Define value for property 'package': weld-web: : dave
Confirm properties configuration:
groupId: weld-web
artifactId: weld-web
version: 1.0-SNAPSHOT
package: dave
Y: :
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Archetype: webapp-javaee6:1.5
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: weld-web
[INFO] Parameter: artifactId, Value: weld-web
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: package, Value: dave
[INFO] Parameter: packageInPathFormat, Value: dave
[INFO] Parameter: package, Value: dave
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: groupId, Value: weld-web
[INFO] Parameter: artifactId, Value: weld-web
[INFO] project created from Archetype in dir: /home/dave/workspace/weld-web
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:58.096s
[INFO] Finished at: Wed Jun 05 09:54:07 CEST 2013
[INFO] Final Memory: 12M/105M
[INFO] ------------------------------------
Maven Weblogic plugin
http://docs.oracle.com/cd/E21764_01/web.1111/e13702/maven_deployer.htm
Kepler Java EE already comes with m2e Maven Eclipse plugin
http://www.eclipse.org/downloads/packages/eclipse-ide-java-ee-developers/keplerrc2
ear project
[dave@dave weld-ear]$ ls -lR
.:
total 12
-rw-rw-r--. 1 dave dave 1837 May 11 18:48 pom.xml
drwxrwxr-x. 3 dave dave 4096 May 11 13:41 src
drwxrwxr-x. 4 dave dave 4096 May 11 19:35 target
./src:
total 4
drwxrwxr-x. 3 dave dave 4096 May 11 13:41 main
./src/main:
total 4
drwxrwxr-x. 3 dave dave 4096 May 11 13:41 application
./src/main/application:
total 4
drwxrwxr-x. 2 dave dave 4096 May 11 13:41 META-INF
./src/main/application/META-INF:
total 4
-rw-rw-r--. 1 dave dave 23 May 11 13:41 MANIFEST.MF
./target:
total 20
-rw-rw-r--. 1 dave dave 494 May 11 19:35 application.xml
drwxrwxr-x. 2 dave dave 4096 May 11 19:35 maven-archiver
drwxrwxr-x. 4 dave dave 4096 May 11 19:35 weld-ear-1.0-SNAPSHOT
-rw-rw-r--. 1 dave dave 6359 May 11 19:35 weld-ear-1.0-SNAPSHOT.ear
./target/maven-archiver:
total 4
-rw-rw-r--. 1 dave dave 109 May 11 19:35 pom.properties
./target/weld-ear-1.0-SNAPSHOT:
total 12
drwxrwxr-x. 2 dave dave 4096 May 11 19:35 lib
drwxrwxr-x. 2 dave dave 4096 May 11 19:35 META-INF
-rw-rw-r--. 1 dave dave 3640 May 11 19:35 weld-web.war
./target/weld-ear-1.0-SNAPSHOT/lib:
total 4
-rw-rw-r--. 1 dave dave 2294 May 11 19:35 testUtility-1.0-SNAPSHOT.jar
./target/weld-ear-1.0-SNAPSHOT/META-INF:
total 8
-rw-rw-r--. 1 dave dave 494 May 11 19:35 application.xml
-rw-rw-r--. 1 dave dave 23 May 11 19:35 MANIFEST.MF
[dave@dave weld-ear]$
web project
[dave@dave weld-web]$ ls -lR
.:
total 12
-rw-rw-r--. 1 dave dave 2899 May 11 19:48 pom.xml
drwxrwxr-x. 3 dave dave 4096 May 11 13:42 src
drwxrwxr-x. 8 dave dave 4096 May 11 19:20 target
./src:
total 4
drwxrwxr-x. 4 dave dave 4096 May 11 13:42 main
./src/main:
total 8
drwxrwxr-x. 3 dave dave 4096 May 11 13:42 java
drwxrwxr-x. 3 dave dave 4096 May 11 19:16 webapp
./src/main/java:
total 4
drwxrwxr-x. 2 dave dave 4096 May 11 18:26 dave
./src/main/java/dave:
total 4
-rw-rw-r--. 1 dave dave 1285 May 9 22:56 TestServlet.java
./src/main/webapp:
total 8
-rw-rw-r--. 1 dave dave 361 May 11 13:42 index.jsp
drwxrwxr-x. 2 dave dave 4096 May 11 19:17 WEB-INF
./src/main/webapp/WEB-INF:
total 4
-rw-rw-r--. 1 dave dave 269 May 9 23:06 beans.xml
./target:
total 28
drwxrwxr-x. 3 dave dave 4096 May 11 19:20 classes
drwxrwxr-x. 2 dave dave 4096 May 11 19:20 endorsed
drwxrwxr-x. 3 dave dave 4096 May 11 19:20 generated-sources
drwxrwxr-x. 2 dave dave 4096 May 11 19:20 maven-archiver
drwxrwxr-x. 2 dave dave 4096 May 11 19:20 surefire
drwxrwxr-x. 4 dave dave 4096 May 11 19:20 weld-web-1.0-SNAPSHOT
-rw-rw-r--. 1 dave dave 3640 May 11 19:20 weld-web-1.0-SNAPSHOT.war
./target/classes:
total 4
drwxrwxr-x. 2 dave dave 4096 May 11 19:20 dave
./target/classes/dave:
total 4
-rw-rw-r--. 1 dave dave 1443 May 11 19:20 TestServlet.class
./target/endorsed:
total 108
-rw-rw-r--. 1 dave dave 108093 May 11 19:20 javaee-endorsed-api-6.0.jar
./target/generated-sources:
total 4
drwxrwxr-x. 2 dave dave 4096 May 11 19:20 annotations
./target/generated-sources/annotations:
total 0
./target/maven-archiver:
total 4
-rw-rw-r--. 1 dave dave 109 May 11 19:20 pom.properties
./target/surefire:
total 0
./target/weld-web-1.0-SNAPSHOT:
total 12
-rw-rw-r--. 1 dave dave 361 May 11 13:42 index.jsp
drwxrwxr-x. 2 dave dave 4096 May 11 19:20 META-INF
drwxrwxr-x. 3 dave dave 4096 May 11 19:20 WEB-INF
./target/weld-web-1.0-SNAPSHOT/META-INF:
total 0
./target/weld-web-1.0-SNAPSHOT/WEB-INF:
total 8
-rw-rw-r--. 1 dave dave 269 May 9 23:06 beans.xml
drwxrwxr-x. 3 dave dave 4096 May 11 19:20 classes
./target/weld-web-1.0-SNAPSHOT/WEB-INF/classes:
total 4
drwxrwxr-x. 2 dave dave 4096 May 11 19:20 dave
./target/weld-web-1.0-SNAPSHOT/WEB-INF/classes/dave:
total 4
-rw-rw-r--. 1 dave dave 1443 May 11 19:20 TestServlet.class
[dave@dave weld-web]$
utility project
[dave@dave testUtility]$ ls -lR
.:
total 12
-rw-rw-r--. 1 dave dave 849 May 11 18:46 pom.xml
drwxrwxr-x. 4 dave dave 4096 May 11 18:43 src
drwxrwxr-x. 7 dave dave 4096 May 11 19:34 target
./src:
total 8
drwxrwxr-x. 4 dave dave 4096 May 11 19:18 main
drwxrwxr-x. 3 dave dave 4096 May 11 18:43 test
./src/main:
total 8
drwxrwxr-x. 3 dave dave 4096 May 11 18:43 java
drwxrwxr-x. 3 dave dave 4096 May 11 19:18 resources
./src/main/java:
total 4
drwxrwxr-x. 2 dave dave 4096 May 11 18:46 dave
./src/main/java/dave:
total 4
-rw-rw-r--. 1 dave dave 167 May 11 18:45 ValueProducer.java
./src/main/resources:
total 4
drwxrwxr-x. 2 dave dave 4096 May 11 19:18 META-INF
./src/main/resources/META-INF:
total 4
-rw-rw-r--. 1 dave dave 269 May 11 19:18 beans.xml
./src/test:
total 4
drwxrwxr-x. 3 dave dave 4096 May 11 18:43 java
./src/test/java:
total 4
drwxrwxr-x. 2 dave dave 4096 May 11 18:43 dave
./src/test/java/dave:
total 4
-rw-rw-r--. 1 dave dave 632 May 11 18:43 AppTest.java
./target:
total 24
drwxrwxr-x. 4 dave dave 4096 May 11 19:34 classes
drwxrwxr-x. 2 dave dave 4096 May 11 19:34 maven-archiver
drwxrwxr-x. 2 dave dave 4096 May 11 19:34 surefire
drwxrwxr-x. 2 dave dave 4096 May 11 19:34 surefire-reports
drwxrwxr-x. 3 dave dave 4096 May 11 19:34 test-classes
-rw-rw-r--. 1 dave dave 2294 May 11 19:34 testUtility-1.0-SNAPSHOT.jar
./target/classes:
total 8
drwxrwxr-x. 2 dave dave 4096 May 11 19:34 dave
drwxrwxr-x. 2 dave dave 4096 May 11 19:34 META-INF
./target/classes/dave:
total 4
-rw-rw-r--. 1 dave dave 468 May 11 19:34 ValueProducer.class
./target/classes/META-INF:
total 4
-rw-rw-r--. 1 dave dave 269 May 11 19:34 beans.xml
./target/maven-archiver:
total 4
-rw-rw-r--. 1 dave dave 115 May 11 19:34 pom.properties
./target/surefire:
total 0
./target/surefire-reports:
total 12
-rw-rw-r--. 1 dave dave 257 May 11 19:34 dave.AppTest.txt
-rw-rw-r--. 1 dave dave 4145 May 11 19:34 TEST-dave.AppTest.xml
./target/test-classes:
total 4
drwxrwxr-x. 2 dave dave 4096 May 11 19:34 dave
./target/test-classes/dave:
total 4
-rw-rw-r--. 1 dave dave 588 May 11 19:34 AppTest.class
[dave@dave testUtility]$
[dave@dave testUtility]$ more ./src/main/java/dave/ValueProducer.java
package dave;
import javax.enterprise.inject.Produces;
public class ValueProducer {
@Produces
public String stringValue() {
return "someStringValue";
}
}
[dave@dave weld-web]$ more ./src/main/java/dave/TestServlet.java
package dave;
import java.io.IOException;
import java.io.PrintWriter;
import javax.inject.Inject;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Servlet implementation class TestServlet
*/
@WebServlet("/TestServlet")
public class TestServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public TestServlet() {
super();
// TODO Auto-generated constructor stub
}
@Inject
private String injectedValue;
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
PrintWriter pw = response.getWriter();
pw.write("injectedValue: " + injectedValue);
pw.flush();
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws Servlet
Exception, IOException {
// TODO Auto-generated method stub
}
}
[dave@dave weld-web]$ more pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instanc
e"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0
.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>weld-web</groupId>
<artifactId>weld-web</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>weld-web</name>
<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${endorsed.dir}</outputDirectory>
<silent>true</silent>
<artifactItems>
<artifactItem>
<groupId>javax</groupId>
<artifactId>javaee-endorsed-api</artifactId>
<version>6.0</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
[dave@dave weld-web]$
[dave@dave weld-ear]$ more pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instanc
e"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>weld-ear</groupId>
<artifactId>weld-ear</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>ear</packaging>
<name>weld-ear</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>weld-web</groupId>
<artifactId>weld-web</artifactId>
<version>1.0-SNAPSHOT</version>
<type>war</type>
</dependency>
<dependency>
<groupId>testUtility</groupId>
<artifactId>testUtility</artifactId>
<version>1.0-SNAPSHOT</version>
<type>jar</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.6</version>
<configuration>
<version>6</version>
<defaultLibBundleDir>lib</defaultLibBundleDir>
<modules>
<webModule>
<groupId>weld-web</groupId>
<artifactId>weld-web</artifactId>
<uri>weld-web.war</uri>
<bundleFileName>weld-web.war</bundleFileName>
<contextRoot>/weld-web</contextRoot>
</webModule>
</modules>
</configuration>
</plugin>
</plugins>
</build>
</project>
building ear with Maven
[dave@dave weld-ear]$ mvn clean install
/usr/java//jdk1.7.0_21
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building weld-ear 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ weld-ear ---
[INFO] Deleting /home/dave/workspace/weld-ear/target
[INFO]
[INFO] --- maven-ear-plugin:2.6:generate-application-xml (default-generate-application-xml) @ weld-ear ---
[INFO] Generating application.xml
[INFO]
[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ weld-ear ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/dave/workspace/weld-ear/src/main/resources
[INFO]
[INFO] --- maven-ear-plugin:2.6:ear (default-ear) @ weld-ear ---
[INFO] Copying artifact[war:weld-web:weld-web:1.0-SNAPSHOT] to[weld-web.war]
[INFO] Copying artifact[jar:testUtility:testUtility:1.0-SNAPSHOT] to[lib/testUtility-1.0-SNAPSHOT.jar]
[INFO] Copy ear sources to /home/dave/workspace/weld-ear/target/weld-ear-1.0-SNAPSHOT
[INFO] Including custom manifest file[/home/dave/workspace/weld-ear/target/weld-ear-1.0-SNAPSHOT/META-INF/MANIFEST.MF]
[INFO] Building jar: /home/dave/workspace/weld-ear/target/weld-ear-1.0-SNAPSHOT.ear
[INFO]
[INFO] --- maven-install-plugin:2.3.1:install (default-install) @ weld-ear ---
[INFO] Installing /home/dave/workspace/weld-ear/target/weld-ear-1.0-SNAPSHOT.ear to /home/dave/.m2/repository/weld-ear/weld-ear/1.0-SNAPSHOT/weld-ear-1.0-SNAPSHOT.ear
[INFO] Installing /home/dave/workspace/weld-ear/pom.xml to /home/dave/.m2/repository/weld-ear/weld-ear/1.0-SNAPSHOT/weld-ear-1.0-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.520s
[INFO] Finished at: Sat May 11 20:15:00 CEST 2013
[INFO] Final Memory: 4M/15M
[INFO] ------------------------------------------------------------------------
[dave@dave weld-ear]$
generated application.xml file
[dave@dave weld-ear]$ more ./target/application.xml
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-ins
tance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/applica
tion_6.xsd" version="6">
<display-name>weld-ear</display-name>
<module>
<web>
<web-uri>weld-web.war</web-uri>
<context-root>/weld-web</context-root>
</web>
</module>
<library-directory>lib</library-directory>
</application>
ear content
[dave@dave weld-ear]$ jar tvf target/weld-ear-1.0-SNAPSHOT.ear
0 Sat May 11 20:15:02 CEST 2013 META-INF/
123 Sat May 11 20:15:00 CEST 2013 META-INF/MANIFEST.MF
0 Sat May 11 20:15:00 CEST 2013 lib/
494 Sat May 11 20:15:00 CEST 2013 META-INF/application.xml
2294 Sat May 11 20:15:00 CEST 2013 lib/testUtility-1.0-SNAPSHOT.jar
3640 Sat May 11 20:15:00 CEST 2013 weld-web.war
0 Sat May 11 20:15:02 CEST 2013 META-INF/maven/
0 Sat May 11 20:15:02 CEST 2013 META-INF/maven/weld-ear/
0 Sat May 11 20:15:02 CEST 2013 META-INF/maven/weld-ear/weld-ear/
1837 Sat May 11 18:48:28 CEST 2013 META-INF/maven/weld-ear/weld-ear/pom.xml
109 Sat May 11 20:15:00 CEST 2013 META-INF/maven/weld-ear/weld-ear/pom.properties
war content
[dave@dave weld-web]$ jar tvf target/weld-web-1.0-SNAPSHOT.war
0 Sat May 11 19:20:28 CEST 2013 META-INF/
123 Sat May 11 19:20:26 CEST 2013 META-INF/MANIFEST.MF
0 Sat May 11 19:20:28 CEST 2013 WEB-INF/
0 Sat May 11 19:20:28 CEST 2013 WEB-INF/classes/
0 Sat May 11 19:20:28 CEST 2013 WEB-INF/classes/dave/
361 Sat May 11 13:43:00 CEST 2013 index.jsp
269 Thu May 09 23:06:38 CEST 2013 WEB-INF/beans.xml
1443 Sat May 11 19:20:24 CEST 2013 WEB-INF/classes/dave/TestServlet.class
0 Sat May 11 19:20:28 CEST 2013 META-INF/maven/
0 Sat May 11 19:20:28 CEST 2013 META-INF/maven/weld-web/
0 Sat May 11 19:20:28 CEST 2013 META-INF/maven/weld-web/weld-web/
3073 Sat May 11 19:19:30 CEST 2013 META-INF/maven/weld-web/weld-web/pom.xml
109 Sat May 11 19:20:28 CEST 2013 META-INF/maven/weld-web/weld-web/pom.properties
utility jar content
[dave@dave testUtility]$ jar tvf target/testUtility-1.0-SNAPSHOT.jar
0 Sat May 11 19:34:58 CEST 2013 META-INF/
123 Sat May 11 19:34:56 CEST 2013 META-INF/MANIFEST.MF
0 Sat May 11 19:34:52 CEST 2013 dave/
269 Sat May 11 19:34:50 CEST 2013 META-INF/beans.xml
468 Sat May 11 19:34:52 CEST 2013 dave/ValueProducer.class
0 Sat May 11 19:34:58 CEST 2013 META-INF/maven/
0 Sat May 11 19:34:58 CEST 2013 META-INF/maven/testUtility/
0 Sat May 11 19:34:58 CEST 2013 META-INF/maven/testUtility/testUtility/
849 Sat May 11 18:46:42 CEST 2013 META-INF/maven/testUtility/testUtility/pom.xml
115 Sat May 11 19:34:56 CEST 2013 META-INF/maven/testUtility/testUtility/pom.properties
deploy project
mvn com.oracle.weblogic:weblogic-maven-plugin:^Cploy -Dadminurl=t3://localhost:7001 -Duser=weblogic -Dpassword=weblogic123 -Dtargets=AdminServer -Dsource=target/weld-ear-1.0-SNAPSHOT.ear -Dname=weld-ear
[dave@dave weld-ear]$ mvn com.oracle.weblogic:weblogic-maven-plugin:deploy -Dadminurl=t3://localhost:7001 -Duser=weblogic -Dpassword=weblogic123 -Dtargets=AdminServer -Dsource=target/weld-ear-1.0-SNAPSHOT.ear -Dname=weld-ear
/usr/java//jdk1.7.0_21
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building weld-ear 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- weblogic-maven-plugin:12.1.1.0:deploy (default-cli) @ weld-ear ---
weblogic.Deployer invoked with options: -noexit -adminurl t3://localhost:7001 -user weblogic -deploy -name weld-ear -source target/weld-ear-1.0-SNAPSHOT.ear -targets AdminServer
<May 11, 2013 7:36:28 PM CEST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating deploy operation for application, weld-ear [archive: /home/dave/workspace/weld-ear/target/weld-ear-1.0-SNAPSHOT.ear], to AdminServer .>
Task 10 initiated: [Deployer:149026]deploy application weld-ear on AdminServer.
Task 10 completed: [Deployer:149026]deploy application weld-ear on AdminServer.
Target state: deploy completed on Server AdminServer
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.317s
[INFO] Finished at: Sat May 11 19:36:30 CEST 2013
[INFO] Final Memory: 5M/15M
[INFO] ------------------------------------------------------------------------
Test application at http://localhost:7001/weld-web/TestServlet
After three days searching, we found that the project only worked if deployed through the weblogic console, if we deployed through oracle plugin in eclipse it wont work.
ReplyDeleteSo, if you are using eclipse, in the "servers" view, right click weblogic server, click "Properties -> Weblogic -> Publishing", change the radio "Pubish as a virtual application" to "Publish as exploded archive"