Monday, January 18, 2016

Using Maven to create EJB project on Weblogic 12.2.1

First setup Maven for Oracle Weblogic plugin - http://danielveselka.blogspot.com/2016/01/using-maven-on-weblogic-1221-with-java.html 

Building Java EE Projects for WebLogic Server with Maven

http://docs.oracle.com/middleware/1221/core/MAVEN/weblogic_maven.htm#MAVEN8803

Create project from archetype
[dave@localhost weblogic]$ mvn archetype:generate -DarchetypeGroupId=com.oracle.weblogic.archetype -DarchetypeArtifactId=basic-webapp-ejb -DarchetypeVersion=12.2.1-0-0 -DgroupId=dave -DartifactId=dave-basic-webapp-ejb-project -Dversion=1.0-SNAPSHOT

Generated code
https://github.com/dveselka/weblogic

[INFO] Generating project in Interactive mode
[INFO] Archetype repository missing. Using the one from [com.oracle.weblogic.archetype:basic-webapp-ejb:12.2.1-0-0] found in catalog local
[INFO] Using property: groupId = dave
[INFO] Using property: artifactId = dave-basic-webapp-ejb-project
[INFO] Using property: version = 1.0-SNAPSHOT
[INFO] Using property: package = dave
Confirm properties configuration:
groupId: dave
artifactId: dave-basic-webapp-ejb-project
version: 1.0-SNAPSHOT
package: dave
 Y: : 
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Archetype: basic-webapp-ejb:12.2.1-0-0
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: dave
[INFO] Parameter: artifactId, Value: dave-basic-webapp-ejb-project
[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: dave
[INFO] Parameter: artifactId, Value: dave-basic-webapp-ejb-project
[INFO] project created from Archetype in dir: /home/dave/git/weblogic/dave-basic-webapp-ejb-project



[dave@localhost weblogic]$ find
.
./dave-basic-webapp-ejb-project
./dave-basic-webapp-ejb-project/pom.xml
./dave-basic-webapp-ejb-project/src
./dave-basic-webapp-ejb-project/src/main
./dave-basic-webapp-ejb-project/src/main/webapp
./dave-basic-webapp-ejb-project/src/main/webapp/css
./dave-basic-webapp-ejb-project/src/main/webapp/css/bootstrap.css
./dave-basic-webapp-ejb-project/src/main/webapp/index.xhtml
./dave-basic-webapp-ejb-project/src/main/webapp/WEB-INF
./dave-basic-webapp-ejb-project/src/main/webapp/WEB-INF/web.xml
./dave-basic-webapp-ejb-project/src/main/webapp/WEB-INF/beans.xml
./dave-basic-webapp-ejb-project/src/main/webapp/template.xhtml
./dave-basic-webapp-ejb-project/src/main/resources
./dave-basic-webapp-ejb-project/src/main/resources/META-INF
./dave-basic-webapp-ejb-project/src/main/resources/META-INF/persistence.xml
./dave-basic-webapp-ejb-project/src/main/java
./dave-basic-webapp-ejb-project/src/main/java/dave
./dave-basic-webapp-ejb-project/src/main/java/dave/entity
./dave-basic-webapp-ejb-project/src/main/java/dave/entity/Account.java
./dave-basic-webapp-ejb-project/src/main/java/dave/service
./dave-basic-webapp-ejb-project/src/main/java/dave/service/AccountManagerImpl.java
./dave-basic-webapp-ejb-project/src/main/java/dave/service/AccountManager.java
./dave-basic-webapp-ejb-project/src/main/java/dave/service/AccountBean.java
./dave-basic-webapp-ejb-project/src/main/java/dave/interceptor
./dave-basic-webapp-ejb-project/src/main/java/dave/interceptor/OnDeposit.java
./dave-basic-webapp-ejb-project/src/main/java/dave/interceptor/LogInterceptor.java
./dave-basic-webapp-ejb-project/src/main/scripts
./dave-basic-webapp-project
./dave-basic-webapp-project/pom.xml
./dave-basic-webapp-project/src
./dave-basic-webapp-project/src/main
./dave-basic-webapp-project/src/main/webapp
./dave-basic-webapp-project/src/main/webapp/css
./dave-basic-webapp-project/src/main/webapp/css/bootstrap.css
./dave-basic-webapp-project/src/main/webapp/index.xhtml
./dave-basic-webapp-project/src/main/webapp/WEB-INF
./dave-basic-webapp-project/src/main/webapp/WEB-INF/web.xml
./dave-basic-webapp-project/src/main/webapp/WEB-INF/beans.xml
./dave-basic-webapp-project/src/main/webapp/template.xhtml
./dave-basic-webapp-project/src/main/java
./dave-basic-webapp-project/src/main/java/dave
./dave-basic-webapp-project/src/main/java/dave/AccountBean.java

Code generated from Maven archetype is here https://bitbucket.org/daniel_veselka/weblogic

Start Weblogic console using http://localhost:7001/console/

Check what is the Context Root in Deployments section:  /basicWebappEjb

Connect to application using http://localhost:7001/basicWebappEjb/

3 comments:

  1. Hi ,

    Can you please share the code facing issues in downloading.

    ReplyDelete
  2. Code generated from Maven archetype is here https://bitbucket.org/daniel_veselka/weblogic

    ReplyDelete
  3. Hi Daniel, your post helped a lot! Everything worked well, but when I added the primefaces (5.3/6.0) dependency I got the "java.lang.ClassNotFoundException: org.atmosphere.cpr.AsyncSupportListener" Do you know what is happening? I've opened a question on this link: http://stackoverflow.com/questions/38596938/weblogic-server-12-2-1-0-0-primefaces-issue

    Please, help me!

    ReplyDelete