Quantcast
Channel: DevOps tips & tricks
Viewing all 181 articles
Browse latest View live

Maven JPA project with alternative JPA provider - persistence-eclipselink.xml and persiste-hibernate.xml

$
0
0
We want to provide alternative persistence.xml files to test alternative JPA providers in same project
persistence-eclipselink.xml and persiste-hibernate.xml will be created

Use Maven archetype JPA project  for start
http://www.mastertheboss.com/maven-hibernate-jpa/maven-and-jpa-tutorial


Create project from archetype

[dave@dave workspace]$ mvn archetype:generate -DarchetypeGroupId=com.github.lalyos -DarchetypeArtifactId=standalone-jpa-eclipselink-archetype -DgroupId=com.mastertheboss -DartifactId=EclipseJPAExample -Dversion=1.0-SNAPSHOT -Dpackage=com.mastertheboss -DinteractiveMode=false
/usr/java//jdk1.7.0_13
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom >>>
[INFO]
[INFO] <<< maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom <<<
[INFO]
[INFO] --- maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom ---
[INFO] Generating project in Batch mode
[INFO] Archetype [com.github.lalyos:standalone-jpa-eclipselink-archetype:0.0.2] found in catalog remote
Downloading: http://repo.maven.apache.org/maven2/com/github/lalyos/standalone-jpa-eclipselink-archetype/0.0.2/standalone-jpa-eclipselink-archetype-0.0.2.jar
Downloaded: http://repo.maven.apache.org/maven2/com/github/lalyos/standalone-jpa-eclipselink-archetype/0.0.2/standalone-jpa-eclipselink-archetype-0.0.2.jar (5 KB at 6.0 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/com/github/lalyos/standalone-jpa-eclipselink-archetype/0.0.2/standalone-jpa-eclipselink-archetype-0.0.2.pom
Downloaded: http://repo.maven.apache.org/maven2/com/github/lalyos/standalone-jpa-eclipselink-archetype/0.0.2/standalone-jpa-eclipselink-archetype-0.0.2.pom (3 KB at 4.0 KB/sec)
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Archetype: standalone-jpa-eclipselink-archetype:0.0.2
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: com.mastertheboss
[INFO] Parameter: artifactId, Value: EclipseJPAExample
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: package, Value: com.mastertheboss
[INFO] Parameter: packageInPathFormat, Value: com/mastertheboss
[INFO] Parameter: package, Value: com.mastertheboss
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: groupId, Value: com.mastertheboss
[INFO] Parameter: artifactId, Value: EclipseJPAExample
[INFO] project created from Archetype in dir: /home/dave/workspace/EclipseJPAExample
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.438s
[INFO] Finished at: Sat Mar 30 07:52:16 CET 2013
[INFO] Final Memory: 8M/21M
[INFO] ------------------------------------------------------------------------


Files in created project

[dave@dave workspace]$ ls -lR  EclipseJPAExample/
EclipseJPAExample/:
total 20
-rw-rw-r--. 1 dave dave 70 Mar 30 07:52 ij.properties
-rw-rw-r--. 1 dave dave 1206 Mar 30 07:52 pom.xml
-rw-rw-r--. 1 dave dave 69 Mar 30 07:52 run.sh
-rw-rw-r--. 1 dave dave 107 Mar 30 07:52 show-derby.sh
drwxrwxr-x. 3 dave dave 4096 Mar 30 07:52 src

EclipseJPAExample/src:
total 4
drwxrwxr-x. 4 dave dave 4096 Mar 30 07:52 main

EclipseJPAExample/src/main:
total 8
drwxrwxr-x. 3 dave dave 4096 Mar 30 07:52 java
drwxrwxr-x. 3 dave dave 4096 Mar 30 07:52 resources

EclipseJPAExample/src/main/java:
total 4
drwxrwxr-x. 3 dave dave 4096 Mar 30 07:52 com

EclipseJPAExample/src/main/java/com:
total 4
drwxrwxr-x. 4 dave dave 4096 Mar 30 07:52 mastertheboss

EclipseJPAExample/src/main/java/com/mastertheboss:
total 8
drwxrwxr-x. 2 dave dave 4096 Mar 30 07:52 domain
drwxrwxr-x. 2 dave dave 4096 Mar 30 07:52 jpa

EclipseJPAExample/src/main/java/com/mastertheboss/domain:
total 8
-rw-rw-r--. 1 dave dave 937 Mar 30 07:52 Department.java
-rw-rw-r--. 1 dave dave 1001 Mar 30 07:52 Employee.java

EclipseJPAExample/src/main/java/com/mastertheboss/jpa:
total 4
-rw-rw-r--. 1 dave dave 1624 Mar 30 07:52 JpaTest.java

EclipseJPAExample/src/main/resources:
total 4
drwxrwxr-x. 2 dave dave 4096 Mar 30 07:52 META-INF

EclipseJPAExample/src/main/resources/META-INF:
total 4
-rw-rw-r--. 1 dave dave 1229 Mar 30 07:52 persistence.xml
[dave@dave workspace]$


Run project with EclipseLink

[dave@dave EclipseJPAExample]$ mvn compile exec:java -Dexec.mainClass=com.mastertheboss.jpa.JpaTest
/usr/java//jdk1.7.0_13
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building EclipseJPAExample 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ EclipseJPAExample ---
[debug] execute contextualize
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ EclipseJPAExample ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] >>> exec-maven-plugin:1.2.1:java (default-cli) @ EclipseJPAExample >>>
[INFO]
[INFO] <<< exec-maven-plugin:1.2.1:java (default-cli) @ EclipseJPAExample <<<
[INFO]
[INFO] --- exec-maven-plugin:1.2.1:java (default-cli) @ EclipseJPAExample ---
[EL Finest]: 2013-03-30 08:06:21.895--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--Begin predeploying Persistence Unit persistenceUnit; session file:/home/dave/workspace/EclipseJPAExample/target/classes/_persistenceUnit; state Initial; factoryCount 0
[EL Finest]: 2013-03-30 08:06:21.92--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--property=eclipselink.orm.throw.exceptions; default value=true
[EL Finest]: 2013-03-30 08:06:21.956--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--property=eclipselink.jpa.uppercase-column-names; default value=false
[EL Finer]: 2013-03-30 08:06:21.957--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--Searching for default mapping file in file:/home/dave/workspace/EclipseJPAExample/target/classes/
[EL Finer]: 2013-03-30 08:06:21.961--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--Searching for default mapping file in file:/home/dave/workspace/EclipseJPAExample/target/classes/
[EL Config]: 2013-03-30 08:06:22.164--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--The access type for the persistent class [class com.mastertheboss.domain.Employee] is set to [FIELD].
[EL Config]: 2013-03-30 08:06:22.235--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--The target entity (reference) class for the many to one mapping element [field department] is being defaulted to: class com.mastertheboss.domain.Department.
[EL Config]: 2013-03-30 08:06:22.238--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--The access type for the persistent class [class com.mastertheboss.domain.Department] is set to [FIELD].
[EL Config]: 2013-03-30 08:06:22.26--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--The target entity (reference) class for the one to many mapping element [field employees] is being defaulted to: class com.mastertheboss.domain.Employee.
[EL Config]: 2013-03-30 08:06:22.261--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--The alias name for the entity class [class com.mastertheboss.domain.Employee] is being defaulted to: Employee.
[EL Config]: 2013-03-30 08:06:22.266--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--The table name for entity [class com.mastertheboss.domain.Employee] is being defaulted to: EMPLOYEE.
[EL Config]: 2013-03-30 08:06:22.298--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--The column name for element [field id] is being defaulted to: ID.
[EL Config]: 2013-03-30 08:06:22.301--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--The column name for element [field name] is being defaulted to: NAME.
[EL Config]: 2013-03-30 08:06:22.303--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--The alias name for the entity class [class com.mastertheboss.domain.Department] is being defaulted to: Department.
[EL Config]: 2013-03-30 08:06:22.304--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--The table name for entity [class com.mastertheboss.domain.Department] is being defaulted to: DEPARTMENT.
[EL Config]: 2013-03-30 08:06:22.309--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--The column name for element [field id] is being defaulted to: ID.
[EL Config]: 2013-03-30 08:06:22.31--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--The column name for element [field name] is being defaulted to: NAME.
[EL Config]: 2013-03-30 08:06:22.364--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--The primary key column name for the mapping element [field department] is being defaulted to: ID.
[EL Config]: 2013-03-30 08:06:22.365--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--The foreign key column name for the mapping element [field department] is being defaulted to: DEPARTMENT_ID.
[EL Finest]: 2013-03-30 08:06:22.418--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--End predeploying Persistence Unit persistenceUnit; session file:/home/dave/workspace/EclipseJPAExample/target/classes/_persistenceUnit; state Predeployed; factoryCount 0
[EL Finer]: 2013-03-30 08:06:22.419--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--JavaSECMPInitializer - transformer is null.
[EL Finest]: 2013-03-30 08:06:22.419--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--Begin predeploying Persistence Unit persistenceUnit; session file:/home/dave/workspace/EclipseJPAExample/target/classes/_persistenceUnit; state Predeployed; factoryCount 0
[EL Finest]: 2013-03-30 08:06:22.419--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--End predeploying Persistence Unit persistenceUnit; session file:/home/dave/workspace/EclipseJPAExample/target/classes/_persistenceUnit; state Predeployed; factoryCount 1
[EL Finest]: 2013-03-30 08:06:22.425--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--Begin deploying Persistence Unit persistenceUnit; session file:/home/dave/workspace/EclipseJPAExample/target/classes/_persistenceUnit; state Predeployed; factoryCount 1
[EL Finer]: 2013-03-30 08:06:22.454--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--Could not initialize Validation Factory. Encountered following exception: java.lang.NoClassDefFoundError: javax/validation/Validation
[EL Finest]: 2013-03-30 08:06:22.467--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--property=eclipselink.logging.level; value=FINEST; translated value=FINEST
[EL Finest]: 2013-03-30 08:06:22.467--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--property=eclipselink.logging.level; value=FINEST; translated value=FINEST
[EL Finest]: 2013-03-30 08:06:22.468--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--property=javax.persistence.jdbc.user; value=EclipseJPAExample
[EL Finest]: 2013-03-30 08:06:22.468--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--property=javax.persistence.jdbc.password; value=xxxxxx
[EL Finest]: 2013-03-30 08:06:23.403--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--property=javax.persistence.jdbc.driver; value=org.apache.derby.jdbc.EmbeddedDriver
[EL Finest]: 2013-03-30 08:06:23.403--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--property=javax.persistence.jdbc.url; value=jdbc:derby:simpleDb;create=true
[EL Info]: 2013-03-30 08:06:23.404--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--EclipseLink, version: Eclipse Persistence Services - 2.2.1.v20110722-r9776
[EL Finest]: 2013-03-30 08:06:26.359--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--DBPlatform: org.eclipse.persistence.platform.database.HSQLPlatform, RegularExpression: (?i)hsql.*.
[EL Finest]: 2013-03-30 08:06:26.359--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--DBPlatform: org.eclipse.persistence.platform.database.InformixPlatform, RegularExpression: (?i)informix.*.
[EL Finest]: 2013-03-30 08:06:26.359--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--DBPlatform: org.eclipse.persistence.platform.database.PointBasePlatform, RegularExpression: (?i)pointbase.*.
[EL Finest]: 2013-03-30 08:06:26.36--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--DBPlatform: org.eclipse.persistence.platform.database.DB2Platform, RegularExpression: (?i).*db2.*.
[EL Finest]: 2013-03-30 08:06:26.36--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--DBPlatform: org.eclipse.persistence.platform.database.SQLServerPlatform, RegularExpression: (?i)microsoft.*.
[EL Finest]: 2013-03-30 08:06:26.36--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--DBPlatform: org.eclipse.persistence.platform.database.PostgreSQLPlatform, RegularExpression: (?i)postgresql.*.
[EL Finest]: 2013-03-30 08:06:26.36--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--DBPlatform: org.eclipse.persistence.platform.database.MaxDBPlatform, RegularExpression: SAP DB.
[EL Finest]: 2013-03-30 08:06:26.36--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--DBPlatform: org.eclipse.persistence.platform.database.H2Platform, RegularExpression: (?i)h2.*.
[EL Finest]: 2013-03-30 08:06:26.361--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--DBPlatform: org.eclipse.persistence.platform.database.SybasePlatform, RegularExpression: (?i)(sybase.*)|(adaptive server enterprise.*)|(SQL Server).
[EL Finest]: 2013-03-30 08:06:26.361--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--DBPlatform: org.eclipse.persistence.platform.database.FirebirdPlatform, RegularExpression: (?i)firebird.*.
[EL Finest]: 2013-03-30 08:06:26.361--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--DBPlatform: org.eclipse.persistence.platform.database.JavaDBPlatform, RegularExpression: (?i).*derby.
[EL Fine]: 2013-03-30 08:06:26.361--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--Detected Vendor platform: org.eclipse.persistence.platform.database.JavaDBPlatform
[EL Config]: 2013-03-30 08:06:26.387--ServerSession(18985176)--Connection(30138829)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--connecting(DatabaseLogin(
platform=>JavaDBPlatform
user name=> "EclipseJPAExample"
datasource URL=> "jdbc:derby:simpleDb;create=true"
))
[EL Config]: 2013-03-30 08:06:26.394--ServerSession(18985176)--Connection(5592751)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--Connected: jdbc:derby:simpleDb
User: EclipseJPAExample
Database: Apache Derby Version: 10.8.2.2 - (1181258)
Driver: Apache Derby Embedded JDBC Driver Version: 10.8.2.2 - (1181258)
[EL Finest]: 2013-03-30 08:06:26.395--ServerSession(18985176)--Connection(5592751)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--Connection acquired from connection pool [default].
[EL Finest]: 2013-03-30 08:06:26.395--ServerSession(18985176)--Connection(5592751)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--Connection released to connection pool [default].
[EL Finest]: 2013-03-30 08:06:26.428--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--sequencing connected, state is Preallocation_Transaction_NoAccessor_State
[EL Finest]: 2013-03-30 08:06:26.428--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--sequence SEQUENCE: preallocation size 50
[EL Finest]: 2013-03-30 08:06:26.428--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--sequence SEQ_GEN: preallocation size 50
[EL Info]: 2013-03-30 08:06:26.517--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--file:/home/dave/workspace/EclipseJPAExample/target/classes/_persistenceUnit login successful
[EL Finest]: 2013-03-30 08:06:26.555--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--Execute query DataModifyQuery(sql="CREATE TABLE EMPLOYEE (ID BIGINT NOT NULL, NAME VARCHAR(255), DEPARTMENT_ID BIGINT, PRIMARY KEY (ID))")
[EL Finest]: 2013-03-30 08:06:26.557--ServerSession(18985176)--Connection(5592751)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--Connection acquired from connection pool [default].
[EL Fine]: 2013-03-30 08:06:26.557--ServerSession(18985176)--Connection(5592751)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--CREATE TABLE EMPLOYEE (ID BIGINT NOT NULL, NAME VARCHAR(255), DEPARTMENT_ID BIGINT, PRIMARY KEY (ID))
[EL Fine]: 2013-03-30 08:06:27.223--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--VALUES(1)
[EL Finest]: 2013-03-30 08:06:27.366--ServerSession(18985176)--Connection(5592751)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--Connection released to connection pool [default].
[EL Warning]: 2013-03-30 08:06:27.367--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.2.1.v20110722-r9776): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Table/View 'EMPLOYEE' already exists in Schema 'ECLIPSEJPAEXAMPLE'.
Error Code: 30000
Call: CREATE TABLE EMPLOYEE (ID BIGINT NOT NULL, NAME VARCHAR(255), DEPARTMENT_ID BIGINT, PRIMARY KEY (ID))
Query: DataModifyQuery(sql="CREATE TABLE EMPLOYEE (ID BIGINT NOT NULL, NAME VARCHAR(255), DEPARTMENT_ID BIGINT, PRIMARY KEY (ID))")
[EL Finest]: 2013-03-30 08:06:27.369--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--The table (EMPLOYEE) is already in the database, and wont be created.
[EL Finest]: 2013-03-30 08:06:27.37--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--Execute query DataModifyQuery(sql="CREATE TABLE DEPARTMENT (ID BIGINT NOT NULL, NAME VARCHAR(255), PRIMARY KEY (ID))")
[EL Finest]: 2013-03-30 08:06:27.37--ServerSession(18985176)--Connection(5592751)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--Connection acquired from connection pool [default].
[EL Fine]: 2013-03-30 08:06:27.37--ServerSession(18985176)--Connection(5592751)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--CREATE TABLE DEPARTMENT (ID BIGINT NOT NULL, NAME VARCHAR(255), PRIMARY KEY (ID))
[EL Fine]: 2013-03-30 08:06:27.587--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--VALUES(1)
[EL Finest]: 2013-03-30 08:06:27.588--ServerSession(18985176)--Connection(5592751)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--Connection released to connection pool [default].
[EL Warning]: 2013-03-30 08:06:27.588--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.2.1.v20110722-r9776): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Table/View 'DEPARTMENT' already exists in Schema 'ECLIPSEJPAEXAMPLE'.
Error Code: 30000
Call: CREATE TABLE DEPARTMENT (ID BIGINT NOT NULL, NAME VARCHAR(255), PRIMARY KEY (ID))
Query: DataModifyQuery(sql="CREATE TABLE DEPARTMENT (ID BIGINT NOT NULL, NAME VARCHAR(255), PRIMARY KEY (ID))")
[EL Finest]: 2013-03-30 08:06:27.589--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--The table (DEPARTMENT) is already in the database, and wont be created.
[EL Finest]: 2013-03-30 08:06:27.59--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--Execute query DataModifyQuery(sql="ALTER TABLE EMPLOYEE ADD CONSTRAINT MPLOYEEDPARTMENTID FOREIGN KEY (DEPARTMENT_ID) REFERENCES DEPARTMENT (ID)")
[EL Finest]: 2013-03-30 08:06:27.59--ServerSession(18985176)--Connection(5592751)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--Connection acquired from connection pool [default].
[EL Fine]: 2013-03-30 08:06:27.59--ServerSession(18985176)--Connection(5592751)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--ALTER TABLE EMPLOYEE ADD CONSTRAINT MPLOYEEDPARTMENTID FOREIGN KEY (DEPARTMENT_ID) REFERENCES DEPARTMENT (ID)
[EL Fine]: 2013-03-30 08:06:27.709--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--VALUES(1)
[EL Finest]: 2013-03-30 08:06:27.711--ServerSession(18985176)--Connection(5592751)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--Connection released to connection pool [default].
[EL Warning]: 2013-03-30 08:06:27.711--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.2.1.v20110722-r9776): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Constraint 'MPLOYEEDPARTMENTID' already exists in Schema 'ECLIPSEJPAEXAMPLE'.
Error Code: 30000
Call: ALTER TABLE EMPLOYEE ADD CONSTRAINT MPLOYEEDPARTMENTID FOREIGN KEY (DEPARTMENT_ID) REFERENCES DEPARTMENT (ID)
Query: DataModifyQuery(sql="ALTER TABLE EMPLOYEE ADD CONSTRAINT MPLOYEEDPARTMENTID FOREIGN KEY (DEPARTMENT_ID) REFERENCES DEPARTMENT (ID)")
[EL Finest]: 2013-03-30 08:06:27.713--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--Execute query DataModifyQuery(sql="CREATE TABLE SEQUENCE (SEQ_NAME VARCHAR(50) NOT NULL, SEQ_COUNT DECIMAL(15), PRIMARY KEY (SEQ_NAME))")
[EL Finest]: 2013-03-30 08:06:27.714--ServerSession(18985176)--Connection(5592751)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--Connection acquired from connection pool [default].
[EL Fine]: 2013-03-30 08:06:27.714--ServerSession(18985176)--Connection(5592751)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--CREATE TABLE SEQUENCE (SEQ_NAME VARCHAR(50) NOT NULL, SEQ_COUNT DECIMAL(15), PRIMARY KEY (SEQ_NAME))
[EL Fine]: 2013-03-30 08:06:27.853--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--VALUES(1)
[EL Finest]: 2013-03-30 08:06:27.854--ServerSession(18985176)--Connection(5592751)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--Connection released to connection pool [default].
[EL Warning]: 2013-03-30 08:06:27.855--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.2.1.v20110722-r9776): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Table/View 'SEQUENCE' already exists in Schema 'ECLIPSEJPAEXAMPLE'.
Error Code: 30000
Call: CREATE TABLE SEQUENCE (SEQ_NAME VARCHAR(50) NOT NULL, SEQ_COUNT DECIMAL(15), PRIMARY KEY (SEQ_NAME))
Query: DataModifyQuery(sql="CREATE TABLE SEQUENCE (SEQ_NAME VARCHAR(50) NOT NULL, SEQ_COUNT DECIMAL(15), PRIMARY KEY (SEQ_NAME))")
[EL Finest]: 2013-03-30 08:06:27.856--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--Execute query DataReadQuery(sql="SELECT * FROM SEQUENCE WHERE SEQ_NAME = 'SEQ_GEN'")
[EL Finest]: 2013-03-30 08:06:27.857--ServerSession(18985176)--Connection(5592751)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--Connection acquired from connection pool [default].
[EL Fine]: 2013-03-30 08:06:27.857--ServerSession(18985176)--Connection(5592751)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--SELECT * FROM SEQUENCE WHERE SEQ_NAME = SEQ_GEN
[EL Finest]: 2013-03-30 08:06:27.933--ServerSession(18985176)--Connection(5592751)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--Connection released to connection pool [default].
[EL Finer]: 2013-03-30 08:06:27.96--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--Canonical Metamodel class [com.mastertheboss.domain.Department_] not found during initialization.
[EL Finer]: 2013-03-30 08:06:27.96--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--Canonical Metamodel class [com.mastertheboss.domain.Employee_] not found during initialization.
[EL Finest]: 2013-03-30 08:06:27.96--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--End deploying Persistence Unit persistenceUnit; session file:/home/dave/workspace/EclipseJPAExample/target/classes/_persistenceUnit; state Deployed; factoryCount 1
[EL Finer]: 2013-03-30 08:06:27.991--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--client acquired: 7982406
[EL Finer]: 2013-03-30 08:06:28.031--ClientSession(7982406)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--acquire unit of work: 13165575
[EL Finer]: 2013-03-30 08:06:28.565--UnitOfWork(13165575)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--begin unit of work flush
[EL Finer]: 2013-03-30 08:06:28.568--UnitOfWork(13165575)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--end unit of work flush
[EL Finest]: 2013-03-30 08:06:28.568--UnitOfWork(13165575)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--Execute query ReadAllQuery(referenceClass=Employee sql="SELECT ID, NAME, DEPARTMENT_ID FROM EMPLOYEE")
[EL Finest]: 2013-03-30 08:06:28.571--ServerSession(18985176)--Connection(5592751)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--Connection acquired from connection pool [default].
[EL Fine]: 2013-03-30 08:06:28.571--ServerSession(18985176)--Connection(5592751)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--SELECT ID, NAME, DEPARTMENT_ID FROM EMPLOYEE
[EL Finest]: 2013-03-30 08:06:28.584--ServerSession(18985176)--Connection(5592751)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--Connection released to connection pool [default].
[EL Finest]: 2013-03-30 08:06:28.593--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--Execute query ReadObjectQuery(name="department" referenceClass=Department )
[EL Finest]: 2013-03-30 08:06:28.594--ServerSession(18985176)--Connection(5592751)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--Connection acquired from connection pool [default].
[EL Fine]: 2013-03-30 08:06:28.594--ServerSession(18985176)--Connection(5592751)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--SELECT ID, NAME FROM DEPARTMENT WHERE (ID = ?)
bind => [1]
[EL Finest]: 2013-03-30 08:06:28.613--ServerSession(18985176)--Connection(5592751)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--Connection released to connection pool [default].
[EL Finest]: 2013-03-30 08:06:28.62--UnitOfWork(13165575)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--Register the existing object com.mastertheboss.domain.Department@94fb9d
[EL Finest]: 2013-03-30 08:06:28.623--ServerSession(18985176)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--Execute query ReadObjectQuery(name="department" referenceClass=Department )
[EL Finest]: 2013-03-30 08:06:28.623--UnitOfWork(13165575)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--Register the existing object com.mastertheboss.domain.Department@94fb9d
[EL Finer]: 2013-03-30 08:06:28.624--UnitOfWork(13165575)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--begin unit of work commit
[EL Finer]: 2013-03-30 08:06:28.627--UnitOfWork(13165575)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--end unit of work commit
[EL Finer]: 2013-03-30 08:06:28.627--UnitOfWork(13165575)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--resume unit of work
[EL Finest]: 2013-03-30 08:06:28.628--UnitOfWork(13165575)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--Execute query ReadAllQuery(referenceClass=Employee sql="SELECT ID, NAME, DEPARTMENT_ID FROM EMPLOYEE")
[EL Finest]: 2013-03-30 08:06:28.628--ServerSession(18985176)--Connection(5592751)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--Connection acquired from connection pool [default].
[EL Fine]: 2013-03-30 08:06:28.628--ServerSession(18985176)--Connection(5592751)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--SELECT ID, NAME, DEPARTMENT_ID FROM EMPLOYEE
[EL Finest]: 2013-03-30 08:06:28.629--ServerSession(18985176)--Connection(5592751)--Thread(Thread[com.mastertheboss.jpa.JpaTest.main(),5,com.mastertheboss.jpa.JpaTest])--Connection released to connection pool [default].
num of employess:2
next employee: Employee [id=3, name=Captain Nemo, department=java]
next employee: Employee [id=2, name=Jakab Gipsz, department=java]
.. done
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.653s
[INFO] Finished at: Sat Mar 30 08:06:28 CET 2013
[INFO] Final Memory: 20M/48M
[INFO] ------------------------------------------------------------------------
[dave@dave EclipseJPAExample]$


Add hibernate dependency

<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <groupId>com.mastertheboss</groupId>
        <artifactId>EclipseJPAExample</artifactId>
        <version>1.0-SNAPSHOT</version>
        <repositories>
                <repository>
                        <id>EclipseLink Repo</id>
                        <url>http://download.eclipse.org/rt/eclipselink/maven.repo</url>
                        <name>EclipseLink Repo</name>
                </repository>
        </repositories>
        <dependencies>
                <dependency>
                        <groupId>org.apache.derby</groupId>
                  
     <artifactId>derby</artifactId>
                        <version>10.8.2.2</version>
                </dependency>
                <dependency>
                        <groupId>org.apache.derby</groupId>
                        <artifactId>derbytools</artifactId>
                        <version>10.8.2.2</version>
                </dependency>
                <dependency>
                        <groupId>org.eclipse.persistence</groupId>
                        <artifactId>eclipselink</artifactId>
                        <version>2.2.1</version>
                </dependency>
                <dependency>
                        <groupId>org.eclipse.persistence</groupId>
                        <artifactId>javax.persistence</artifactId>
                        <version>2.0.3</version>
                </dependency>
                <dependency>
                        <groupId>org.hibernate.javax.persistence</groupId>
                        <artifactId>hibernate-jpa-2.0-api</artifactId>
                        <version>1.0.1.Final</version>
                </dependency>
                <dependency>
                        <groupId>org.hibernate</groupId>
                        <artifactId>hibernate-entitymanager</artifactId>
                        <version>4.0.1.Final</version>
                </dependency>
        </dependencies>
</project>


Add profiles for alternative JPA providers
Inspired by Geronimo tests - use profiles for alternative JPA providers
http://svn.apache.org/repos/asf/geronimo/samples/tags/samples-parent-3.0-beta-1/samples/javaee6/jpa20demo-javaee6/jpa20demo-javaee6-war/
<profiles>
<profile>
<id>openjpa</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>process-resources</phase>
<id>rename-persistence-file</id>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo>Rename persistence-openjpa.xml to persistence.xml</echo>
<copy file="${basedir}/src/main/resources/META-INF/persistence_openjpa.xml" tofile="${project.build.directory}/${pom.artifactId}-${version}/WEB-INF/classes/META-INF/persistence.xml" overwrite="true" />
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>hibernate</id>
<activation>
<activeByDefault>false</activeByDefault>
<property>
<name>JPAProvider</name>
<value>hibernate</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>process-resources</phase>
<id>rename-persistence-file</id>
<goals>
<goal>run</goal>
</goals>
<configuration>
nfiguration>
<tasks>
<echo>Rename persistence-hibernate.xml to persistence.xml</echo>
<copy file="${basedir}/src/main/resources/META-INF/persistence_hibernate.xml" tofile="${project.build.directory}/${pom.artifactId}-${version}/WEB-INF/classes/META-INF/persistence.xml" overwrite="true" />
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>eclipselink</id>
<activation>
<activeByDefault>false</activeByDefault>
<property>
<name>JPAProvider</name>
<value>eclipselink</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>process-resources</phase>
<id>rename-persistence-file</id>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo>Rename persistence-eclipselink.xml to persistence.xml</echo>
<copy file="${basedir}/src/main/resources/META-INF/persistence_eclipselink.xml" tofile="${project.build.directory}/${pom.artifactId}-${version}/WEB-INF/classes/META-INF/persistence.xml" overwrite="true" />
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>




Maven dependency list

[dave@dave EclipseJPAExample]$ mvn dependency::list
/usr/java//jdk1.7.0_13
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building EclipseJPAExample 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.1:list (default-cli) @ EclipseJPAExample ---
[INFO]
[INFO] The following files have been resolved:
[INFO] antlr:antlr:jar:2.7.7:compile
[INFO] commons-collections:commons-collections:jar:3.2.1:compile
[INFO] dom4j:dom4j:jar:1.6.1:compile
[INFO] org.apache.derby:derby:jar:10.8.2.2:compile
[INFO] org.apache.derby:derbytools:jar:10.8.2.2:compile
[INFO] org.eclipse.persistence:eclipselink:jar:2.2.1:compile
[INFO] org.eclipse.persistence:javax.persistence:jar:2.0.3:compile
[INFO] org.hibernate:hibernate-core:jar:4.0.1.Final:compile
[INFO] org.hibernate:hibernate-entitymanager:jar:4.0.1.Final:compile
[INFO] org.hibernate.common:hibernate-commons-annotations:jar:4.0.1.Final:compile
[INFO] org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.1.Final:compile
[INFO] org.javassist:javassist:jar:3.15.0-GA:compile
[INFO] org.jboss.logging:jboss-logging:jar:3.1.0.CR2:compile
[INFO] org.jboss.spec.javax.transaction:jboss-transaction-api_1.1_spec:jar:1.0.0.Final:compile
[INFO] xml-apis:xml-apis:jar:1.0.b2:compile
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.760s
[INFO] Finished at: Sat Mar 30 08:35:54 CET 2013
[INFO] Final Memory: 6M/15M
[INFO] ------------------------------------------------------------------------
[dave@dave EclipseJPAExample]$

Create alternative persistence.xml files
[dave@dave EclipseJPAExample]$ ls -l ./src/main/resources/META-INF
total 8
-rw-rw-r--. 1 dave dave 1230 Mar 30 08:06 persistence-eclipselink.xml
-rw-rw-r--. 1 dave dave 1067 Mar 30 08:19 persistence-hibernate.xml

[dave@dave EclipseJPAExample]$ more ./src/main/resources/META-INF/persistence-eclipselink.xml
<?xml version="1.0" encoding="UTF-8" ?>
<persistence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persiste
nce/persistence_2_0.xsd"
version="2.0" xmlns="http://java.sun.com/xml/ns/persistence">
<persistence-unit name="persistenceUnit" transaction-type="RESOURCE_LOCAL">
<!-- shouldn't be valid for java SE per specification, but it works for EclipseLink ..
. -->
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>

<property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.Em
beddedDriver" />
<property name="javax.persistence.jdbc.url" value="jdbc:derby:simpleDb;create=
true" />
<property name="javax.persistence.jdbc.user" value="EclipseJPAExample" />
<property name="javax.persistence.jdbc.password" value="EclipseJPAExample" />

<!-- EclipseLink should create the database schema automatically -->
<property name="eclipselink.ddl-generation" value="create-tables" />
<property name="eclipselink.ddl-generation.output-mode" value="database" />
<property name="eclipselink.logging.level" value="FINEST"/>
</properties>

</persistence-unit>
</persistence>

[dave@dave EclipseJPAExample]$ more ./src/main/resources/META-INF/persistence-hibernate.xml<?xml version="1.0" encoding="UTF-8" ?>
<persistence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/pers
istence_2_0.xsd"
version="2.0" xmlns="http://java.sun.com/xml/ns/persistence">
<persistence-unit name="persistenceUnit" transaction-type="RESOURCE_LOCAL">

<provider>org.hibernate.ejb.HibernatePersistence</provider>

<class>com.mastertheboss.domain.Employee</class>
<class>com.mastertheboss.domain.Department</class>
<properties>
<property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDri
ver" />
<property name="javax.persistence.jdbc.url" value="jdbc:derby:simpleDb;create=true" />
<property name="javax.persistence.jdbc.user" value="EclipseJPAExample" />
<property name="javax.persistence.jdbc.password" value="EclipseJPAExample" />


<property name="hbm2ddl.auto" value="create" />

<property name="hibernate.dialect" value="org.hibernate.dialect.DerbyDialect" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.format_sql" value="true" />
</properties>

</persistence-unit>
</persistence>

Run project with Hibernate as JPA provider
[dave@dave EclipseJPAExample]$ mvn compile exec:java -Dexec.mainClass=com.mastertheboss.jpa.JpaTest
/usr/java//jdk1.7.0_13
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building EclipseJPAExample 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ EclipseJPAExample ---
[debug] execute contextualize
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ EclipseJPAExample ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] >>> exec-maven-plugin:1.2.1:java (default-cli) @ EclipseJPAExample >>>
[INFO]
[INFO] <<< exec-maven-plugin:1.2.1:java (default-cli) @ EclipseJPAExample <<<
[INFO]
[INFO] --- exec-maven-plugin:1.2.1:java (default-cli) @ EclipseJPAExample ---
Mar 30, 2013 8:48:53 AM org.hibernate.annotations.common.Version <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
Mar 30, 2013 8:48:53 AM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.0.1.Final}
Mar 30, 2013 8:48:53 AM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
Mar 30, 2013 8:48:53 AM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
Mar 30, 2013 8:48:54 AM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000402: Using Hibernate built-in connection pool (not for production use!)
Mar 30, 2013 8:48:54 AM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000115: Hibernate connection pool size: 20
Mar 30, 2013 8:48:54 AM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000006: Autocommit mode: true
Mar 30, 2013 8:48:54 AM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000401: using driver [org.apache.derby.jdbc.EmbeddedDriver] at URL [jdbc:derby:simpleDb;create=true]
Mar 30, 2013 8:48:54 AM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000046: Connection properties: {user=EclipseJPAExample, password=****, autocommit=true, release_mode=auto}
Mar 30, 2013 8:48:56 AM org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.DerbyDialect
Mar 30, 2013 8:48:56 AM org.hibernate.dialect.DerbyDialect <init>
WARN: HHH000430: The DerbyDialect dialect has been deprecated; use one of the version-specific dialects instead
Mar 30, 2013 8:48:56 AM org.hibernate.engine.transaction.internal.TransactionFactoryInitiator initiateService
INFO: HHH000268: Transaction strategy: org.hibernate.engine.transaction.internal.jdbc.JdbcTransactionFactory
Mar 30, 2013 8:48:56 AM org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory <init>
INFO: HHH000397: Using ASTQueryTranslatorFactory
Hibernate:
select
employee0_.id as id0_,
employee0_.department_id as department3_0_,
employee0_.name as name0_
from
Employee employee0_
Hibernate:
select
department0_.id as id1_0_,
department0_.name as name1_0_
from
Department department0_
where
department0_.id=?
Hibernate:
select
employee0_.id as id0_,
employee0_.department_id as department3_0_,
employee0_.name as name0_
from
Employee employee0_
num of employess:2
next employee: Employee [id=3, name=Captain Nemo, department=java]
next employee: Employee [id=2, name=Jakab Gipsz, department=java]
.. done
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.995s
[INFO] Finished at: Sat Mar 30 08:48:57 CET 2013
[INFO] Final Memory: 10M/24M
[INFO] ------------------------------------------------------------------------
[dave@dave EclipseJPAExample]$

Add profiles for persistence providers into pom.xml
<profile>
<id>eclipselink</id>
<activation>
<activeByDefault>true</activeByDefault>
<property>
<name>JPAProvider</name>
<value>eclipselink</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>process-resources</phase>
<id>rename-persistence-file</id>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo>Rename persistence-eclipselink.xml to persistence.xml</echo>
<copy file="${basedir}/src/main/resources/META-INF/persistence-eclipselink.xml" tofile="${project.build.directory}/classes/META-INF/persistence.xml" overwrite="true" />
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>



When run with -Peclipselink or -Phibernate following action is triggered
[INFO] Executing tasks
[echo] Rename persistence-eclipselink.xml to persistence.xml
[copy] Copying 1 file to /home/dave/workspace/EclipseJPAExample/target/classes/META-INF


Dependencies can be optional based on profile
EclipseLink is set as active profile by default
This will allow to run alternative unit tests for different JPA providers

[dave@dave EclipseJPAExample]$ mvn dependency::list
/usr/java//jdk1.7.0_13
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building EclipseJPAExample 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.1:list (default-cli) @ EclipseJPAExample ---
[INFO]
[INFO] The following files have been resolved:
[INFO] org.apache.derby:derby:jar:10.8.2.2:compile
[INFO] org.apache.derby:derbytools:jar:10.8.2.2:compile
[INFO] org.eclipse.persistence:eclipselink:jar:2.2.1:compile
[INFO] org.eclipse.persistence:javax.persistence:jar:2.0.3:compile
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.506s
[INFO] Finished at: Sat Mar 30 09:23:06 CET 2013
[INFO] Final Memory: 6M/15M
[INFO] ------------------------------------------------------------------------
[dave@dave EclipseJPAExample]$ mvn dependency::list -Phibernate
/usr/java//jdk1.7.0_13
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building EclipseJPAExample 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.1:list (default-cli) @ EclipseJPAExample ---
[INFO]
[INFO] The following files have been resolved:
[INFO] antlr:antlr:jar:2.7.7:compile
[INFO] commons-collections:commons-collections:jar:3.2.1:compile
[INFO] dom4j:dom4j:jar:1.6.1:compile
[INFO] org.apache.derby:derby:jar:10.8.2.2:compile
[INFO] org.apache.derby:derbytools:jar:10.8.2.2:compile
[INFO] org.hibernate:hibernate-core:jar:4.0.1.Final:compile
[INFO] org.hibernate:hibernate-entitymanager:jar:4.0.1.Final:compile
[INFO] org.hibernate.common:hibernate-commons-annotations:jar:4.0.1.Final:compile
[INFO] org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.1.Final:compile
[INFO] org.javassist:javassist:jar:3.15.0-GA:compile
[INFO] org.jboss.logging:jboss-logging:jar:3.1.0.CR2:compile
[INFO] org.jboss.spec.javax.transaction:jboss-transaction-api_1.1_spec:jar:1.0.0.Final:compile
[INFO] xml-apis:xml-apis:jar:1.0.b2:compile
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.562s
[INFO] Finished at: Sat Mar 30 09:23:22 CET 2013
[INFO] Final Memory: 6M/15M
[INFO] ------------------------------

Modified pom.xml with dependencies inside profile
<profiles>
<profile>
<id>hibernate</id>
<activation>
<activeByDefault>false</activeByDefault>
<property>
<name>JPAProvider</name>
<value>hibernate</value>
</property>
</activation>
<dependencies>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.0-api</artifactId>
<version>1.0.1.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>4.0.1.Final</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>process-resources</phase>
<id>rename-persistence-file</id>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo>Rename persistence-hibernate.xml to persistence.xml</echo>
<copy file="${basedir}/src/main/resources/META-INF/persistence-hibernate.xml" tofile="${project.build.directory}/classes/META-INF/persistence.xml" overwrite="true" />
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>


Weblogic 12.1.1 Java EE 6 CDI Weld requires patches

$
0
0
Weld issues are fixed in version 12.1.2
http://docs.oracle.com/middleware/1212/wls/NOTES/index.html#NOTES254



CDI  Weld patches are required on Java EE 6 Weblogic 12.1.1

 Caused By: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type
https://forums.oracle.com/forums/thread.jspa?messageID=10760194

http://biemond.blogspot.cz/2012/01/jsf-20-managed-bean-annotations-and-cdi.html

https://forums.oracle.com/forums/thread.jspa?threadID=2391298

Check installed patches with bsu utility
http://docs.oracle.com/cd/E14759_01/doc.32/e14143/commands.htm#i1071660

Patches delivered with installation from otn
-report
   

Generates a report showing the applied patches and associated file changes in a Middleware home directory.


[dave@dave weblogic]$ cd utils/bsu/
[dave@dave bsu]$ ./bsu.sh -report
Patch Report
============
  Report Info
    Report Options
      bea_home.................. ### OPTION NOT SET
      product_mask.............. ### OPTION NOT SET
      release_mask.............. ### OPTION NOT SET
      profile_mask.............. ### OPTION NOT SET
      patch_id_mask............. ### OPTION NOT SET
    Report Messages
  BEA Home.................. /opt/weblogic
 
  Product Description
  Product Name.............. WebLogic Server
  Product Version........... 12.1.1.0
  Installed Components...... Core Application Server, Administration Console, Configuration Wizard and Upgrade Framework, Web 2.0 HTTP Pub-Sub Server, WebLogic SCA, WebLogic JDBC Drivers, Third Party JDBC Drivers, WebLogic Server Clients, Xquery Support, Evaluation Database, Workshop Code Completion Support
  Product Install Directory. /opt/weblogic/wlserver_12.1
  Java Home................. /opt/weblogic/jdk160_29
  Jave Vendor............... Sun
  Java Version.............. 1.6.0_29
  Patch Directory........... /opt/weblogic/patch_wls1211
   
    Profile................... Default
     
      Patch ID.................. 97L5
      CR(s).....................
      Description............... SERVLET 3.0 FILE UPLOAD BREAKS OTHER FILE UPLOAD FRAMEWORKS
SERVLET 3.0 FILE UPLOAD BREAKS OTHER FILE UPLOAD FRAMEWORKS
      Classpath
        Classpath type............ SYSTEM
        Classpath control jar..... weblogic_patch.jar
          Jar....................... BUG13657792_1211.jar
            File...................... META-INF/MANIFEST.MF
            File...................... weblogic/servlet/internal/ServletRegistrationImpl.class
            File...................... weblogic/servlet/internal/ServletRequestImpl$1.class
            File...................... weblogic/servlet/internal/ServletRequestImpl$AuthenticateResponseWrapper.class
            File...................... weblogic/servlet/internal/ServletRequestImpl$CookieKey.class
            File...................... weblogic/servlet/internal/ServletRequestImpl$ExtraIncludeParams.class
            File...................... weblogic/servlet/internal/ServletRequestImpl$ExtraParams.class
            File...................... weblogic/servlet/internal/ServletRequestImpl$RequestInputHelper.class
            File...................... weblogic/servlet/internal/ServletRequestImpl$RequestParameters.class
            File...................... weblogic/servlet/internal/ServletRequestImpl$SessionHelper.class
            File...................... weblogic/servlet/internal/ServletRequestImpl.class
            File...................... weblogic/servlet/internal/ServletStubFactory.class
            File...................... weblogic/servlet/internal/ServletStubImpl$1.class
            File...................... weblogic/servlet/internal/ServletStubImpl.class
     
      Patch ID.................. NST7
      CR(s).....................
      Description............... UNCAUGHT EXCEPTION IN SERVER HANDLERJAVAX.NET.SSL.SSLEXCEPTION: ERROR GENERATING
UNCAUGHT EXCEPTION IN SERVER HANDLERJAVAX.NET.SSL.SSLEXCEPTION: ERROR GENERATING
      Classpath
        Classpath type............ SYSTEM
        Classpath control jar..... weblogic_patch.jar
          Jar....................... BUG13421471_1211.jar
            File...................... META-INF/MANIFEST.MF
            File...................... weblogic/security/utils/KeyStoreInstall.class
     
      Patch ID.................. 4331
      CR(s).....................
      Description............... WEB SERVICE THAT IMPLEMENTS PROVIDER INTERFACE CANNOT BE GENERATED A
WEB SERVICE THAT IMPLEMENTS PROVIDER INTERFACE CANNOT BE GENERATED A
      Classpath
        Classpath type............ SYSTEM
        Classpath control jar..... weblogic_patch.jar
          Jar....................... BUG13361720_1211.jar
            File...................... META-INF/MANIFEST.MF
            File...................... weblogic/wsee/tools/jws/build/JwsCompiler.class
     
      Patch ID.................. RCMZ
      CR(s).....................
      Description............... UNDEPLOYING A SUBMODULE JMS FAILS
UNDEPLOYING A SUBMODULE JMS FAILS
      Classpath
        Classpath type............ SYSTEM
        Classpath control jar..... weblogic_patch.jar
          Jar....................... BUG13424251_1211.jar
            File...................... META-INF/MANIFEST.MF
            File...................... weblogic/cluster/migration/MigrationManager$1.class
            File...................... weblogic/cluster/migration/MigrationManager.class
     
      Patch ID.................. 53JP
      CR(s).....................
      Description............... MERGE LABEL REQUEST ON TOP OF 12.1.1 FOR CDI BUGS
MERGE LABEL REQUEST ON TOP OF 12.1.1 FOR CDI BUGS
      Classpath
        Classpath type............ SYSTEM
        Classpath control jar..... weblogic_patch.jar
          Jar....................... BUG13603813_1211.jar
            File...................... META-INF/MANIFEST.MF
            File...................... com/oracle/injection/integration/CDIAppDeploymentExtension$1.class
            File...................... com/oracle/injection/integration/CDIAppDeploymentExtension.class
            File...................... com/oracle/injection/integration/CDIModuleExtension$RarModuleInjectionArchive.class
            File...................... com/oracle/injection/integration/CDIModuleExtension$WebInfLibInjectionArchive.class
            File...................... com/oracle/injection/integration/CDIModuleExtension.class
            File...................... com/oracle/injection/integration/CDIUtils.class
            File...................... com/oracle/injection/provider/weld/BasicDeployment$1.class
            File...................... com/oracle/injection/provider/weld/BasicDeployment$NullJpaInjectionServicesAdapter.class
            File...................... com/oracle/injection/provider/weld/BasicDeployment$RootBeanDeploymentArchive.class
            File...................... com/oracle/injection/provider/weld/BasicDeployment.class
            File...................... com/oracle/injection/provider/weld/WeldValidationServicesAdapter.class
            File...................... weblogic/application/internal/flow/TailVersionLifecycleFlow.class
            File...................... weblogic/application/ModuleManager.class
            File...................... weblogic/transaction/internal/ServerSCInfo$1.class
            File...................... weblogic/transaction/internal/ServerSCInfo$2.class
            File...................... weblogic/transaction/internal/ServerSCInfo$3.class
            File...................... weblogic/transaction/internal/ServerSCInfo$CallAfterCompletionsAction.class
            File...................... weblogic/transaction/internal/ServerSCInfo$CallBeforeCompletionsAction.class
            File...................... weblogic/transaction/internal/ServerSCInfo$ForceLocalCommitAction.class
            File...................... weblogic/transaction/internal/ServerSCInfo$ForceLocalRollbackAction.class
            File...................... weblogic/transaction/internal/ServerSCInfo$GetPropertiesAction.class
            File...................... weblogic/transaction/internal/ServerSCInfo$NonXAResourceCommitAction.class
            File...................... weblogic/transaction/internal/ServerSCInfo$RecoverAction.class
            File...................... weblogic/transaction/internal/ServerSCInfo$RegisteredSync.class
            File...................... weblogic/transaction/internal/ServerSCInfo$RollbackAction.class
            File...................... weblogic/transaction/internal/ServerSCInfo$StartCommitAction.class
            File...................... weblogic/transaction/internal/ServerSCInfo$StartPrepareAction.class
            File...................... weblogic/transaction/internal/ServerSCInfo$StartPrePrepareAndChain.class
            File...................... weblogic/transaction/internal/ServerSCInfo$StartRollbackAction.class
            File...................... weblogic/transaction/internal/ServerSCInfo.class
     
      Patch ID.................. 1U7B
      CR(s).....................
      Description............... VERBOSE SUPPORT DOESN'T SUPPORT NOT WITH WILDCARD ALWAYS DUMPS THE SOAP MESSAGE
VERBOSE SUPPORT DOESN'T SUPPORT NOT WITH WILDCARD ALWAYS DUMPS THE SOAP MESSAGE
      Classpath
        Classpath type............ SYSTEM
        Classpath control jar..... weblogic_patch.jar
          Jar....................... BUG13641115_1211.jar
            File...................... META-INF/MANIFEST.MF
            File...................... weblogic/wsee/util/Verbose$1.class
            File...................... weblogic/wsee/util/Verbose.class
     
      Patch ID.................. B33B
      CR(s).....................
      Description............... CANNOT CREATE "OTHER" DATASOURCE IN CONSOLE.
CANNOT CREATE "OTHER" DATASOURCE IN CONSOLE.
      Other artifacts
        Destination............... $WLS_INSTALL_DIR$/server/lib/consoleapp/webapp/WEB-INF/lib/console.jar
     
      Patch ID.................. WC8G
      CR(s).....................
      Description............... WEBLOGIC 12C REFERENCING SHARED EE LIBRARIES DOES NOT WORK
WEBLOGIC 12C REFERENCING SHARED EE LIBRARIES DOES NOT WORK
      Classpath
        Classpath type............ SYSTEM
        Classpath control jar..... weblogic_patch.jar
          Jar....................... BUG13516712_1211.jar
            File...................... META-INF/MANIFEST.MF
            File...................... weblogic/application/internal/library/EarLibraryDefinition.class
     
      Patch ID.................. B84Y
      CR(s).....................
      Description............... WSEE TESTS FAILING WITH SSL ISSUES ON JDK 7 (7U2)
WSEE TESTS FAILING WITH SSL ISSUES ON JDK 7 (7U2)
      Classpath
        Classpath type............ SYSTEM
        Classpath control jar..... weblogic_patch.jar
          Jar....................... BUG13391585_1211.jar
            File...................... META-INF/MANIFEST.MF
            File...................... weblogic/net/http/MessageHeader.class
     
      Patch ID.................. 8PE3
      CR(s).....................
      Description............... CAN'T DEPLOY APP WITH WEB SERVICE WHEN WEBLOGIC DOMAIN IS LOCATED ON THE NETWORK
CAN'T DEPLOY APP WITH WEB SERVICE WHEN WEBLOGIC DOMAIN IS LOCATED ON THE NETWORK
      Classpath
        Classpath type............ SYSTEM
        Classpath control jar..... weblogic_patch.jar
          Jar....................... BUG13019800_1211.jar
            File...................... META-INF/MANIFEST.MF
            File...................... weblogic/utils/zip/Handler.class
            File...................... weblogic/utils/zip/NullZipEntry.class
            File...................... weblogic/utils/zip/ZipFactory.class
            File...................... weblogic/utils/zip/ZipURLConnection.class
     
      Patch ID.................. H675
      CR(s).....................
      Description............... PSR:DEVX:WLS DEPLOYMENT REGRESSIONS IN 12.1.1
PSR:DEVX:WLS DEPLOYMENT REGRESSIONS IN 12.1.1
      Classpath
        Classpath type............ SYSTEM
        Classpath control jar..... weblogic_patch.jar
          Jar....................... BUG13340309_1211.jar
            File...................... META-INF/MANIFEST.MF
            File...................... com/oracle/pitchfork/server/Bootstrap.class
            File...................... com/oracle/pitchfork/server/ContainerBootstrap.class
            File...................... com/oracle/pitchfork/server/DefaultContainerBootstrap.class
            File...................... weblogic/application/internal/flow/EnvContextFlow$1.class
            File...................... weblogic/application/internal/flow/EnvContextFlow$AppEnvironmentBeanProvider.class
            File...................... weblogic/application/internal/flow/EnvContextFlow.class
            File...................... weblogic/application/naming/Environment$EnvType.class
            File...................... weblogic/application/naming/Environment$ResourceDescriptionData.class
            File...................... weblogic/application/naming/Environment.class
            File...................... weblogic/application/naming/EnvironmentBeanProvider.class
            File...................... weblogic/application/naming/EnvironmentBuilder$1.class
            File...................... weblogic/application/naming/EnvironmentBuilder.class
            File...................... weblogic/application/naming/EnvironmentBuilderManager$1.class
            File...................... weblogic/application/naming/EnvironmentBuilderManager.class
            File...................... weblogic/application/naming/EnvironmentException.class
            File...................... weblogic/application/naming/EnvUtils$1.class
            File...................... weblogic/application/naming/EnvUtils$InterfacesList.class
            File...................... weblogic/application/naming/EnvUtils.class
            File...................... weblogic/corba/rmic/StubGenerator.class
            File...................... weblogic/ejb/container/compliance/EJBObjectClassChecker.class
            File...................... weblogic/ejb/container/deployer/EJBDeployer$1.class
            File...................... weblogic/ejb/container/deployer/EJBDeployer$DeployedManagers.class
            File...................... weblogic/ejb/container/deployer/EJBDeployer$InjectionBasedEjbComponentContributorFactory.class
            File...................... weblogic/ejb/container/deployer/EJBDeployer.class
            File...................... weblogic/ejb/container/deployer/EJBModule$1.class
            File...................... weblogic/ejb/container/deployer/EJBModule.class
            File...................... weblogic/ejb/container/metadata/EjbDescriptorReaderImpl$NoCloseInputStream.class
            File...................... weblogic/ejb/container/metadata/EjbDescriptorReaderImpl$NonClosingClassFinder.class
            File...................... weblogic/ejb/container/metadata/EjbDescriptorReaderImpl.class
            File...................... weblogic/ejb/container/metadata/EjbJarLoader.class
            File...................... weblogic/ejb/container/metadata/WeblogicEjbJarLoader.class
            File...................... weblogic/ejb/container/persistence/InstalledPersistence.class
            File...................... weblogic/j2ee/managedbean/ManagedBeanModuleExtensionFactory.class
            File...................... weblogic/jndi/internal/ApplicationNamingNode$1.class
            File...................... weblogic/jndi/internal/ApplicationNamingNode$CacheInvalidationListener.class
            File...................... weblogic/jndi/internal/ApplicationNamingNode.class
            File...................... weblogic/jndi/internal/BasicNamingNode$1.class
            File...................... weblogic/jndi/internal/BasicNamingNode$2.class
            File...................... weblogic/jndi/internal/BasicNamingNode.class
            File...................... weblogic/jndi/internal/RootNamingNode.class
            File...................... weblogic/jndi/internal/ServerNamingNode.class
            File...................... weblogic/jndi/internal/WLNameParser.class
            File...................... weblogic/rmi/extensions/server/RMIDDParser.class
            File...................... weblogic/rmi/internal/BasicRuntimeDescriptor.class
            File...................... weblogic/rmi/internal/BasicServerRef$1.class
            File...................... weblogic/rmi/internal/BasicServerRef$ErrorReporter.class
            File...................... weblogic/rmi/internal/BasicServerRef$OIDManagerMaker.class
            File...................... weblogic/rmi/internal/BasicServerRef$UnreferencedExecuteRequest.class
            File...................... weblogic/rmi/internal/BasicServerRef.class
            File...................... weblogic/rmi/internal/DescriptorManager.class
            File...................... weblogic/rmi/internal/MethodDescriptor.class
            File...................... weblogic/servlet/provider/WlsJNDIProvider.class
            File...................... weblogic/utils/CharUtils.class
            File...................... weblogic/utils/classfile/AttributeTable.class
            File...................... weblogic/utils/classfile/Bytecodes.class
            File...................... weblogic/utils/classfile/ClassFile.class
            File...................... weblogic/utils/classfile/CodeAttribute$exception_struct.class
            File...................... weblogic/utils/classfile/CodeAttribute.class
            File...................... weblogic/utils/classfile/CodeGenHelper.class
            File...................... weblogic/utils/classfile/cp/ConstantPool.class
            File...................... weblogic/utils/classfile/expr/InvokeExpression.class
            File...................... weblogic/utils/classfile/expr/MemberVarExpression.class
            File...................... weblogic/utils/classfile/MethodInfo.class
            File...................... weblogic/utils/classfile/Scope$LocalVar.class
            File...................... weblogic/utils/classfile/Scope.class
            File...................... weblogic/utils/classfile/utils/CodeGenerator.class
            File...................... weblogic/utils/classloaders/CodeGenClassFinder.class
            File...................... weblogic/utils/classloaders/GenericClassLoader$1.class
            File...................... weblogic/utils/classloaders/GenericClassLoader$GetClassLoaderParentAction.class
            File...................... weblogic/utils/classloaders/GenericClassLoader.class
            File...................... weblogic/utils/compiler/CodeGenerator.class
            File...................... weblogic/utils/io/FilenameEncoder$UnsafeFilenameException.class
            File...................... weblogic/utils/io/FilenameEncoder.class
            File...................... weblogic/utils/StringUtils$1.class
            File...................... weblogic/utils/StringUtils$ReflectedStringMaker.class
            File...................... weblogic/utils/StringUtils$StringMaker.class
            File...................... weblogic/utils/StringUtils.class
            File...................... weblogic/validation/injection/ValidationManager$1.class
            File...................... weblogic/validation/injection/ValidationManager$ValidationBean.class
            File...................... weblogic/validation/injection/ValidationManager.class
            File...................... weblogic/work/ServerWorkManagerFactory.class
            File...................... weblogic/work/WorkManagerFactory.class
            File...................... weblogic/wsee/wsdl/internal/WsdlExtensibleImpl.class
            File...................... weblogic/wsee/wsdl/internal/WsdlSchemaImpl.class
            File...................... weblogic/xml/babel/baseparser/BaseParser.class
            File...................... weblogic/xml/babel/baseparser/CharDataElement.class
            File...................... weblogic/xml/babel/reader/XmlChars.class
            File...................... weblogic/xml/babel/scanner/CharData.class
            File...................... weblogic/xml/babel/scanner/CloseTag.class
            File...................... weblogic/xml/babel/scanner/IntegerQueue.class
            File...................... weblogic/xml/babel/scanner/Name.class
            File...................... weblogic/xml/babel/scanner/Scanner.class
            File...................... weblogic/xml/babel/scanner/ScannerState.class
 
  Product Description
  Product Name.............. Oracle Coherence
  Product Version........... 3.7.1.1
  Installed Components...... Coherence Product Files
  Product Install Directory. /opt/weblogic/coherence_3.7
  Java Home................. null
  Jave Vendor............... null
  Java Version.............. null
  Patch Directory........... /opt/weblogic/patch_ocp371
 
  Product Description
  Product Name.............. Oracle Enterprise Pack for Eclipse
  Product Version........... 1.0.1.20120312.0
  Installed Components...... Common Files
  Product Install Directory. /opt/weblogic/oepe_12.1.1.0.1
  Java Home................. /opt/weblogic/jdk160_29
  Jave Vendor............... Sun
  Java Version.............. 1.6.0_29
  Patch Directory........... /opt/weblogic/patch_oepe101
Paste your text here.

Weblogic 12.1.1 and WELD-001408 Unsatisfied dependencies for type error test

$
0
0
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



<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










Install Fedora 18 on Asus K55V notebook with UEFI

$
0
0

UEFI Secure Boot Guide

http://docs.fedoraproject.org/en-US/Fedora/18/html-single/UEFI_Secure_Boot_Guide/index.html


http://www.ambitious-vision.net/en/fedora-18-and-windows-8-uefi-how-to/

http://www.zdnet.com/how-i-installed-fedora-18-with-uefi-secure-boot_p9-7000013464/#photo

/boot
[root@localhost boot]# ls -lR
.:
total 54644
-rw-r--r--. 1 root root   122595 Dec 11 19:06 config-3.6.10-4.fc18.x86_64
-rw-r--r--. 1 root root   127595 May 24 22:17 config-3.9.4-200.fc18.x86_64
drwx------. 3 root root    16384 Jan  1  1970 efi
drwxr-xr-x. 3 root root     1024 May  9  2012 grub2
-rw-------. 1 root root 19466512 Jun  4 23:13 initramfs-3.6.10-4.fc18.x86_64.img
-rw-------. 1 root root 20585316 Jun  5 00:07 initramfs-3.9.4-200.fc18.x86_64.img
-rw-r--r--. 1 root root   560509 Jun  4 23:13 initrd-plymouth.img
drwx------. 2 root root    12288 Jun  4 23:01 lost+found
-rw-------. 1 root root  2515832 Dec 11 19:06 System.map-3.6.10-4.fc18.x86_64
-rw-------. 1 root root  2595975 May 24 22:17 System.map-3.9.4-200.fc18.x86_64
-rwxr-xr-x. 1 root root  4862486 Dec 11 19:06 vmlinuz-3.6.10-4.fc18.x86_64
-rwxr-xr-x. 1 root root  5073462 May 24 22:17 vmlinuz-3.9.4-200.fc18.x86_64

./efi:
total 4
drwx------. 3 root root 4096 Jun  4 21:06 EFI

./efi/EFI:
total 4
drwx------. 3 root root 4096 Jun  5 00:07 fedora

./efi/EFI/fedora:
total 5484
drwx------. 2 root root    4096 Jun  4 17:46 fonts
-rwx------. 1 root root  826246 Dec 20 12:10 gcdx64.efi
-rwx------. 1 root root    5999 Jun  5 00:07 grub.cfg
-rwx------. 1 root root  845190 Dec 20 12:10 grubx64.efi
-rwx------. 1 root root 1189220 Dec 12 14:15 MokManager.efi
-rwx------. 1 root root 1370230 Jan  2 15:24 shim.efi
-rwx------. 1 root root 1361702 Jan  2 15:24 shim-fedora.efi

./efi/EFI/fedora/fonts:
total 2504
-rwx------. 1 root root 2560080 Dec 20 12:10 unicode.pf2

./grub2:
total 4
-rw-r--r--. 1 root root 1024 Jun  4 23:17 grubenv
drwxr-xr-x. 3 root root 1024 May  9  2012 themes

./grub2/themes:
total 2
drwxr-xr-x. 2 root root 1024 Jun  4 23:41 system

./grub2/themes/system:
total 8632
-rw-r--r--. 2 root root 4134586 Sep 11  2012 background.png
-rw-r--r--. 1 root root     836 May  9  2012 blob_w.png
-rw-r--r--. 1 root root     165 May  9  2012 boot_menu_c.png
-rw-r--r--. 1 root root     182 May  9  2012 boot_menu_e.png
-rw-r--r--. 1 root root     312 May  9  2012 boot_menu_ne.png
-rw-r--r--. 1 root root     142 May  9  2012 boot_menu_n.png
-rw-r--r--. 1 root root     278 May  9  2012 boot_menu_nw.png
-rw-r--r--. 1 root root     304 May  9  2012 boot_menu_se.png
-rw-r--r--. 1 root root     144 May  9  2012 boot_menu_s.png
-rw-r--r--. 1 root root     280 May  9  2012 boot_menu_sw.png
-rw-r--r--. 1 root root     142 May  9  2012 boot_menu_w.png
-rw-r--r--. 1 root root   19890 May  9  2012 COPYING.CC-BY-SA-3.0
-rw-r--r--. 1 root root  146357 Dec 20 18:10 DejaVuSans-10.pf2
-rw-r--r--. 1 root root  160939 Dec 20 18:10 DejaVuSans-12.pf2
-rw-r--r--. 1 root root  181067 Dec 20 18:10 DejaVuSans-Bold-14.pf2
-rw-r--r--. 2 root root 4134586 Sep 11  2012 fireworks.png
-rw-r--r--. 1 root root    1191 May  9  2012 README
-rw-r--r--. 1 root root     197 May  9  2012 slider_c.png
-rw-r--r--. 1 root root     265 May  9  2012 slider_n.png
-rw-r--r--. 1 root root     269 May  9  2012 slider_s.png
-rw-r--r--. 1 root root     178 May  9  2012 terminal_box_c.png
-rw-r--r--. 1 root root      94 May  9  2012 terminal_box_e.png
-rw-r--r--. 1 root root     128 May  9  2012 terminal_box_ne.png
-rw-r--r--. 1 root root     194 May  9  2012 terminal_box_n.png
-rw-r--r--. 1 root root     210 May  9  2012 terminal_box_nw.png
-rw-r--r--. 1 root root     126 May  9  2012 terminal_box_se.png
-rw-r--r--. 1 root root     101 May  9  2012 terminal_box_s.png
-rw-r--r--. 1 root root     123 May  9  2012 terminal_box_sw.png
-rw-r--r--. 1 root root      97 May  9  2012 terminal_box_w.png
-rw-r--r--. 1 root root    2580 Sep 14  2012 theme.txt
lrwxrwxrwx. 1 root root      23 Jun  4 23:41 unicode.pf2 -> ../../fonts/unicode.pf2




[dave@localhost lib]$ uname -a
Linux localhost.localdomain 3.9.4-200.fc18.x86_64 #1 SMP Fri May 24 20:10:49 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux





/proc/cpuinfo
[dave@localhost lib]$ more /proc/cpuinfo 
processor    : 0
vendor_id    : GenuineIntel
cpu family    : 6
model        : 58
model name    : Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
stepping    : 9
microcode    : 0x15
cpu MHz        : 1200.000
cache size    : 3072 KB
physical id    : 0
siblings    : 4
core id        : 0
cpu cores    : 2
apicid        : 0
initial apicid    : 0
fpu        : yes
fpu_exception    : yes
cpuid level    : 13
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi
 mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtop
ology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm
 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat epb xsaveo
pt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips    : 4989.19
clflush size    : 64
cache_alignment    : 64
address sizes    : 36 bits physical, 48 bits virtual
power management:

processor    : 1
vendor_id    : GenuineIntel
cpu family    : 6
model        : 58
model name    : Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
stepping    : 9
microcode    : 0x15
cpu MHz        : 1200.000
cache size    : 3072 KB
physical id    : 0
siblings    : 4
core id        : 1
cpu cores    : 2
apicid        : 2
initial apicid    : 2
fpu        : yes
fpu_exception    : yes
cpuid level    : 13
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi
 mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtop
ology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm
 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat epb xsaveo
pt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips    : 4989.19
clflush size    : 64
cache_alignment    : 64
address sizes    : 36 bits physical, 48 bits virtual
power management:

processor    : 2
vendor_id    : GenuineIntel
cpu family    : 6
model        : 58
model name    : Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
stepping    : 9
microcode    : 0x15
cpu MHz        : 1200.000
cache size    : 3072 KB
physical id    : 0
siblings    : 4
core id        : 0
cpu cores    : 2
apicid        : 1
initial apicid    : 1
fpu        : yes
fpu_exception    : yes
cpuid level    : 13
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi
 mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtop
ology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm
 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat epb xsaveo
pt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips    : 4989.19
clflush size    : 64
cache_alignment    : 64
address sizes    : 36 bits physical, 48 bits virtual
power management:

processor    : 3
vendor_id    : GenuineIntel
cpu family    : 6
model        : 58
model name    : Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
stepping    : 9
microcode    : 0x15
cpu MHz        : 1200.000
cache size    : 3072 KB
physical id    : 0
siblings    : 4
core id        : 1
cpu cores    : 2
apicid        : 3
initial apicid    : 3
fpu        : yes
fpu_exception    : yes
cpuid level    : 13
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi
 mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtop
ology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm
 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat epb xsaveo
pt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips    : 4989.19
clflush size    : 64
cache_alignment    : 64
address sizes    : 36 bits physical, 48 bits virtual
power management:
        

Weblogic 12c - tune and debug JMS OAQ module

$
0
0

Interoperating with Oracle AQ JMS

 http://docs.oracle.com/cd/E24329_01/web.1211/e24385/aq_jms.htm

To use AQ JMS tracing and debugging, set the following system property: oracle.jms.traceLevel

Parameters for tuning:

max-threads-constraint - Work Manager- this should be higher than min-threads-constraint http://docs.oracle.com/cd/E24329_01/web.1211/e24432/self_tuned.htm#i1068070

min-threads-constraint - Work Manager

max-beans-in-free-pool - weblogic-ejb-jar.xml - http://docs.oracle.com/cd/E24329_01/web.1211/e24973/ejb_jar_ref.htm#autoId167

WebLogic Server maintains a free pool of EJBs for every entity bean, stateless session bean, and message-driven bean class. The max-beans-in-free-pool element defines the size of this pool.

Determining the Number of Concurrent MDBs

 http://docs.oracle.com/cd/E24329_01/web.1211/e24390/mdbtuning.htm#i1134848

Custom work manager with constraint
varies due to self-tuning, between min-thread-constraint and Min(max-threads-constraint, max-beans-in-free-pool)

You can reserve threads by  specifying a work manager with amin-threads-constraint

 

Thread dump analysis

http://allthingsmdw.blogspot.cz/2012/02/analyzing-thread-dumps-in-middleware_08.html 

Install IDE and AS for Java EE7 - Eclipse Luna 4.4 , JBoss WildFly 8.1

$
0
0

 Install latest Oracle JDK

 yum localinstall /home/dave/Downloads/jdk-7u60-linux-x64.rpm   


 Fedora uses OpenJDK by default, to use Oracle JDK  JAVA_HOME must be properly set

 [dave@localhost ~]$ java -version  
 java version "1.7.0_55" 
 OpenJDK Runtime Environment (fedora-2.4.7.0.fc20-x86_64 u55-b13) 
 OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode) 
  vi ~/.bash_profile 
 # User specific environment and startup programs 
 JAVA_HOME=/usr/java/jdk1.7.0_60 
 export JAVA_HOME 
 PATH=$JAVA_HOME/bin:$PATH:$HOME/.local/bin:$HOME/bin 
 export PATH 
 source ~/.bash_profile 
 [dave@localhost Downloads]$ java -version 
 java version "1.7.0_60" 
 Java(TM) SE Runtime Environment (build 1.7.0_60-b19) 
 Java HotSpot(TM) 64-Bit Server VM (build 24.60-b09, mixed mode) 



Download and install latest Eclipse Luna 4.4.

  tar xzvf eclipse-jee-luna-RC3-linux-gtk-x86_64.tar.gz   


Eclipse configuration

 *** Date: Thursday, July 3, 2014 at 10:29:39 PM Central European Summer Time  
 *** Platform Details: 
 *** System properties: 
 applicationXMI=org.eclipse.ui.workbench/LegacyIDE.e4xmi 
 awt.toolkit=sun.awt.X11.XToolkit 
 eclipse.application=org.eclipse.ui.ide.workbench 
 eclipse.buildId=4.4.0.I20140528-2000 
 eclipse.commands=-os 
 linux 
 -ws 
 gtk 
 -arch 
 x86_64 
 -showsplash 
 /home/app/eclipse//plugins/org.eclipse.platform_4.4.0.v20140528-2000/splash.bmp 
 -launcher 
 /home/app/eclipse/eclipse 
 -name 
 Eclipse 
 --launcher.library 
 /home/app/eclipse//plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.200.v20140521-1744/eclipse_1605.so 
 -startup 
 /home/app/eclipse//plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar 
 --launcher.appendVmargs 
 -exitdata 
 f8010 
 -product 
 org.eclipse.epp.package.jee.product 
 -vm 
 /usr/java/jdk1.7.0_60/bin/java 
 eclipse.home.location=file:/home/app/eclipse/ 
 eclipse.launcher=/home/app/eclipse/eclipse 
 eclipse.launcher.name=Eclipse 
 eclipse.p2.data.area=@config.dir/../p2 
 eclipse.p2.profile=epp.package.jee 
 eclipse.product=org.eclipse.epp.package.jee.product 
 eclipse.startTime=1404419236393 
 eclipse.stateSaveDelayInterval=30000 
 eclipse.vm=/usr/java/jdk1.7.0_60/bin/java 
 eclipse.vmargs=-Dosgi.requiredJavaVersion=1.6 
 -XX:MaxPermSize=256m 
 -Xms40m 
 -Xmx512m 
 -jar 
 /home/app/eclipse//plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar 
 equinox.use.ds=true 
 file.encoding=UTF-8 
 file.encoding.pkg=sun.io 
 file.separator=/ 
 gosh.args=--nointeractive 
 guice.disable.misplaced.annotation.check=true 
 java.awt.graphicsenv=sun.awt.X11GraphicsEnvironment 
 java.awt.printerjob=sun.print.PSPrinterJob 
 java.class.path=/home/app/eclipse//plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar 
 java.class.version=51.0 
 java.endorsed.dirs=/usr/java/jdk1.7.0_60/jre/lib/endorsed 
 java.ext.dirs=/usr/java/jdk1.7.0_60/jre/lib/ext:/usr/java/packages/lib/ext 
 java.home=/usr/java/jdk1.7.0_60/jre 
 java.io.tmpdir=/tmp 
 java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib 
 java.runtime.name=Java(TM) SE Runtime Environment 
 java.runtime.version=1.7.0_60-b19 
 java.specification.name=Java Platform API Specification 
 java.specification.vendor=Oracle Corporation 
 java.specification.version=1.7 
 java.vendor=Oracle Corporation 
 java.vendor.url=http://java.oracle.com/ 
 java.vendor.url.bug=http://bugreport.sun.com/bugreport/ 
 java.version=1.7.0_60 
 java.vm.info=mixed mode 
 java.vm.name=Java HotSpot(TM) 64-Bit Server VM 
 java.vm.specification.name=Java Virtual Machine Specification 
 java.vm.specification.vendor=Oracle Corporation 
 java.vm.specification.version=1.7 
 java.vm.vendor=Oracle Corporation 
 java.vm.version=24.60-b09 
 line.separator= 
 org.apache.commons.logging.Log=org.apache.commons.logging.impl.NoOpLog 
 org.eclipse.debug.ui.breakpoints.toggleFactoriesUsed=false 
 org.eclipse.equinox.launcher.splash.location=/home/app/eclipse//plugins/org.eclipse.platform_4.4.0.v20140528-2000/splash.bmp 
 org.eclipse.equinox.simpleconfigurator.configUrl=file:org.eclipse.equinox.simpleconfigurator/bundles.info 
 org.eclipse.m2e.log.dir=/home/dave/workspace/.metadata/.plugins/org.eclipse.m2e.logback.configuration 
 org.eclipse.swt.internal.gtk.useCairo=true 
 org.eclipse.update.reconcile=false 
 org.osgi.framework.executionenvironment=OSGi/Minimum-1.0,OSGi/Minimum-1.1,OSGi/Minimum-1.2,JRE-1.1,J2SE-1.2,J2SE-1.3,J2SE-1.4,J2SE-1.5,JavaSE-1.6,JavaSE-1.7 
 org.osgi.framework.language=en 
 org.osgi.framework.os.name=Linux 
 org.osgi.framework.os.version=3.14.4.fc20 
 org.osgi.framework.processor=x86-64 
 org.osgi.framework.system.capabilities=osgi.ee; osgi.ee="OSGi/Minimum"; version:List<Version>="1.0, 1.1, 1.2",osgi.ee; osgi.ee="JRE"; version:List<Version>="1.0, 1.1",osgi.ee; osgi.ee="JavaSE"; version:List<Version>="1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7" 
 org.osgi.framework.system.packages=javax.accessibility,javax.activation,javax.activity,javax.annotation,javax.annotation.processing,javax.crypto,javax.crypto.interfaces,javax.crypto.spec,javax.imageio,javax.imageio.event,javax.imageio.metadata,javax.imageio.plugins.bmp,javax.imageio.plugins.jpeg,javax.imageio.spi,javax.imageio.stream,javax.jws,javax.jws.soap,javax.lang.model,javax.lang.model.element,javax.lang.model.type,javax.lang.model.util,javax.management,javax.management.loading,javax.management.modelmbean,javax.management.monitor,javax.management.openmbean,javax.management.relation,javax.management.remote,javax.management.remote.rmi,javax.management.timer,javax.naming,javax.naming.directory,javax.naming.event,javax.naming.ldap,javax.naming.spi,javax.net,javax.net.ssl,javax.print,javax.print.attribute,javax.print.attribute.standard,javax.print.event,javax.rmi,javax.rmi.CORBA,javax.rmi.ssl,javax.script,javax.security.auth,javax.security.auth.callback,javax.security.auth.kerberos,javax.security.auth.login,javax.security.auth.spi,javax.security.auth.x500,javax.security.cert,javax.security.sasl,javax.sound.midi,javax.sound.midi.spi,javax.sound.sampled,javax.sound.sampled.spi,javax.sql,javax.sql.rowset,javax.sql.rowset.serial,javax.sql.rowset.spi,javax.swing,javax.swing.border,javax.swing.colorchooser,javax.swing.event,javax.swing.filechooser,javax.swing.plaf,javax.swing.plaf.basic,javax.swing.plaf.metal,javax.swing.plaf.multi,javax.swing.plaf.nimbus,javax.swing.plaf.synth,javax.swing.table,javax.swing.text,javax.swing.text.html,javax.swing.text.html.parser,javax.swing.text.rtf,javax.swing.tree,javax.swing.undo,javax.tools,javax.transaction,javax.transaction.xa,javax.xml,javax.xml.bind,javax.xml.bind.annotation,javax.xml.bind.annotation.adapters,javax.xml.bind.attachment,javax.xml.bind.helpers,javax.xml.bind.util,javax.xml.crypto,javax.xml.crypto.dom,javax.xml.crypto.dsig,javax.xml.crypto.dsig.dom,javax.xml.crypto.dsig.keyinfo,javax.xml.crypto.dsig.spec,javax.xml.datatype,javax.xml.namespace,javax.xml.parsers,javax.xml.soap,javax.xml.stream,javax.xml.stream.events,javax.xml.stream.util,javax.xml.transform,javax.xml.transform.dom,javax.xml.transform.sax,javax.xml.transform.stax,javax.xml.transform.stream,javax.xml.validation,javax.xml.ws,javax.xml.ws.handler,javax.xml.ws.handler.soap,javax.xml.ws.http,javax.xml.ws.soap,javax.xml.ws.spi,javax.xml.ws.spi.http,javax.xml.ws.wsaddressing,javax.xml.xpath,org.ietf.jgss,org.omg.CORBA,org.omg.CORBA_2_3,org.omg.CORBA_2_3.portable,org.omg.CORBA.DynAnyPackage,org.omg.CORBA.ORBPackage,org.omg.CORBA.portable,org.omg.CORBA.TypeCodePackage,org.omg.CosNaming,org.omg.CosNaming.NamingContextExtPackage,org.omg.CosNaming.NamingContextPackage,org.omg.Dynamic,org.omg.DynamicAny,org.omg.DynamicAny.DynAnyFactoryPackage,org.omg.DynamicAny.DynAnyPackage,org.omg.IOP,org.omg.IOP.CodecFactoryPackage,org.omg.IOP.CodecPackage,org.omg.Messaging,org.omg.PortableInterceptor,org.omg.PortableInterceptor.ORBInitInfoPackage,org.omg.PortableServer,org.omg.PortableServer.CurrentPackage,org.omg.PortableServer.POAManagerPackage,org.omg.PortableServer.POAPackage,org.omg.PortableServer.portable,org.omg.PortableServer.ServantLocatorPackage,org.omg.SendingContext,org.omg.stub.java.rmi,org.w3c.dom,org.w3c.dom.bootstrap,org.w3c.dom.css,org.w3c.dom.events,org.w3c.dom.html,org.w3c.dom.ls,org.w3c.dom.ranges,org.w3c.dom.stylesheets,org.w3c.dom.traversal,org.w3c.dom.views,org.w3c.dom.xpath,org.xml.sax,org.xml.sax.ext,org.xml.sax.helpers 
 org.osgi.framework.uuid=b07b3d6d-f002-0014-1d84-801f434fe7a4 
 org.osgi.framework.vendor=Eclipse 
 org.osgi.framework.version=1.8.0 
 org.osgi.supports.framework.extension=true 
 org.osgi.supports.framework.fragment=true 
 org.osgi.supports.framework.requirebundle=true 
 os.arch=amd64 
 os.name=Linux 
 os.version=3.14.4-200.fc20.x86_64 
 osgi.arch=x86_64 
 osgi.bundles=reference:file:org.eclipse.osgi.compatibility.state_1.0.0.v20140403-1907.jar,reference:file:org.eclipse.equinox.simpleconfigurator_1.1.0.v20131217-1203.jar@1:start 
 osgi.bundles.defaultStartLevel=4 
 osgi.compatibility.bootdelegation=true 
 osgi.configuration.area=file:/home/app/eclipse/configuration/ 
 osgi.framework=file:/home/app/eclipse/plugins/org.eclipse.osgi_3.10.0.v20140528-2014.jar 
 osgi.framework.extensions=reference:file:org.eclipse.osgi.compatibility.state_1.0.0.v20140403-1907.jar 
 osgi.framework.shape=jar 
 osgi.framework.useSystemProperties=true 
 osgi.frameworkClassPath=., file:/home/app/eclipse/plugins/org.eclipse.osgi.compatibility.state_1.0.0.v20140403-1907.jar 
 osgi.install.area=file:/home/app/eclipse/ 
 osgi.instance.area=file:/home/dave/workspace/ 
 osgi.instance.area.default=file:/home/dave/workspace/ 
 osgi.logfile=/home/dave/workspace/.metadata/.log 
 osgi.nl=en_US 
 osgi.os=linux 
 osgi.requiredJavaVersion=1.6 
 osgi.splashLocation=/home/app/eclipse//plugins/org.eclipse.platform_4.4.0.v20140528-2000/splash.bmp 
 osgi.splashPath=platform:/base/plugins/org.eclipse.platform 
 osgi.syspath=/home/app/eclipse/plugins 
 osgi.tracefile=/home/dave/workspace/.metadata/trace.log 
 osgi.ws=gtk 
 path.separator=: 
 securerandom.source=file:/dev/./urandom 
 sun.arch.data.model=64 
 sun.boot.class.path=/usr/java/jdk1.7.0_60/jre/lib/resources.jar:/usr/java/jdk1.7.0_60/jre/lib/rt.jar:/usr/java/jdk1.7.0_60/jre/lib/sunrsasign.jar:/usr/java/jdk1.7.0_60/jre/lib/jsse.jar:/usr/java/jdk1.7.0_60/jre/lib/jce.jar:/usr/java/jdk1.7.0_60/jre/lib/charsets.jar:/usr/java/jdk1.7.0_60/jre/lib/jfr.jar:/usr/java/jdk1.7.0_60/jre/classes 
 sun.boot.library.path=/usr/java/jdk1.7.0_60/jre/lib/amd64 
 sun.cpu.endian=little 
 sun.cpu.isalist= 
 sun.desktop=gnome 
 sun.io.unicode.encoding=UnicodeLittle 
 sun.java.command=/home/app/eclipse//plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar -os linux -ws gtk -arch x86_64 -showsplash /home/app/eclipse//plugins/org.eclipse.platform_4.4.0.v20140528-2000/splash.bmp -launcher /home/app/eclipse/eclipse -name Eclipse --launcher.library /home/app/eclipse//plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.200.v20140521-1744/eclipse_1605.so -startup /home/app/eclipse//plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar --launcher.appendVmargs -exitdata f8010 -product org.eclipse.epp.package.jee.product -vm /usr/java/jdk1.7.0_60/bin/java -vmargs -Dosgi.requiredJavaVersion=1.6 -XX:MaxPermSize=256m -Xms40m -Xmx512m -jar /home/app/eclipse//plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar 
 sun.java.launcher=SUN_STANDARD 
 sun.jnu.encoding=UTF-8 
 sun.management.compiler=HotSpot 64-Bit Tiered Compilers 
 sun.os.patch.level=unknown 
 user.country=US 
 user.dir=/home/app/eclipse 
 user.home=/home/dave 
 user.language=en 
 user.name=dave 
 user.timezone=Europe/Prague 
 tchingTagIndicationColor=212,212,212 
 /bundle_defaults/org.eclipse.jdt.ui/semanticHighlighting.inheritedMethodInvocation.italic=false 
 /bundle_defaults/org.eclipse.wst.jsdt.ui/java_doc_default_bold=false 
 /bundle_defaults/org.eclipse.wst.xml.ui/tagAttributeValue=\#2a00ff | null | false | true 
 /bundle_defaults/org.eclipse.wst.jsdt.core/org.eclipse.wst.jsdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 
 /bundle_defaults/org.eclipse.ui/USE_WINDOW_WORKING_SET_BY_DEFAULT=false 
 /bundle_defaults/org.eclipse.jdt.core/org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert 
 /bundle_defaults/org.eclipse.jdt.ui/org.eclipse.jdt.ui.flatPackagesInPackageExplorer=true 
 /bundle_defaults/org.eclipse.wst.jsdt.core/org.eclipse.wst.jsdt.core.codeComplete.staticFieldPrefixes= 
 /bundle_defaults/org.eclipse.ui.editors/additionIndicationColor=188,188,222 
 /bundle_defaults/org.eclipse.jdt.ui/smartPaste=true 
 /bundle_defaults/org.eclipse.wst.jsdt.ui/semanticHighlighting.objectInitializer.bold=true 
 /bundle_defaults/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled 
 /bundle_defaults/org.eclipse.jdt.ui/java_keyword_italic=false 
 /bundle_defaults/org.eclipse.wst.jsdt.ui/Search.usereducemenu=true 
 /bundle_defaults/org.eclipse.jdt.core/org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert 
 /bundle_defaults/org.eclipse.jdt.core/org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true 
 /bundle_defaults/org.eclipse.jdt.ui/spelling_ignore_urls=true 
 /bundle_defaults/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.problem.uninternedIdentityComparison=disabled 
 /bundle_defaults/org.eclipse.jdt.ui/content_assist_autoactivation_triggers_javadoc=@\# 
 /bundle_defaults/org.eclipse.jdt.ui/content_assist_autoactivation=true 
 /bundle_defaults/org.eclipse.wst.jsdt.ui/markBreakContinueTargets=true 
 /bundle_defaults/org.eclipse.team.cvs.ui/pref_timeout=60 
 /bundle_defaults/org.eclipse.jdt.ui/java_bracket_bold=false 
 /bundle_defaults/org.eclipse.team.cvs.ui/pref_edit_action=editInBackground 
 /bundle_defaults/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning 
 /bundle_defaults/org.eclipse.team.cvs.ui/pref_commit_files_display_threshold=1000 
 detail.orientation.underneath 

 



Install Java EE 7 certified JBoss WildFly application server
http://www.wildfly.org/

 8.1.0.Final     2014-05-30     Java EE7 Full & Web Distribution     LGPL  

 tar xzvf wildfly-8.1.0.Final.tar.gz   


Start JBoss AS
 [dave@localhost bin]$ pwd  
 /app/wildfly-8.1.0.Final/bin 
 [dave@localhost bin]$ ./standalone.sh  


 =========================================================================  
  JBoss Bootstrap Environment 
  JBOSS_HOME: /app/wildfly-8.1.0.Final 
  JAVA: /usr/java/jdk1.7.0_60/bin/java 
  JAVA_OPTS: -server -Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true 
 ========================================================================= 


Install Eclipse JBoss Tools

Install WildFly server

Install JBoss helloworld example


Fix Maven setup for JBoss AS

Use WildFly Maven plugin
https://docs.jboss.org/wildfly/plugins/maven/latest/examples/deployment-example.html



Run deploy from command line
 [dave@localhost jboss-helloworld]$ mvn install wildfly:deploy 



Run example on server 

JBoss Wildfly 8.2 JMS configuration - JTA, HornetQ

$
0
0
Using JBoss Wildfly quickstart https://github.com/wildfly/quickstart/tree/master/jta-crash-rec

Start server in full mode
[dave@localhost bin]$ ./standalone.sh -c standalone-full.xml
=========================================================================

JBoss Bootstrap Environment

JBOSS_HOME: /app/wildfly-8.2.0.Final

JAVA: /usr/java/jdk1.7.0_60/bin/java

JAVA_OPTS: -server -Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true


Deploy quickstart jta-crash-rec
[dave@localhost quickstart-master]$ cd jta-crash-rec/
[dave@localhost jta-crash-rec]$ pwd
/home/dave/workspace/quickstart-master/jta-crash-rec
[dave@localhost jta-crash-rec]$ mvn install wildfly:deploy

Configure debug logging on JTA Arjuna module

Access the quickstart
http://localhost:8080/wildfly-jta-crash-rec/XA?key=&value=&submit=Submit
Debug of MessageListener transaction
23:06:38,342 DEBUG [org.hornetq.core.server] (hornetq-expiry-reaper-thread) Cannot expire from jms.queue.ExpiryQueue into jms.queue.ExpiryQueue
23:06:40,820 DEBUG [org.hibernate.engine.transaction.internal.TransactionCoordinatorImpl] (default task-7) Skipping JTA sync registration due to auto join checking
23:06:40,821 DEBUG [org.hibernate.engine.transaction.internal.TransactionCoordinatorImpl] (default task-7) successfully registered Synchronization
23:06:40,821 DEBUG [org.hibernate.jpa.spi.AbstractEntityManagerImpl] (default task-7) Looking for a JTA transaction to join
23:06:40,821 DEBUG [org.jboss.as.jpa] (default task-7) default task-7:transaction scoped EntityManager [wildfly-jta-crash-rec.war#primary]: created entity manager session TransactionImple < ac, BasicAction: 0:ffff7f000001:-520944e9:55089cdc:103 status: ActionStatus.RUNNING >
23:06:40,821 DEBUG [org.hibernate.SQL] (default task-7) select kvpair0_.name as name1_0_, kvpair0_.value as value2_0_ from KVPair kvpair0_
23:06:40,822 INFO [stdout] (default task-7) Hibernate: select kvpair0_.name as name1_0_, kvpair0_.value as value2_0_ from KVPair kvpair0_
23:06:40,822 DEBUG [org.hibernate.engine.jdbc.internal.LogicalConnectionImpl] (default task-7) Obtaining JDBC connection
23:06:40,822 DEBUG [org.hibernate.engine.jdbc.internal.LogicalConnectionImpl] (default task-7) Obtained JDBC connection
23:06:40,824 DEBUG [org.hibernate.loader.Loader] (default task-7) Result row: EntityKey[org.jboss.as.quickstarts.xa.KVPair#k15]
23:06:40,824 DEBUG [org.hibernate.engine.internal.TwoPhaseLoad] (default task-7) Resolving associations for [org.jboss.as.quickstarts.xa.KVPair#k15]
23:06:40,824 DEBUG [org.hibernate.engine.internal.TwoPhaseLoad] (default task-7) Done materializing entity [org.jboss.as.quickstarts.xa.KVPair#k15]
23:06:40,824 DEBUG [org.hibernate.engine.jdbc.internal.LogicalConnectionImpl] (default task-7) Releasing JDBC connection
23:06:40,825 DEBUG [org.hibernate.engine.jdbc.internal.LogicalConnectionImpl] (default task-7) Released JDBC connection
23:06:40,825 DEBUG [org.hibernate.event.internal.AbstractFlushingEventListener] (default task-7) Processing flush-time cascades
23:06:40,825 DEBUG [org.hibernate.event.internal.AbstractFlushingEventListener] (default task-7) Dirty checking collections
23:06:40,825 DEBUG [org.hibernate.event.internal.AbstractFlushingEventListener] (default task-7) Flushed: 0 insertions, 0 updates, 0 deletions to 1 objects
23:06:40,825 DEBUG [org.hibernate.event.internal.AbstractFlushingEventListener] (default task-7) Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
23:06:40,825 DEBUG [org.hibernate.internal.util.EntityPrinter] (default task-7) Listing entities:
23:06:40,826 DEBUG [org.hibernate.internal.util.EntityPrinter] (default task-7) org.jboss.as.quickstarts.xa.KVPair{value=v15 updated via JMS, key=k15}
23:06:40,826 DEBUG [org.hibernate.engine.jdbc.internal.LogicalConnectionImpl] (default task-7) Releasing JDBC connection
23:06:40,826 DEBUG [org.jboss.as.jpa] (default task-7) default task-7:transaction scoped EntityManager [wildfly-jta-crash-rec.war#primary]: closing entity managersession
23:06:40,826 DEBUG [org.hibernate.engine.jdbc.internal.LogicalConnectionImpl] (default task-7) Aggressively releasing JDBC connection
23:06:53,782 DEBUG [org.hibernate.engine.transaction.internal.TransactionCoordinatorImpl] (default task-8) Skipping JTA sync registration due to auto join checking
23:06:53,782 DEBUG [org.hibernate.engine.transaction.internal.TransactionCoordinatorImpl] (default task-8) successfully registered Synchronization
23:06:53,782 DEBUG [org.hibernate.jpa.spi.AbstractEntityManagerImpl] (default task-8) Looking for a JTA transaction to join
23:06:53,783 DEBUG [org.jboss.as.jpa] (default task-8) default task-8:transaction scoped EntityManager [wildfly-jta-crash-rec.war#primary]: created entity manager session TransactionImple < ac, BasicAction: 0:ffff7f000001:-520944e9:55089cdc:10a status: ActionStatus.RUNNING >
23:06:53,783 DEBUG [org.jboss.as.jpa] (default task-8) default task-8:transaction scoped EntityManager [wildfly-jta-crash-rec.war#primary]: reuse entity manager session already in tx TransactionImple < ac, BasicAction: 0:ffff7f000001:-520944e9:55089cdc:10a status: ActionStatus.RUNNING >
23:06:53,783 DEBUG [org.hibernate.SQL] (default task-8) select kvpair0_.name as name1_0_0_, kvpair0_.value as value2_0_0_ from KVPair kvpair0_ where kvpair0_.name=?
23:06:53,783 INFO [stdout] (default task-8) Hibernate: select kvpair0_.name as name1_0_0_, kvpair0_.value as value2_0_0_ from KVPair kvpair0_ where kvpair0_.name=?
23:06:53,783 DEBUG [org.hibernate.engine.jdbc.internal.LogicalConnectionImpl] (default task-8) Obtaining JDBC connection
23:06:53,785 DEBUG [org.hibernate.engine.jdbc.internal.LogicalConnectionImpl] (default task-8) Obtained JDBC connection
23:06:53,787 DEBUG [org.hibernate.engine.jdbc.internal.LogicalConnectionImpl] (default task-8) Releasing JDBC connection
23:06:53,787 DEBUG [org.hibernate.engine.jdbc.internal.LogicalConnectionImpl] (default task-8) Released JDBC connection
23:06:53,787 DEBUG [org.hibernate.loader.entity.plan.AbstractLoadPlanBasedEntityLoader] (default task-8) Done entity load : org.jboss.as.quickstarts.xa.KVPair#k16
23:06:53,788 DEBUG [org.jboss.as.jpa] (default task-8) default task-8:transaction scoped EntityManager [wildfly-jta-crash-rec.war#primary]: reuse entity manager session already in tx TransactionImple < ac, BasicAction: 0:ffff7f000001:-520944e9:55089cdc:10a status: ActionStatus.RUNNING >
23:06:53,788 DEBUG [org.hibernate.event.internal.AbstractSaveEventListener] (default task-8) Generated identifier: k16, using strategy: org.hibernate.id.Assigned
23:06:53,792 DEBUG [org.hibernate.event.internal.AbstractFlushingEventListener] (default task-8) Processing flush-time cascades
23:06:53,793 DEBUG [org.hibernate.event.internal.AbstractFlushingEventListener] (default task-8) Dirty checking collections
23:06:53,793 DEBUG [org.hibernate.event.internal.AbstractFlushingEventListener] (default task-8) Flushed: 1 insertions, 0 updates, 0 deletions to 1 objects
23:06:53,793 DEBUG [org.hibernate.event.internal.AbstractFlushingEventListener] (default task-8) Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
23:06:53,794 DEBUG [org.hibernate.internal.util.EntityPrinter] (default task-8) Listing entities:
23:06:53,794 DEBUG [org.hibernate.internal.util.EntityPrinter] (default task-8) org.jboss.as.quickstarts.xa.KVPair{value=v16, key=k16}
23:06:53,794 DEBUG [org.hibernate.SQL] (default task-8) insert into KVPair (value, name) values (?, ?)
23:06:53,795 INFO [stdout] (default task-8) Hibernate: insert into KVPair (value, name) values (?, ?)
23:06:53,795 DEBUG [org.hibernate.engine.jdbc.internal.LogicalConnectionImpl] (default task-8) Obtaining JDBC connection
23:06:53,796 DEBUG [org.hibernate.engine.jdbc.internal.LogicalConnectionImpl] (default task-8) Obtained JDBC connection
23:06:53,797 DEBUG [org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl] (default task-8) Skipping aggressive release due to manual disabling
23:06:53,797 DEBUG [org.hibernate.engine.jdbc.internal.LogicalConnectionImpl] (default task-8) Releasing JDBC connection
23:06:53,798 DEBUG [org.hibernate.engine.jdbc.internal.LogicalConnectionImpl] (default task-8) Released JDBC connection
23:06:53,886 DEBUG [org.hornetq.core.server] (Thread-12 (HornetQ-server-HornetQServerImpl::serverUUID=3f93832c-cce0-11e4-85a9-c34d99e66ea7-733564457)) QueueImpl[name=jms.queue.jta-crash-rec-quickstart, postOffice=PostOfficeImpl [server=HornetQServerImpl::serverUUID=3f93832c-cce0-11e4-85a9-c34d99e66ea7]]@57fd577 doing deliver. messageReferences=0
23:06:53,888 DEBUG [org.jboss.as.jpa] (default task-8) default task-8:transaction scoped EntityManager [wildfly-jta-crash-rec.war#primary]: closing entity managersession
23:06:53,888 DEBUG [org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl] (default task-8) HHH000420: Closing un-released batch
23:06:53,889 DEBUG [org.hibernate.engine.jdbc.internal.LogicalConnectionImpl] (default task-8) Aggressively releasing JDBC connection
23:06:53,891 DEBUG [org.hibernate.engine.transaction.internal.TransactionCoordinatorImpl] (default task-8) Skipping JTA sync registration due to auto join checking
23:06:53,890 DEBUG [org.hornetq.core.client] (Thread-22 (HornetQ-client-global-threads-141278138)) client ack messageID = 262
23:06:53,891 DEBUG [org.hibernate.engine.transaction.internal.TransactionCoordinatorImpl] (default task-8) successfully registered Synchronization
23:06:53,891 DEBUG [org.hibernate.jpa.spi.AbstractEntityManagerImpl] (default task-8) Looking for a JTA transaction to join
23:06:53,892 DEBUG [org.jboss.as.jpa] (default task-8) default task-8:transaction scoped EntityManager [wildfly-jta-crash-rec.war#primary]: created entity manager session TransactionImple < ac, BasicAction: 0:ffff7f000001:-520944e9:55089cdc:119 status: ActionStatus.RUNNING >
23:06:53,892 DEBUG [org.hibernate.SQL] (default task-8) select kvpair0_.name as name1_0_, kvpair0_.value as value2_0_ from KVPair kvpair0_
23:06:53,893 INFO [stdout] (default task-8) Hibernate: select kvpair0_.name as name1_0_, kvpair0_.value as value2_0_ from KVPair kvpair0_
23:06:53,893 DEBUG [org.hibernate.engine.jdbc.internal.LogicalConnectionImpl] (default task-8) Obtaining JDBC connection
23:06:53,894 DEBUG [org.hibernate.engine.jdbc.internal.LogicalConnectionImpl] (default task-8) Obtained JDBC connection
23:06:53,896 INFO [org.jboss.as.quickstarts.xa.DbUpdaterMDB] (Thread-22 (HornetQ-client-global-threads-141278138)) Received Message: HornetQMessage[ID:eb7c1627-ccf1-11e4-a9c4-0776b366296e]:PERSISTENT
23:06:53,896 DEBUG [org.hibernate.engine.transaction.internal.TransactionCoordinatorImpl] (Thread-22 (HornetQ-client-global-threads-141278138)) Skipping JTA sync registration due to auto join checking
23:06:53,896 DEBUG [org.hibernate.engine.transaction.internal.TransactionCoordinatorImpl] (Thread-22 (HornetQ-client-global-threads-141278138)) successfully registered Synchronization
23:06:53,896 DEBUG [org.hibernate.jpa.spi.AbstractEntityManagerImpl] (Thread-22 (HornetQ-client-global-threads-141278138)) Looking for a JTA transaction to join
23:06:53,897 DEBUG [org.jboss.as.jpa] (Thread-22 (HornetQ-client-global-threads-141278138)) Thread-22 (HornetQ-client-global-threads-141278138):transaction scoped EntityManager [wildfly-jta-crash-rec.war#primary]: created entity manager session TransactionImple < ac, BasicAction: 0:ffff7f000001:-520944e9:55089cdc:115 status: ActionStatus.RUNNING >
23:06:53,897 DEBUG [org.jboss.as.jpa] (Thread-22 (HornetQ-client-global-threads-141278138)) Thread-22 (HornetQ-client-global-threads-141278138):transaction scoped EntityManager [wildfly-jta-crash-rec.war#primary]: reuse entity manager session already in tx TransactionImple < ac, BasicAction: 0:ffff7f000001:-520944e9:55089cdc:115 status: ActionStatus.RUNNING >
23:06:53,897 DEBUG [org.hibernate.loader.Loader] (default task-8) Result row: EntityKey[org.jboss.as.quickstarts.xa.KVPair#k15]
23:06:53,897 DEBUG [org.hibernate.SQL] (Thread-22 (HornetQ-client-global-threads-141278138)) select kvpair0_.name as name1_0_0_, kvpair0_.value as value2_0_0_ from KVPair kvpair0_ where kvpair0_.name=?
23:06:53,898 INFO [stdout] (Thread-22 (HornetQ-client-global-threads-141278138)) Hibernate: select kvpair0_.name as name1_0_0_, kvpair0_.value as value2_0_0_ from KVPair kvpair0_ where kvpair0_.name=?
23:06:53,898 DEBUG [org.hibernate.loader.Loader] (default task-8) Result row: EntityKey[org.jboss.as.quickstarts.xa.KVPair#k16]
23:06:53,898 DEBUG [org.hibernate.engine.jdbc.internal.LogicalConnectionImpl] (Thread-22 (HornetQ-client-global-threads-141278138)) Obtaining JDBC connection
23:06:53,899 DEBUG [org.hibernate.engine.jdbc.internal.LogicalConnectionImpl] (Thread-22 (HornetQ-client-global-threads-141278138)) Obtained JDBC connection
23:06:53,899 DEBUG [org.hibernate.engine.internal.TwoPhaseLoad] (default task-8) Resolving associations for [org.jboss.as.quickstarts.xa.KVPair#k15]
23:06:53,900 DEBUG [org.hibernate.engine.internal.TwoPhaseLoad] (default task-8) Done materializing entity [org.jboss.as.quickstarts.xa.KVPair#k15]
23:06:53,900 DEBUG [org.hibernate.engine.internal.TwoPhaseLoad] (default task-8) Resolving associations for [org.jboss.as.quickstarts.xa.KVPair#k16]
23:06:53,900 DEBUG [org.hibernate.engine.internal.TwoPhaseLoad] (default task-8) Done materializing entity [org.jboss.as.quickstarts.xa.KVPair#k16]
23:06:53,900 DEBUG [org.hibernate.engine.jdbc.internal.LogicalConnectionImpl] (default task-8) Releasing JDBC connection
23:06:53,901 DEBUG [org.hibernate.engine.jdbc.internal.LogicalConnectionImpl] (default task-8) Released JDBC connection
23:06:53,902 DEBUG [org.hibernate.event.internal.AbstractFlushingEventListener] (default task-8) Processing flush-time cascades
23:06:53,902 DEBUG [org.hibernate.event.internal.AbstractFlushingEventListener] (default task-8) Dirty checking collections
23:06:53,902 DEBUG [org.hibernate.event.internal.AbstractFlushingEventListener] (default task-8) Flushed: 0 insertions, 0 updates, 0 deletions to 2 objects
23:06:53,903 DEBUG [org.hibernate.event.internal.AbstractFlushingEventListener] (default task-8) Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
23:06:53,903 DEBUG [org.hibernate.loader.plan.exec.process.internal.ResultSetProcessorImpl] (Thread-22 (HornetQ-client-global-threads-141278138)) Starting ResultSet row #0
23:06:53,903 DEBUG [org.hibernate.internal.util.EntityPrinter] (default task-8) Listing entities:
23:06:53,903 DEBUG [org.hibernate.loader.plan.exec.process.internal.EntityReferenceInitializerImpl] (Thread-22 (HornetQ-client-global-threads-141278138)) On call to EntityIdentifierReaderImpl#resolve, EntityKey was already known; should only happen on root returns with an optional identifier specified
23:06:53,903 DEBUG [org.hibernate.internal.util.EntityPrinter] (default task-8) org.jboss.as.quickstarts.xa.KVPair{value=v15 updated via JMS, key=k15}
23:06:53,903 DEBUG [org.hibernate.internal.util.EntityPrinter] (default task-8) org.jboss.as.quickstarts.xa.KVPair{value=v16, key=k16}
23:06:53,903 DEBUG [org.hibernate.engine.internal.TwoPhaseLoad] (Thread-22 (HornetQ-client-global-threads-141278138)) Resolving associations for [org.jboss.as.quickstarts.xa.KVPair#k16]
23:06:53,903 DEBUG [org.hibernate.engine.jdbc.internal.LogicalConnectionImpl] (default task-8) Releasing JDBC connection
23:06:53,904 DEBUG [org.hibernate.engine.internal.TwoPhaseLoad] (Thread-22 (HornetQ-client-global-threads-141278138)) Done materializing entity [org.jboss.as.quickstarts.xa.KVPair#k16]
23:06:53,904 DEBUG [org.jboss.as.jpa] (default task-8) default task-8:transaction scoped EntityManager [wildfly-jta-crash-rec.war#primary]: closing entity managersession
23:06:53,904 DEBUG [org.hibernate.engine.jdbc.internal.LogicalConnectionImpl] (Thread-22 (HornetQ-client-global-threads-141278138)) Releasing JDBC connection
23:06:53,904 DEBUG [org.hibernate.engine.jdbc.internal.LogicalConnectionImpl] (default task-8) Aggressively releasing JDBC connection
23:06:53,904 DEBUG [org.hibernate.engine.jdbc.internal.LogicalConnectionImpl] (Thread-22 (HornetQ-client-global-threads-141278138)) Released JDBC connection
23:06:53,905 DEBUG [org.hibernate.loader.entity.plan.AbstractLoadPlanBasedEntityLoader] (Thread-22 (HornetQ-client-global-threads-141278138)) Done entity load : org.jboss.as.quickstarts.xa.KVPair#k16
23:06:53,905 DEBUG [org.jboss.as.jpa] (Thread-22 (HornetQ-client-global-threads-141278138)) Thread-22 (HornetQ-client-global-threads-141278138):transaction scoped EntityManager [wildfly-jta-crash-rec.war#primary]: reuse entity manager session already in tx TransactionImple < ac, BasicAction: 0:ffff7f000001:-520944e9:55089cdc:115 status: ActionStatus.RUNNING >
23:06:53,905 INFO [org.jboss.as.quickstarts.xa.DbUpdaterMDB] (Thread-22 (HornetQ-client-global-threads-141278138)) JTA Crash Record Quickstart: key value pair updated via JMS
23:06:53,906 DEBUG [org.hibernate.event.internal.AbstractFlushingEventListener] (Thread-22 (HornetQ-client-global-threads-141278138)) Processing flush-time cascades
23:06:53,907 DEBUG [org.hibernate.event.internal.AbstractFlushingEventListener] (Thread-22 (HornetQ-client-global-threads-141278138)) Dirty checking collections
23:06:53,907 DEBUG [org.hibernate.event.internal.AbstractFlushingEventListener] (Thread-22 (HornetQ-client-global-threads-141278138)) Flushed: 0 insertions, 1 updates, 0 deletions to 1 objects
23:06:53,908 DEBUG [org.hibernate.event.internal.AbstractFlushingEventListener] (Thread-22 (HornetQ-client-global-threads-141278138)) Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
23:06:53,908 DEBUG [org.hibernate.internal.util.EntityPrinter] (Thread-22 (HornetQ-client-global-threads-141278138)) Listing entities:
23:06:53,908 DEBUG [org.hibernate.internal.util.EntityPrinter] (Thread-22 (HornetQ-client-global-threads-141278138)) org.jboss.as.quickstarts.xa.KVPair{value=v16 updated via JMS, key=k16}
23:06:53,909 DEBUG [org.hibernate.SQL] (Thread-22 (HornetQ-client-global-threads-141278138)) update KVPair set value=? where name=?
23:06:53,909 INFO [stdout] (Thread-22 (HornetQ-client-global-threads-141278138)) Hibernate: update KVPair set value=? where name=?
23:06:53,909 DEBUG [org.hibernate.engine.jdbc.internal.LogicalConnectionImpl] (Thread-22 (HornetQ-client-global-threads-141278138)) Obtaining JDBC connection
23:06:53,910 DEBUG [org.hibernate.engine.jdbc.internal.LogicalConnectionImpl] (Thread-22 (HornetQ-client-global-threads-141278138)) Obtained JDBC connection
23:06:53,911 DEBUG [org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl] (Thread-22 (HornetQ-client-global-threads-141278138)) Skipping aggressive release due to manual disabling
23:06:53,911 DEBUG [org.hibernate.engine.jdbc.internal.LogicalConnectionImpl] (Thread-22 (HornetQ-client-global-threads-141278138)) Releasing JDBC connection
23:06:53,912 DEBUG [org.hibernate.engine.jdbc.internal.LogicalConnectionImpl] (Thread-22 (HornetQ-client-global-threads-141278138)) Released JDBC connection
23:06:53,977 DEBUG [org.jboss.as.jpa] (Thread-22 (HornetQ-client-global-threads-141278138)) Thread-22 (HornetQ-client-global-threads-141278138):transaction scoped EntityManager [wildfly-jta-crash-rec.war#primary]: closing entity managersession
23:06:53,977 DEBUG [org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl] (Thread-22 (HornetQ-client-global-threads-141278138)) HHH000420: Closing un-released batch
23:06:53,977 DEBUG [org.hibernate.engine.jdbc.internal.LogicalConnectionImpl] (Thread-22 (HornetQ-client-global-threads-141278138)) Aggressively releasing JDBC connection
23:06:54,656 DEBUG [com.arjuna.ats.arjuna] (Periodic Recovery) PeriodicRecovery: background thread Status <== SCANNING
23:06:54,656 DEBUG [com.arjuna.ats.arjuna] (Periodic Recovery) PeriodicRecovery: background thread scanning
23:06:54,657 DEBUG [com.arjuna.ats.arjuna] (Periodic Recovery) Periodic recovery first pass at Tue, 17 Mar 2015 23:06:54
23:06:54,657 DEBUG [com.arjuna.ats.arjuna] (Periodic Recovery) AtomicActionRecoveryModule first pass
23:06:54,657 DEBUG [com.arjuna.ats.arjuna] (Periodic Recovery) processing /StateManager/BasicAction/TwoPhaseCoordinator/AtomicAction transactions
23:06:54,657 DEBUG [com.arjuna.ats.arjuna] (Periodic Recovery)
23:06:54,657 DEBUG [com.arjuna.ats.txoj] (Periodic Recovery) TORecoveryModule - first pass
23:06:54,659 DEBUG [com.arjuna.ats.arjuna] (Periodic Recovery)
23:06:54,659 DEBUG [com.arjuna.ats.jta] (Periodic Recovery) Local XARecoveryModule - first pass
23:06:54,660 DEBUG [org.jboss.jca.core.tx.jbossts.XAResourceRecoveryImpl] (Periodic Recovery) Recovery user name=sa
23:06:54,660 DEBUG [org.jboss.jca.core.tx.jbossts.XAResourceRecoveryImpl] (Periodic Recovery) Recovery Subject=Subject:
Principal: sa
Private Credential: javax.resource.spi.security.PasswordCredential@35c11c

23:06:54,660 DEBUG [org.jboss.jca.core.tx.jbossts.XAResourceRecoveryImpl] (Periodic Recovery) Open managed connection (Subject:
Principal: sa
Private Credential: javax.resource.spi.security.PasswordCredential@35c11c
)
23:06:54,660 DEBUG [org.jboss.jca.core.tx.jbossts.XAResourceRecoveryImpl] (Periodic Recovery) Open connection (org.jboss.jca.adapters.jdbc.xa.XAManagedConnection@12baccec, Subject:
Principal: sa
Private Credential: javax.resource.spi.security.PasswordCredential@35c11c
)
23:06:54,661 DEBUG [org.jboss.jca.core.tx.jbossts.XAResourceRecoveryImpl] (Periodic Recovery) Closing connection for recovery check (org.jboss.jca.adapters.jdbc.jdk7.WrappedConnectionJDK7@6cb68463)
23:06:54,661 DEBUG [org.jboss.jca.core.tx.jbossts.XAResourceRecoveryImpl] (Periodic Recovery) Force close=false
23:06:54,661 DEBUG [org.jboss.jca.core.tx.jbossts.XAResourceRecoveryImpl] (Periodic Recovery) Recovery XAResource=XAResourceWrapperImpl@42adb757[xaResource=org.jboss.jca.adapters.jdbc.xa.XAManagedConnection@12baccec pad=false overrideRmValue=false productName=H2 productVersion=1.3.173 (2013-07-28) jndiName=java:jboss/datasources/JTACrashRecQuickstartDS] for java:jboss/datasources/JTACrashRecQuickstartDS
23:06:54,662 DEBUG [org.hornetq.jms.server] (Periodic Recovery)
=======================================================================================
23:06:54,662 DEBUG [org.hornetq.jms.server] (Periodic Recovery) Returning the following list on getXAREsources:
23:06:54,662 DEBUG [org.hornetq.jms.server] (Periodic Recovery) server-id=3f93832c-cce0-11e4-85a9-c34d99e66ea7, value=HornetQXAResourceWrapper [serverLocator=ServerLocatorImpl [initialConnectors=[TransportConfiguration(name=c9103c7d-ccec-11e4-a9c4-0776b366296e, factory=org-hornetq-core-remoting-impl-invm-InVMConnectorFactory) ?server-id=0], discoveryGroupConfiguration=null], csf=ClientSessionFactoryImpl [serverLocator=ServerLocatorImpl [initialConnectors=[TransportConfiguration(name=c9103c7d-ccec-11e4-a9c4-0776b366296e, factory=org-hornetq-core-remoting-impl-invm-InVMConnectorFactory) ?server-id=0], discoveryGroupConfiguration=null], connectorConfig=TransportConfiguration(name=c9103c7d-ccec-11e4-a9c4-0776b366296e, factory=org-hornetq-core-remoting-impl-invm-InVMConnectorFactory) ?server-id=0, backupConfig=null], delegate=DelegatingSession [session=ClientSessionImpl [name=14033f14-cced-11e4-a9c4-0776b366296e, username=null, closed=false, factory = ClientSessionFactoryImpl [serverLocator=ServerLocatorImpl [initialConnectors=[TransportConfiguration(name=c9103c7d-ccec-11e4-a9c4-0776b366296e, factory=org-hornetq-core-remoting-impl-invm-InVMConnectorFactory) ?server-id=0], discoveryGroupConfiguration=null], connectorConfig=TransportConfiguration(name=c9103c7d-ccec-11e4-a9c4-0776b366296e, factory=org-hornetq-core-remoting-impl-invm-InVMConnectorFactory) ?server-id=0, backupConfig=null], metaData=()]@25a3d1], xaRecoveryConfigs=[XARecoveryConfig [transportConfiguration = [TransportConfiguration(name=c9103c7d-ccec-11e4-a9c4-0776b366296e, factory=org-hornetq-core-remoting-impl-invm-InVMConnectorFactory) ?server-id=0], discoveryConfiguration = null, username=null, password=****]], instance=442315688]
23:06:54,662 DEBUG [org.hornetq.jms.server] (Periodic Recovery) =======================================================================================

23:06:54,663 DEBUG [com.arjuna.ats.jta] (Periodic Recovery) xarecovery of RecoveryOnlyEJBXAResource{receiverContext=EJBReceiverContext{clientContext=org.jboss.ejb.client.EJBClientContext@1a5c141b, receiver=org.jboss.as.ejb3.remote.LocalEjbReceiver@2f46ac03}, transactionOriginNodeIdentifier='1'}
23:06:54,663 DEBUG [org.jboss.ejb.client.txn] (Periodic Recovery) Send recover request for transaction origin node identifier 1 to EJB receiver with node name localhost
23:06:54,663 DEBUG [com.arjuna.ats.jta] (Periodic Recovery) Found 0 xids in doubt
23:06:54,663 DEBUG [com.arjuna.ats.jta] (Periodic Recovery) xarecovery of XAResourceWrapperImpl@42adb757[xaResource=org.jboss.jca.adapters.jdbc.xa.XAManagedConnection@12baccec pad=false overrideRmValue=false productName=H2 productVersion=1.3.173 (2013-07-28) jndiName=java:jboss/datasources/JTACrashRecQuickstartDS]
23:06:54,664 DEBUG [com.arjuna.ats.jta] (Periodic Recovery) Found 0 xids in doubt
23:06:54,664 DEBUG [com.arjuna.ats.jta] (Periodic Recovery) xarecovery of HornetQXAResourceWrapper [serverLocator=ServerLocatorImpl [initialConnectors=[TransportConfiguration(name=c9103c7d-ccec-11e4-a9c4-0776b366296e, factory=org-hornetq-core-remoting-impl-invm-InVMConnectorFactory) ?server-id=0], discoveryGroupConfiguration=null], csf=ClientSessionFactoryImpl [serverLocator=ServerLocatorImpl [initialConnectors=[TransportConfiguration(name=c9103c7d-ccec-11e4-a9c4-0776b366296e, factory=org-hornetq-core-remoting-impl-invm-InVMConnectorFactory) ?server-id=0], discoveryGroupConfiguration=null], connectorConfig=TransportConfiguration(name=c9103c7d-ccec-11e4-a9c4-0776b366296e, factory=org-hornetq-core-remoting-impl-invm-InVMConnectorFactory) ?server-id=0, backupConfig=null], delegate=DelegatingSession [session=ClientSessionImpl [name=14033f14-cced-11e4-a9c4-0776b366296e, username=null, closed=false, factory = ClientSessionFactoryImpl [serverLocator=ServerLocatorImpl [initialConnectors=[TransportConfiguration(name=c9103c7d-ccec-11e4-a9c4-0776b366296e, factory=org-hornetq-core-remoting-impl-invm-InVMConnectorFactory) ?server-id=0], discoveryGroupConfiguration=null], connectorConfig=TransportConfiguration(name=c9103c7d-ccec-11e4-a9c4-0776b366296e, factory=org-hornetq-core-remoting-impl-invm-InVMConnectorFactory) ?server-id=0, backupConfig=null], metaData=()]@25a3d1], xaRecoveryConfigs=[XARecoveryConfig [transportConfiguration = [TransportConfiguration(name=c9103c7d-ccec-11e4-a9c4-0776b366296e, factory=org-hornetq-core-remoting-impl-invm-InVMConnectorFactory) ?server-id=0], discoveryConfiguration = null, username=null, password=****]], instance=442315688]
23:06:54,664 DEBUG [org.hornetq.jms.server] (Periodic Recovery) looking for recover at DelegatingSession [session=ClientSessionImpl [name=14033f14-cced-11e4-a9c4-0776b366296e, username=null, closed=false, factory = ClientSessionFactoryImpl [serverLocator=ServerLocatorImpl [initialConnectors=[TransportConfiguration(name=c9103c7d-ccec-11e4-a9c4-0776b366296e, factory=org-hornetq-core-remoting-impl-invm-InVMConnectorFactory) ?server-id=0], discoveryGroupConfiguration=null], connectorConfig=TransportConfiguration(name=c9103c7d-ccec-11e4-a9c4-0776b366296e, factory=org-hornetq-core-remoting-impl-invm-InVMConnectorFactory) ?server-id=0, backupConfig=null], metaData=()]@25a3d1] configuration [XARecoveryConfig [transportConfiguration = [TransportConfiguration(name=c9103c7d-ccec-11e4-a9c4-0776b366296e, factory=org-hornetq-core-remoting-impl-invm-InVMConnectorFactory) ?server-id=0], discoveryConfiguration = null, username=null, password=****]]
23:06:54,665 DEBUG [com.arjuna.ats.jta] (Periodic Recovery) Found 0 xids in doubt
23:06:54,665 DEBUG [com.arjuna.ats.arjuna] (Periodic Recovery)

Debug at TRACE level Start of transaction
2015-03-17 22:48:00,132 TRACE [org.xnio.listener] (default I/O-2) Invoking listener io.undertow.server.protocol.http.HttpOpenListener@7c41cb4e on channel org.xnio.nio.NioSocketStreamConnection@3512c7d3
2015-03-17 22:48:00,132 TRACE [io.undertow.request] (default I/O-2) Opened connection with /127.0.0.1:47595
2015-03-17 22:48:00,133 TRACE [org.xnio.nio.selector] (default I/O-2) Beginning select on sun.nio.ch.EPollSelectorImpl@6e222594
2015-03-17 22:48:00,133 TRACE [org.jboss.weld.Servlet] (default task-6) WELD-000708: Initializing request io.undertow.servlet.spec.HttpServletRequestImpl@3b1c643e
2015-03-17 22:48:00,134 TRACE [org.jboss.weld.Context] (default task-6) WELD-000222: Loading bean store org.jboss.weld.context.beanstore.http.LazySessionBeanStore@44f940c3 map from session null
2015-03-17 22:48:00,134 TRACE [org.jboss.weld.Bean] (default task-6) WELD-001545: MethodHandler processing call to public abstract void javax.transaction.UserTransaction.begin() throws javax.transaction.NotSupportedException,javax.transaction.SystemException for class org.jboss.weldx.transaction.UserTransaction$942642665$Proxy$_$$_Weld$Proxy$
2015-03-17 22:48:00,134 TRACE [com.arjuna.ats.jta] (default task-6) BaseTransaction.begin
2015-03-17 22:48:00,135 TRACE [com.arjuna.ats.arjuna] (default task-6) StateManager::StateManager( 2, 0 )
2015-03-17 22:48:00,135 TRACE [com.arjuna.ats.arjuna] (default task-6) BasicAction::BasicAction()
2015-03-17 22:48:00,135 TRACE [com.arjuna.ats.arjuna] (default task-6) BasicAction::Begin() for action-id 0:ffff7f000001:-520944e9:55089cdc:a6
2015-03-17 22:48:00,135 TRACE [com.arjuna.ats.arjuna] (default task-6) BasicAction::actionInitialise() for action-id 0:ffff7f000001:-520944e9:55089cdc:a6
2015-03-17 22:48:00,135 TRACE [com.arjuna.ats.arjuna] (default task-6) ActionHierarchy::ActionHierarchy(1)
2015-03-17 22:48:00,135 TRACE [com.arjuna.ats.arjuna] (default task-6) ActionHierarchy::add(0:ffff7f000001:-520944e9:55089cdc:a6, 1)
2015-03-17 22:48:00,135 TRACE [com.arjuna.ats.arjuna] (default task-6) BasicAction::addChildThread () action 0:ffff7f000001:-520944e9:55089cdc:a6 adding Thread[default task-6,5,main]
2015-03-17 22:48:00,135 TRACE [com.arjuna.ats.arjuna] (default task-6) BasicAction::addChildThread () action 0:ffff7f000001:-520944e9:55089cdc:a6 adding Thread[default task-6,5,main] result = true

Start of Hibernate transaction
2015-03-17 22:48:00,137 TRACE [com.arjuna.ats.jta] (default task-6) TransactionImple.getStatus: javax.transaction.Status.STATUS_ACTIVE
2015-03-17 22:48:00,137 TRACE [com.arjuna.ats.jta] (default task-6) TransactionSynchronizationRegistryImple.registerInterposedSynchronization
2015-03-17 22:48:00,137 TRACE [com.arjuna.ats.jta] (default task-6) TransactionImple.getStatus: javax.transaction.Status.STATUS_ACTIVE
2015-03-17 22:48:00,137 DEBUG [org.hibernate.engine.transaction.internal.TransactionCoordinatorImpl] (default task-6) successfully registered Synchronization
2015-03-17 22:48:00,137 DEBUG [org.hibernate.jpa.spi.AbstractEntityManagerImpl] (default task-6) Looking for a JTA transaction to join
2015-03-17 22:48:00,137 TRACE [com.arjuna.ats.jta] (default task-6) TransactionImple.getStatus: javax.transaction.Status.STATUS_ACTIVE
2015-03-17 22:48:00,137 TRACE [com.arjuna.ats.jta] (default task-6) TransactionImple.getStatus: javax.transaction.Status.STATUS_ACTIVE
2015-03-17 22:48:00,137 TRACE [org.hibernate.internal.SessionImpl] (default task-6) Setting flush mode to: AUTO
2015-03-17 22:48:00,138 TRACE [org.hibernate.internal.SessionImpl] (default task-6) Setting cache mode to: NORMAL
2015-03-17 22:48:00,138 DEBUG [org.jboss.as.jpa] (default task-6) default task-6:transaction scoped EntityManager [wildfly-jta-crash-rec.war#primary]: created entity manager session TransactionImple < ac, BasicAction: 0:ffff7f000001:-520944e9:55089cdc:a6 status: ActionStatus.RUNNING >
2015-03-17 22:48:00,138 TRACE [com.arjuna.ats.jta] (default task-6) TransactionSynchronizationRegistryImple.registerInterposedSynchronization
2015-03-17 22:48:00,138 TRACE [com.arjuna.ats.jta] (default task-6) TransactionImple.getStatus: javax.transaction.Status.STATUS_ACTIVE
2015-03-17 22:48:00,138 TRACE [com.arjuna.ats.jta] (default task-6) TransactionSynchronizationRegistryImple.putResource
2015-03-17 22:48:00,138 TRACE [com.arjuna.ats.jta] (default task-6) TransactionImple.getStatus: javax.transaction.Status.STATUS_ACTIVE
2015-03-17 22:48:00,138 TRACE [com.arjuna.ats.jta] (default task-6) TransactionImple.getStatus: javax.transaction.Status.STATUS_ACTIVE
2015-03-17 22:48:00,138 TRACE [com.arjuna.ats.jta] (default task-6) TransactionSynchronizationRegistryImple.getResource
2015-03-17 22:48:00,138 TRACE [com.arjuna.ats.jta] (default task-6) TransactionImple.getStatus: javax.transaction.Status.STATUS_ACTIVE
2015-03-17 22:48:00,138 DEBUG [org.jboss.as.jpa] (default task-6) default task-6:transaction scoped EntityManager [wildfly-jta-crash-rec.war#primary]: reuse entity manager session already in tx TransactionImple < ac, BasicAction: 0:ffff7f000001:-520944e9:55089cdc:a6 status: ActionStatus.RUNNING >
2015-03-17 22:48:00,139 TRACE [org.hibernate.internal.SessionImpl] (default task-6) Setting cache mode to: NORMAL
2015-03-17 22:48:00,139 TRACE [org.hibernate.event.internal.DefaultLoadEventListener] (default task-6) Loading entity: [org.jboss.as.quickstarts.xa.KVPair#k15]

Register resources into transaction
2015-03-17 22:48:00,142 TRACE [com.arjuna.ats.jta] (default task-6) TransactionImple.getStatus: javax.transaction.Status.STATUS_ACTIVE
2015-03-17 22:48:00,143 TRACE [com.arjuna.ats.jta] (default task-6) TransactionImple.enlistResource ( XAResourceWrapperImpl@2da65345[xaResource=org.jboss.jca.adapters.jdbc.xa.XAManagedConnection@2a4ee6d pad=false overrideRmValue=false productName=H2 productVersion=1.3.173 (2013-07-28) jndiName=java:jboss/datasources/JTACrashRecQuickstartDS] )
2015-03-17 22:48:00,143 TRACE [com.arjuna.ats.jta] (default task-6) TransactionImple.getStatus: javax.transaction.Status.STATUS_ACTIVE
2015-03-17 22:48:00,143 TRACE [com.arjuna.ats.arjuna] (default task-6) StateManager::StateManager( 1, 0 )
2015-03-17 22:48:00,143 TRACE [com.arjuna.ats.arjuna] (default task-6) AbstractRecord::AbstractRecord (0:ffff7f000001:-520944e9:55089cdc:ab, 1)
2015-03-17 22:48:00,143 TRACE [com.arjuna.ats.jta] (default task-6) XAResourceRecord.XAResourceRecord ( < formatId=131077, gtrid_length=29, bqual_length=36, tx_uid=0:ffff7f000001:-520944e9:55089cdc:a6, node_name=1, branch_uid=0:ffff7f000001:-520944e9:55089cdc:aa, subordinatenodename=null, eis_name=java:jboss/datasources/JTACrashRecQuickstartDS >, XAResourceWrapperImpl@2da65345[xaResource=org.jboss.jca.adapters.jdbc.xa.XAManagedConnection@2a4ee6d pad=false overrideRmValue=false productName=H2 productVersion=1.3.173 (2013-07-28) jndiName=java:jboss/datasources/JTACrashRecQuickstartDS] ), record id=0:ffff7f000001:-520944e9:55089cdc:ab
2015-03-17 22:48:00,143 TRACE [com.arjuna.ats.arjuna] (default task-6) RecordList::insert(RecordList: empty) : appending /StateManager/AbstractRecord/XAResourceRecord for 0:ffff7f000001:-520944e9:55089cdc:ab
2015-03-17 22:48:00,143 DEBUG [org.hibernate.engine.jdbc.internal.LogicalConnectionImpl] (default task-6) Obtained JDBC connection
2015-03-17 22:48:00,144 TRACE [com.arjuna.ats.jta] (default task-6) TransactionImple.getStatus: javax.transaction.Status.STATUS_ACTIVE
2015-03-17 22:48:00,144 TRACE [org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl] (default task-6) Registering statement [org.jboss.jca.adapters.jdbc.jdk7.WrappedPreparedStatementJDK7@176f445a]
2015-03-17 22:48:00,144 TRACE [org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl] (default task-6) Registering last query statement [org.jboss.jca.adapters.jdbc.jdk7.WrappedPreparedStatementJDK7@176f445a]
2015-03-17 22:48:00,144 TRACE [org.hibernate.type.descriptor.sql.BasicBinder] (default task-6) binding parameter [1] as [VARCHAR] - [k15]
2015-03-17 22:48:00,144 TRACE [org.hibernate.loader.plan.exec.internal.AbstractLoadPlanBasedLoader] (default task-6) Bound [2] parameters total
2015-03-17 22:48:00,169 TRACE [com.arjuna.ats.jta] (default task-6) TransactionImple.getStatus: javax.transaction.Status.STATUS_ACTIVE
2015-03-17 22:48:00,169 TRACE [org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl] (default task-6) Registering result set [rs43: org.h2.result.LocalResult@4d487c46 columns: 2 rows: 0 pos: -1]
2015-03-17 22:48:00,169 TRACE [org.hibernate.loader.plan.exec.process.internal.ResultSetProcessorImpl] (default task-6) Processing result set

Transaction commit
2015-03-17 22:48:00,269 TRACE [com.arjuna.ats.arjuna] (default task-6) BasicAction::phase2Commit() for action-id 0:ffff7f000001:-520944e9:55089cdc:a6
2015-03-17 22:48:00,270 TRACE [com.arjuna.ats.arjuna] (default task-6) BasicAction::doCommit (XAResourceRecord < resource:XAResourceWrapperImpl@2da65345[xaResource=org.jboss.jca.adapters.jdbc.xa.XAManagedConnection@2a4ee6d pad=false overrideRmValue=false productName=H2 productVersion=1.3.173 (2013-07-28) jndiName=java:jboss/datasources/JTACrashRecQuickstartDS], txid:< formatId=131077, gtrid_length=29, bqual_length=36, tx_uid=0:ffff7f000001:-520944e9:55089cdc:a6, node_name=1, branch_uid=0:ffff7f000001:-520944e9:55089cdc:aa, subordinatenodename=null, eis_name=java:jboss/datasources/JTACrashRecQuickstartDS >, heuristic: TwoPhaseOutcome.FINISH_OK, product: H2/1.3.173 (2013-07-28), jndiName: java:jboss/datasources/JTACrashRecQuickstartDS com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord@c3e0df8 >)
2015-03-17 22:48:00,270 TRACE [com.arjuna.ats.jta] (default task-6) XAResourceRecord.topLevelCommit for XAResourceRecord < resource:XAResourceWrapperImpl@2da65345[xaResource=org.jboss.jca.adapters.jdbc.xa.XAManagedConnection@2a4ee6d pad=false overrideRmValue=false productName=H2 productVersion=1.3.173 (2013-07-28) jndiName=java:jboss/datasources/JTACrashRecQuickstartDS], txid:< formatId=131077, gtrid_length=29, bqual_length=36, tx_uid=0:ffff7f000001:-520944e9:55089cdc:a6, node_name=1, branch_uid=0:ffff7f000001:-520944e9:55089cdc:aa, subordinatenodename=null, eis_name=java:jboss/datasources/JTACrashRecQuickstartDS >, heuristic: TwoPhaseOutcome.FINISH_OK, product: H2/1.3.173 (2013-07-28), jndiName: java:jboss/datasources/JTACrashRecQuickstartDS com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord@c3e0df8 >, record id=0:ffff7f000001:-520944e9:55089cdc:ab
2015-03-17 22:48:00,270 TRACE [com.arjuna.ats.arjuna] (default task-6) BasicAction::doCommit() result for action-id (0:ffff7f000001:-520944e9:55089cdc:a6) on record id: (0:ffff7f000001:-520944e9:55089cdc:ab) is (TwoPhaseOutcome.FINISH_OK) node id: (1)
2015-03-17 22:48:00,271 TRACE [com.arjuna.ats.arjuna] (default task-6) BasicAction::doCommit (XAResourceRecord < resource:XAResourceWrapperImpl@36398b1e[xaResource=org.hornetq.ra.HornetQRAXAResource@403647b1 pad=false overrideRmValue=null productName=HornetQ productVersion=2.0 jndiName=java:/JmsXA], txid:< formatId=131077, gtrid_length=29, bqual_length=36, tx_uid=0:ffff7f000001:-520944e9:55089cdc:a6, node_name=1, branch_uid=0:ffff7f000001:-520944e9:55089cdc:ad, subordinatenodename=null, eis_name=java:/JmsXA >, heuristic: TwoPhaseOutcome.FINISH_OK, product: HornetQ/2.0, jndiName: java:/JmsXA com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord@3e071b0f >)
2015-03-17 22:48:00,271 TRACE [com.arjuna.ats.jta] (default task-6) XAResourceRecord.topLevelCommit for XAResourceRecord < resource:XAResourceWrapperImpl@36398b1e[xaResource=org.hornetq.ra.HornetQRAXAResource@403647b1 pad=false overrideRmValue=null productName=HornetQ productVersion=2.0 jndiName=java:/JmsXA], txid:< formatId=131077, gtrid_length=29, bqual_length=36, tx_uid=0:ffff7f000001:-520944e9:55089cdc:a6, node_name=1, branch_uid=0:ffff7f000001:-520944e9:55089cdc:ad, subordinatenodename=null, eis_name=java:/JmsXA >, heuristic: TwoPhaseOutcome.FINISH_OK, product: HornetQ/2.0, jndiName: java:/JmsXA com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord@3e071b0f >, record id=0:ffff7f000001:-520944e9:55089cdc:ae
2015-03-17 22:48:00,271 TRACE [org.hornetq.ra] (default task-6) commit(< formatId=131077, gtrid_length=29, bqual_length=36, tx_uid=0:ffff7f000001:-520944e9:55089cdc:a6, node_name=1, branch_uid=0:ffff7f000001:-520944e9:55089cdc:ad, subordinatenodename=null, eis_name=java:/JmsXA >, false)

Weblogic auto login with boot properties file

$
0
0
Weblogic requires JVM property -Dweblogic.system.BootIdentityFile to locate boot.properties file
How a Server Uses a Boot Identity File at Startup
http://docs.oracle.com/cd/E14571_01/web.1111/e13708/overview.htm#START132


# create boot properties file
${DOMAIN_HOME}/bin/createBootProperties.sh

#use boot.properties from AdminServer dir - this is necessary for weblogic.Admin to run without password
JAVA_OPTIONS="${JAVA_OPTIONS} -Dweblogic.system.BootIdentityFile=${DOMAIN_HOME}/servers/${SERVER_NAME}/security/boot.properties"

# add trust key store
SSL_ARGS="${JAVA_OPTIONS} -Dweblogic.security.SSL.trustedCAKeyStore=/weblogic/weblogic10.3/wlserver_10.3/server/lib/DemoTrust.jks -Dweblogic.security.SSL
.ignoreHostnameVerification=true"

# check if admin server is not already running
echo "Checking if admin server is not already running..."
${JAVA_HOME}/bin/java ${SSL_ARGS} weblogic.Admin -url t3s://localhost:7001 PING



Without JVM property attempt to call Weblogic without password returns following error

WebLogic server requires a valid username and password for the command that you are trying to execute. Please try again


Password and username can be encrypted by weblogic.security.Encrypt which is using domain key /app/domains/base_domain/security/SerializedSystemIni.dat
http://docs.oracle.com/cd/E21764_01/web.1111/e13749/utils.htm#ADMRF142
http://docs.oracle.com/cd/E13222_01/wls/docs92/admin_ref/utils.html#wp1209592

#!/bin/bash

WL_HOME=/app/weblogic122/wlserver_12.1
DOMAIN_HOME=/app/domains/base_domain

. $WL_HOME/server/bin/setWLSEnv.sh

BOOT_PROPERTIES_DIR=$DOMAIN_HOME/servers/AdminServer/security
BOOT_PROPERTIES_FILE=$BOOT_PROPERTIES_DIR/boot.properties

mkdir -p $BOOT_PROPERTIES_DIR

printf "username=" > $BOOT_PROPERTIES_FILE
java -Dweblogic.RootDirectory=/app/domains/base_domain weblogic.security.Encrypt weblogic >> $BOOT_PROPERTIES_FILE
printf "password=" >> $BOOT_PROPERTIES_FILE
java -Dweblogic.RootDirectory=/app/domains/base_domain weblogic.security.Encrypt weblogic123 >> $BOOT_PROPERTIES_FILE


[dave@dave java]$ more /app/domains/base_domain/servers/AdminServer/security/boot.properties 
username={AES}DG3YOrSwfkK0YrxUM+4cMf+wF91eYhhHpF4wFbsydp0=
password={AES}pkaZZGMqSWQwFEMJSj+FO0aY9LatGJTkz4CZ0Un5v64=




Domain Configuration Files
http://docs.oracle.com/cd/E14571_01/web.1111/e13716/config_files.htm#i1091725
servers/server-name/security
This directory holds security-related files that can be or must be different for each Oracle WebLogic Server instance. The file boot.properties is an example of a file that resides here because it can differ from one server to the next. This directory also maintains files related to SSL keys.

Tree traversal

$
0
0
http://en.wikipedia.org/wiki/Tree_traversal
http://en.wikipedia.org/wiki/Breadth-first_search
http://en.wikipedia.org/wiki/Depth-first_search

Tree traversal in various languages
http://rosettacode.org/wiki/Tree_traversal#Java

Algorithms
http://algs4.cs.princeton.edu/home/
Graphs
http://algs4.cs.princeton.edu/40graphs/
Directed Graphs

http://algs4.cs.princeton.edu/42directed/

Java Data Structure: A Generic Tree

http://sujitpal.blogspot.com/2006/05/java-data-structure-generic-tree.html


Generic Node
public class Node<T> {

public T data;
public List<Node<T>> children;
public List<Node<T>> parents;


Non-generic node
package dave;

/**
* Non-generic subclass of Node<String>
*/
public class DaveNode extends Node<String> {
public DaveNode() {
super();
}
}



Walk using stack
 /**
*
* @param element
* @return set of all nodes
*/
public List<Node<T>> walk(Node<T> element){

List<Node<T>> out = new ArrayList<Node<T>>();

Queue<Node<T>> q = new LinkedList<Node<T>>();
q.add(element);

while(!q.isEmpty()){
Node<T> x = q.poll();
out.add(x);

for(Node<T> child : x.getChildren()){
q.add(child);
}
}

return out;

}


Walk from bottom up
  /**
*
* @param element
* @return set of all upper nodes
*/
public Collection<Node<T>> pathBottomUp(Node<T> element){

Set<Node<T>> out = new LinkedHashSet<Node<T>>();

Queue<Node<T>> q = new LinkedList<Node<T>>();
q.add(element);

while(!q.isEmpty()){
Node<T> x = q.poll();
out.add(x);

for(Node<T> parent : x.getParents()){
q.add(parent);
}
}

return out;

}


Construct tree
package dave;


public class WalkTree {

public static void main(String[] args) {

DaveTree daveTree = new DaveTree();

DaveNode daveNode = getDaveNode("1");

DaveNode daveNode11 = getDaveNode("1.1");
DaveNode daveNode12 = getDaveNode("1.2");
DaveNode daveNode13 = getDaveNode("1.3");

DaveNode daveNode131 = getDaveNode("1.3.1");
DaveNode daveNode132 = getDaveNode("1.3.2");

daveNode.addChild(daveNode11);
daveNode.addChild(daveNode12);
daveNode.addChild(daveNode13);

daveNode12.addChild(daveNode131);

daveNode13.addChild(daveNode131);
daveNode13.addChild(daveNode132);


daveTree.setRootElement(daveNode);

System.out.println(daveTree.toList());

Node<String> root = daveTree.getRootElement();

System.out.println("walk:" + daveTree.walk(root));

System.out.println("pathBottomUp:" +daveTree.pathBottomUp(daveNode131));

}

private static DaveNode getDaveNode(String profileName){

DaveNode daveNode = new DaveNode();

daveNode.setData(profileName);

return daveNode;

}

}



Program output
[{1,[1.1,1.2,1.3]}, {1.1,[]}, {1.2,[1.3.1]}, {1.3.1,[]}, {1.3,[1.3.1,1.3.2]}, {1.3.1,[]}, {1.3.2,[]}]
walk:[{1,[1.1,1.2,1.3]}, {1.1,[]}, {1.2,[1.3.1]}, {1.3,[1.3.1,1.3.2]}, {1.3.1,[]}, {1.3.1,[]}, {1.3.2,[]}]
pathBottomUp:[{1.3.1,[]}, {1.2,[1.3.1]}, {1.3,[1.3.1,1.3.2]}, {1,[1.1,1.2,1.3]}]

Start ANTLR project with Maven

$
0
0
http://www.antlr.org/wiki/display/ANTLR3/Building+ANTLR+Projects+with+Maven

http://www.eclipse.org/m2e/
Download m2e
http://www.eclipse.org/m2e/download/





dave@dave antlr-maven]$ mvn archetype:generate -B -DarchetypeGroupId=org.antlr
-DarchetypeArtifactId=antlr3-maven-archetype
-DarchetypeVersion=3.3-1
-DgroupId=dave.antlr
-DartifactId=java-tree-walker
-Dversion=1.0
-Dpackage=dave.antlr
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-archetype-plugin:2.1:generate (default-cli) @ standalone-pom >>>
[INFO]
[INFO] <<< maven-archetype-plugin:2.1:generate (default-cli) @ standalone-pom <<<
[INFO]
[INFO] --- maven-archetype-plugin:2.1:generate (default-cli) @ standalone-pom ---
[INFO] Generating project in Batch mode
[INFO] Archetype repository missing. Using the one from [org.antlr:antlr3-maven-archetype:3.4] found in catalog remote
Downloading: http://repo1.maven.org/maven2/org/antlr/antlr3-maven-archetype/3.3-1/antlr3-maven-archetype-3.3-1.jar
Downloaded: http://repo1.maven.org/maven2/org/antlr/antlr3-maven-archetype/3.3-1/antlr3-maven-archetype-3.3-1.jar (11 KB at 34.4 KB/sec)
Downloading: http://repo1.maven.org/maven2/org/antlr/antlr3-maven-archetype/3.3-1/antlr3-maven-archetype-3.3-1.pom
Downloaded: http://repo1.maven.org/maven2/org/antlr/antlr3-maven-archetype/3.3-1/antlr3-maven-archetype-3.3-1.pom (3 KB at 6.0 KB/sec)
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Archetype: antlr3-maven-archetype:3.3-1
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: davedave@dave antlr-maven]$ mvn archetype:generate -B -DarchetypeGroupId=org.antlr -DarchetypeArtifactId=antlr3-maven-archetype -DarchetypeVersion=3.3-1 -DgroupId=dave.antlr -DartifactId=java-tree-walker -Dversion=1.0 -Dpackage=dave.antlr
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-archetype-plugin:2.1:generate (default-cli) @ standalone-pom >>>
[INFO]
[INFO] <<< maven-archetype-plugin:2.1:generate (default-cli) @ standalone-pom <<<
[INFO]
[INFO] --- maven-archetype-plugin:2.1:generate (default-cli) @ standalone-pom ---
[INFO] Generating project in Batch mode
[INFO] Archetype repository missing. Using the one from [org.antlr:antlr3-maven-archetype:3.4] found in catalog remote
Downloading: http://repo1.maven.org/maven2/org/antlr/antlr3-maven-archetype/3.3-1/antlr3-maven-archetype-3.3-1.jar
Downloaded: http://repo1.maven.org/maven2/org/antlr/antlr3-maven-archetype/3.3-1/antlr3-maven-archetype-3.3-1.jar (11 KB at 34.4 KB/sec)
Downloading: http://repo1.maven.org/maven2/org/antlr/antlr3-maven-archetype/3.3-1/antlr3-maven-archetype-3.3-1.pom
Downloaded: http://repo1.maven.org/maven2/org/antlr/antlr3-maven-archetype/3.3-1/antlr3-maven-archetype-3.3-1.pom (3 KB at 6.0 KB/sec)
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Archetype: antlr3-maven-archetype:3.3-1
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: dave.antlr
[INFO] Parameter: artifactId, Value: java-tree-walker
[INFO] Parameter: version, Value: 1.0
[INFO] Parameter: package, Value: dave.antlr
[INFO] Parameter: packageInPathFormat, Value: dave/antlr
[INFO] Parameter: package, Value: dave.antlr
[INFO] Parameter: version, Value: 1.0
[INFO] Parameter: groupId, Value: dave.antlr
[INFO] Parameter: artifactId, Value: java-tree-walker
[INFO] project created from Archetype in dir: /usr/app/project/antlr-maven/java-tree-walker
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.303s
[INFO] Finished at: Sun Feb 26 10:40:25 CET 2012
[INFO] Final Memory: 7M/17M
[INFO] ------------------------------------------------------------------------



[dave@dave java-tree-walker]$ cat >dave.dmo
Keyser Soze ;
2 + 3;



java -jar target/java-tree-walker-1.0-jar-with-dependencies.jar dave.dmo

java -jar target/java-tree-walker-1.0-jar-with-dependencies.jar -dot dave.dmo




Schedule jobs with WorkManager

$
0
0
Leveraging EJB Timers for J2EE Concurrency
http://www.devx.com/Java/Article/33694/1954

The Work Manager API: Parallel Processing Within a J2EE Container
http://www.devx.com/Java/Article/28815/0


Using Work Managers to Optimize Scheduled Work
http://docs.oracle.com/cd/E14571_01/web.1111/e13701/self_tuned.htm#CNFGD112

Using CommonJ With WebLogic Server
http://docs.oracle.com/cd/E14571_01/web.1111/e13701/self_tuned.htm#i1069944


JBoss WorkManagerTaskExecutor
http://static.springsource.org/spring/docs/2.5.x/api/org/springframework/scheduling/commonj/WorkManagerTaskExecutor.html

Package commonj.work

http://docs.oracle.com/cd/E14571_01/apirefs.1111/e13941/commonj/work/package-summary.html

commonj.work.WorkManager

The WorkManager is the abstraction for dispatching and monitoring asynchronous work and is a factory for creating application short or long lived Works.

WorkManagers are created by the server administrator. The vendor specific systems management console allows the administrator to create one or more WorkManagers and associate a JNDI name with each one. The administrator may specify implementation specific information such as min/max Works for each WorkManager. An application that requires a WorkManager should declare a resource-ref in the EJB or webapp that needs the WorkManager. The vendor descriptor editor or J2EE IDE can be used to bind this resource-ref to a physical WorkManager at deploy or development time. An EJB or servlet can then get a reference to a WorkManager by looking up the resource-ref name in JNDI and then casting it. For example, if the resource-ref was called wm/WorkManager:
<resource-ref>
<res-ref-name>wm/WorkManager</res-ref-name>
<res-type>commonj.work.WorkManager</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>


The Java code to look this up would look like:
  InitialContext ic = new InitialContext();
WorkManager wm = (WorkManager)ic.lookup("java:comp/env/wm/WorkManager");


The res-auth and res-sharing scopes are ignored in this version of the specification. The EJB or servlet can then use the WorkManager as it needs to.
When a Work is scheduled, the declared context that is present on the thread (the J2EE context) will be saved and propagated to the asynchronous methods that are executed. This J2EE context at minimum will contain the java:comp namespace and ClassLoader of the scheduler unless specified otherwise. Other J2EE contexts such as security or a transactional context may be optionally added by the application server vendor. Global transactions are always available using the java:comp/UserTransaction JNDI name and are used in the same fashion as they are used in servlets and bean-managed transaction Enterprise Java Beans.

A WorkManager can also be a pinned WorkManager. This is a WorkManager obtained using the RemoteWorkItem.getWorkManager method. This allows subsequent scheduleWorks to be send to the same remote WorkManager as the one that is associated with the RemoteWorkItem. Pinned WorkManagers are only supported on vendor implementations that support remote Works. However, applications that follow the programming model will work on all implementations however serializable Works will be executed within the local JVM only on those implementations.

If the scheduled Work is a daemon Work, then the life-cycle of that Work is tied to the application that scheduled it. If the application is stopped, the Work.release() method will be called.


Using the Job Scheduler
http://docs.oracle.com/cd/E14571_01/web.1111/e13733/toc.htm#i1058048

WorkManagerService
package dave;

import java.util.Collection;

import javax.ejb.Remote;

@Remote
public interface WorkManagerService {

public void processJob();

public void processTask(Task task);

public Collection<Task> processTasks(Collection<Task> tasks);

}




CommonJWorkManager
package dave;

import java.util.ArrayList;
import java.util.Collection;

import javax.annotation.Resource;
import javax.ejb.LocalBean;
import javax.ejb.Stateless;

import weblogic.work.ExecuteThread;

import commonj.work.Work;
import commonj.work.WorkEvent;
import commonj.work.WorkException;
import commonj.work.WorkItem;
import commonj.work.WorkManager;

/**
* Session Bean implementation class CommonJWorkManager
*/
@Stateless(mappedName = "WorkManagerService")
@LocalBean
public class CommonJWorkManager implements WorkManagerService {

@Resource(name = "daveWM")
WorkManager wm;

/**
* Default constructor.
*/
public CommonJWorkManager() {
// TODO Auto-generated constructor stub
}

public void processJob() {

try {
System.out.println("## [CommonJWorkManager] executing in: "
+ ((ExecuteThread) Thread.currentThread()).getWorkManager()
.getName());
wm.schedule(new Work() {
public void run() {
ExecuteThread th = (ExecuteThread) Thread.currentThread();
System.out
.println("## [CommonJWorkManager] self-tuning workmanager: "
+ th.getWorkManager().getName());
}

public void release() {
}

public boolean isDaemon() {
return false;
}
});

} catch (WorkException e) {
e.printStackTrace();
}

}

public void processTask(Task task) {

System.out.println("Plan task " + task.getName());

try {
System.out.println("## [CommonJWorkManager] executing in: "
+ ((ExecuteThread) Thread.currentThread()).getWorkManager()
.getName());

wm.schedule(new FibWork(task));

} catch (WorkException e) {
e.printStackTrace();
}

}

@Override
public Collection<Task> processTasks(Collection<Task> tasks) {

Collection<WorkItem> workItems = new ArrayList<WorkItem>();
Collection<Task> out = new ArrayList<Task>();

try {
System.out.println("## [CommonJWorkManager] executing in: "
+ ((ExecuteThread) Thread.currentThread()).getWorkManager()
.getName());

for (Task task : tasks) {
System.out.println("Plan task " + task.getName());
WorkItem workItem = wm.schedule(new FibWork(task));
workItems.add(workItem);
}
System.out.println("wm.waitForAll");
wm.waitForAll(workItems, 60000);
for (WorkItem workItem : workItems) {
System.out.println("workItem.result=" + workItem.getStatus());
if (workItem.getStatus() == WorkEvent.WORK_COMPLETED
|| workItem.getStatus() == WorkEvent.WORK_REJECTED) {
FibWork work = (FibWork) workItem.getResult();
if (work != null) {
out.add(work.getTask());
System.out.println("workItem task"
+ work.getTask().getName() + " result="
+ ((FibonacciTask) work.getTask()).getResult());
}
}
}

} catch (WorkException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}

return out;

}

}



FibWork
package dave;

import weblogic.work.ExecuteThread;
import commonj.work.Work;

public class FibWork implements Work {

Task task;

public Task getTask() {
return task;
}

public void setTask(Task task) {
this.task = task;
}

public FibWork(Task task) {
this.task = task;
}

@Override
public void run() {

ExecuteThread th = (ExecuteThread) Thread.currentThread();
System.out.println("## [FibWork] self-tuning workmanager: "
+ th.getWorkManager().getName());
System.out.println("Running task " + task.getName());
task.run();

}

@Override
public boolean isDaemon() {
return false;
}

@Override
public void release() {
// TODO Auto-generated method stub

}

}



FibonacciCalculatorBean
package dave;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import javax.ejb.EJB;
import javax.ejb.Stateless;

/**
* Session Bean implementation class FibonacciCalculatorBean
*/
@Stateless(mappedName = "FibonacciCalculator")
public class FibonacciCalculatorBean implements FibonacciCalculator {

@EJB(mappedName = "WorkManagerService")
private WorkManagerService workManagerService;


public void calculateFibonacci(int[] numbers) {
long initialTime = System.currentTimeMillis();
List<Task> tasks = new ArrayList<Task>();
for (int i = 1; i < numbers.length; i++){
FibonacciTask fibonacciTask = new FibonacciTask(numbers[i]);
tasks.add(fibonacciTask);
}
Collection<Task> resultTasks = workManagerService.processTasks(tasks);
long elapsedTime = System.currentTimeMillis() - initialTime;
printFibonacciResults(resultTasks, elapsedTime);
}

private void printFibonacciResults(Collection<Task> tasks, long elapsedTime) {
System.out.println("** Completed Fibonacci Computations in " + elapsedTime
+ "ms **");
for (Task task : tasks) {
FibonacciTask ft = (FibonacciTask) task;
System.out.println("Fibonacci(" + ft.getN() + ") = " + ft.getResult());
}
}

}



weblogic-ejb-jar.xml
<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-ejb-jar xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-ejb-jar" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd http://xmlns.oracle.com/weblogic/weblogic-ejb-jar http://xmlns.oracle.com/weblogic/weblogic-ejb-jar/1.3/weblogic-ejb-jar.xsd">
<!--weblogic-version:12.1.1-->
<wls:weblogic-enterprise-bean>
<wls:ejb-name>CommonJWorkManager</wls:ejb-name>
<wls:stateless-session-descriptor></wls:stateless-session-descriptor>
<wls:transaction-descriptor>
<wls:trans-timeout-seconds>300</wls:trans-timeout-seconds>
</wls:transaction-descriptor>
<wls:dispatch-policy>daveWM</wls:dispatch-policy>
</wls:weblogic-enterprise-bean>

<wls:work-manager>
<wls:name>daveWM</wls:name>

<wls:max-threads-constraint>
<wls:name>MaxThreadsCountTen</wls:name>
<wls:count>10</wls:count>
</wls:max-threads-constraint>
</wls:work-manager>
</wls:weblogic-ejb-jar>


Client
package dave;

import java.util.Hashtable;

import javax.naming.Context;
import javax.naming.InitialContext;

public class FibonacciClient {

public static void main(String[] args)

{
try

{
Hashtable<String, String> env = new Hashtable<String, String>();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
env.put(Context.SECURITY_PRINCIPAL, "weblogic");
env.put(Context.SECURITY_CREDENTIALS, "weblogic123");
env.put(Context.PROVIDER_URL, "t3://localhost:7001");
Context ctx = new InitialContext(env);
System.out.println("Initial Context created");

/*TimerSession timerSession = (TimerSession) ctx
.lookup("TimerSession#dave.TimerSession");
timerSession.createTimer(100000);*/

FibonacciCalculator fibonacciCalculator = (FibonacciCalculator) ctx
.lookup("FibonacciCalculator#dave.FibonacciCalculator");
System.out.println("lookup successful");
System.out.println("Calling EJB method . . .");
int fibMax = 10;
int[] numbers =new int[fibMax];
for(int i = 1; i< fibMax; i++){
numbers[i] = i;
}
fibonacciCalculator.calculateFibonacci(numbers);
}

catch (Exception e) {
e.printStackTrace();
}
}
}



Output
## [CommonJWorkManager] executing in: default
Plan task FibonacciTask 1
Plan task FibonacciTask 2
Plan task FibonacciTask 3
## [FibWork] self-tuning workmanager: daveWM
Running task FibonacciTask 1
Plan task FibonacciTask 4
## [FibWork] self-tuning workmanager: daveWM
## [FibWork] self-tuning workmanager: daveWM
Running task FibonacciTask 2
Running task FibonacciTask 3
## [FibWork] self-tuning workmanager: daveWM
Running task FibonacciTask 4
Plan task FibonacciTask 5
Plan task FibonacciTask 6
## [FibWork] self-tuning workmanager: daveWM
Running task FibonacciTask 5
## [FibWork] self-tuning workmanager: daveWM
Running task FibonacciTask 6
Plan task FibonacciTask 7
Plan task FibonacciTask 8
## [FibWork] self-tuning workmanager: daveWM
Plan task FibonacciTask 9
## [FibWork] self-tuning workmanager: daveWM
Running task FibonacciTask 8
## [FibWork] self-tuning workmanager: daveWM
Running task FibonacciTask 9
Running task FibonacciTask 7
wm.waitForAll
workItem.result=4
workItem taskFibonacciTask 1 result=1
workItem.result=4
workItem taskFibonacciTask 2 result=1
workItem.result=4
workItem taskFibonacciTask 3 result=2
workItem.result=4
workItem taskFibonacciTask 4 result=3
workItem.result=4
workItem taskFibonacciTask 5 result=5
workItem.result=4
workItem taskFibonacciTask 6 result=8
workItem.result=4
workItem taskFibonacciTask 7 result=13
workItem.result=4
workItem taskFibonacciTask 8 result=21
workItem.result=4
workItem taskFibonacciTask 9 result=34
** Completed Fibonacci Computations in 17ms **
Fibonacci(1) = 1
Fibonacci(2) = 1
Fibonacci(3) = 2
Fibonacci(4) = 3
Fibonacci(5) = 5
Fibonacci(6) = 8
Fibonacci(7) = 13
Fibonacci(8) = 21
Fibonacci(9) = 34



WorkItems not finished on timeout - result 3
workItem.result=4
workItem taskFibonacciTask 41 result=165580141
workItem.result=4
workItem taskFibonacciTask 42 result=267914296
workItem.result=4
workItem taskFibonacciTask 43 result=433494437
workItem.result=3
workItem.result=3
workItem.result=3
workItem.result=3
workItem.result=3
workItem.result=3
** Completed Fibonacci Computations in 60115ms **
Fibonacci(1) = 1
Fibonacci(2) = 1
Fibonacci(3) = 2
Fibonacci(4) = 3
Fibonacci(5) = 5
Fibonacci(6) = 8
Fibonacci(7) = 13
Fibonacci(8) = 21
Fibonacci(9) = 34
Fibonacci(10) = 55
Fibonacci(11) = 89
Fibonacci(12) = 144
Fibonacci(13) = 233






Requests waiting for processing


All threads


Threads used
## [CommonJWorkManager] executing in: default
Plan task FibonacciTask 1
Plan task FibonacciTask 2
## [FibWork][ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)' self-tuning workmanager: daveWM
Running task FibonacciTask 1
Plan task FibonacciTask 3
Plan task FibonacciTask 4
## [FibWork][ACTIVE] ExecuteThread: '15' for queue: 'weblogic.kernel.Default (self-tuning)' self-tuning workmanager: daveWM
Running task FibonacciTask 3
## [FibWork][ACTIVE] ExecuteThread: '31' for queue: 'weblogic.kernel.Default (self-tuning)' self-tuning workmanager: daveWM
Running task FibonacciTask 2
Plan task FibonacciTask 5
## [FibWork][ACTIVE] ExecuteThread: '20' for queue: 'weblogic.kernel.Default (self-tuning)' self-tuning workmanager: daveWM
Running task FibonacciTask 4
## [FibWork][ACTIVE] ExecuteThread: '29' for queue: 'weblogic.kernel.Default (self-tuning)' self-tuning workmanager: daveWM
Running task FibonacciTask 5
Plan task FibonacciTask 6
Plan task FibonacciTask 7
## [FibWork][ACTIVE] ExecuteThread: '6' for queue: 'weblogic.kernel.Default (self-tuning)' self-tuning workmanager: daveWM
Running task FibonacciTask 6
## [FibWork][ACTIVE] ExecuteThread: '30' for queue: 'weblogic.kernel.Default (self-tuning)' self-tuning workmanager: daveWM
Running task FibonacciTask 7
Plan task FibonacciTask 8
Plan task FibonacciTask 9

Monitoring with jconsole

$
0
0
Managing WebLogic servers with JConsole
https://blogs.oracle.com/WebLogicServer/entry/managing_weblogic_servers_with

Java Management Extensions (JMX)
http://docs.oracle.com/javase/6/docs/technotes/guides/jmx/index.html

Tutorial: Java Management Extensions (JMX)
http://docs.oracle.com/javase/tutorial/jmx/TOC.html

jconsole usage
Usage: jconsole [ -interval=n ] [ -notile ] [ -pluginpath <path> ] [ -version ] [ connection ... ]

-interval Set the update interval to n seconds (default is 4 seconds)
-notile Do not tile windows initially (for two or more connections)
-pluginpath Specify the path that jconsole uses to look up the plugins
-version Print program version

connection = pid || host:port || JMX URL (service:jmx:<protocol>://...)
pid The process id of a target process
host A remote host name or IP address
port The port number for the remote connection

-J Specify the input arguments to the Java virtual machine
on which jconsole is running



Command line
[dave@dave app]$ jconsole -J-Djava.class.path=$JAVA_HOME/lib/jconsole.jar:$JAVA_HOME/lib/tools.jar:$WL_HOME/server/lib/wlfulclient.jar -J-Djmx.remote.protocol.provider.pkgs=weblogic.management.remote -debug



Plan task FibonacciTask 94
Plan task FibonacciTask 95
Plan task FibonacciTask 96
Plan task FibonacciTask 97
Plan task FibonacciTask 98
Plan task FibonacciTask 99
wm.waitForAll
## [FibWork][ACTIVE] ExecuteThread: '4' for queue: 'weblogic.kernel.Default (self-tuning)' self-tuning workmanager: daveWM
Running task FibonacciTask 36
## [FibWork][ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)' self-tuning workmanager: daveWM
Running task FibonacciTask 38
## [FibWork][ACTIVE] ExecuteThread: '11' for queue: 'weblogic.kernel.Default (self-tuning)' self-tuning workmanager: daveWM
Running task FibonacciTask 39
## [FibWork][ACTIVE] ExecuteThread: '19' for queue: 'weblogic.kernel.Default (self-tuning)' self-tuning workmanager: daveWM
Running task FibonacciTask 40
## [FibWork][ACTIVE] ExecuteThread: '7' for queue: 'weblogic.kernel.Default (self-tuning)' self-tuning workmanager: daveWM
Running task FibonacciTask 41
## [FibWork][ACTIVE] ExecuteThread: '15' for queue: 'weblogic.kernel.Default (self-tuning)' self-tuning workmanager: daveWM
Running task FibonacciTask 42
## [FibWork][ACTIVE] ExecuteThread: '22' for queue: 'weblogic.kernel.Default (self-tuning)' self-tuning workmanager: daveWM
Running task FibonacciTask 43
## [FibWork][ACTIVE] ExecuteThread: '8' for queue: 'weblogic.kernel.Default (self-tuning)' self-tuning workmanager: daveWM
Running task FibonacciTask 44
## [FibWork][ACTIVE] ExecuteThread: '4' for queue: 'weblogic.kernel.Default (self-tuning)' self-tuning workmanager: daveWM
Running task FibonacciTask 45
## [FibWork][ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)' self-tuning workmanager: daveWM
Running task FibonacciTask 46
## [FibWork][ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)' self-tuning workmanager: daveWM
Running task FibonacciTask 47
## [FibWork][ACTIVE] ExecuteThread: '11' for queue: 'weblogic.kernel.Default (self-tuning)' self-tuning workmanager: daveWM
Running task FibonacciTask 48
## [FibWork][ACTIVE] ExecuteThread: '19' for queue: 'weblogic.kernel.Default (self-tuning)' self-tuning workmanager: daveWM
Running task FibonacciTask 49
## [FibWork][ACTIVE] ExecuteThread: '7' for queue: 'weblogic.kernel.Default (self-tuning)' self-tuning workmanager: daveWM
Running task FibonacciTask 50
## [FibWork][ACTIVE] ExecuteThread: '6' for queue: 'weblogic.kernel.Default (self-tuning)' self-tuning workmanager: daveWM
Running task FibonacciTask 51
## [FibWork][ACTIVE] ExecuteThread: '15' for queue: 'weblogic.kernel.Default (self-tuning)' self-tuning workmanager: daveWM
Running task FibonacciTask 52



Thread dump
Name: [ACTIVE] ExecuteThread: '11' for queue: 'weblogic.kernel.Default (self-tuning)'
State: RUNNABLE
Total blocked: 98 Total waited: 120

Stack trace:
dave.FibonacciTask.fibonacci(FibonacciTask.java:19)
dave.FibonacciTask.fibonacci(FibonacciTask.java:19)
dave.FibonacciTask.fibonacci(FibonacciTask.java:19)
dave.FibonacciTask.fibonacci(FibonacciTask.java:19)
dave.FibonacciTask.fibonacci(FibonacciTask.java:19)
dave.FibonacciTask.fibonacci(FibonacciTask.java:19)
dave.FibonacciTask.fibonacci(FibonacciTask.java:19)
dave.FibonacciTask.fibonacci(FibonacciTask.java:19)
dave.FibonacciTask.fibonacci(FibonacciTask.java:19)
dave.FibonacciTask.fibonacci(FibonacciTask.java:19)
dave.FibonacciTask.fibonacci(FibonacciTask.java:19)
dave.FibonacciTask.fibonacci(FibonacciTask.java:19)
dave.FibonacciTask.fibonacci(FibonacciTask.java:19)
dave.FibonacciTask.fibonacci(FibonacciTask.java:19)
dave.FibonacciTask.fibonacci(FibonacciTask.java:19)
dave.FibonacciTask.fibonacci(FibonacciTask.java:19)
dave.FibonacciTask.fibonacci(FibonacciTask.java:19)
dave.FibonacciTask.fibonacci(FibonacciTask.java:19)
dave.FibonacciTask.fibonacci(FibonacciTask.java:19)
dave.FibonacciTask.fibonacci(FibonacciTask.java:19)
dave.FibonacciTask.fibonacci(FibonacciTask.java:19)
dave.FibonacciTask.fibonacci(FibonacciTask.java:19)
dave.FibonacciTask.fibonacci(FibonacciTask.java:19)
dave.FibonacciTask.fibonacci(FibonacciTask.java:19)
dave.FibonacciTask.fibonacci(FibonacciTask.java:19)
dave.FibonacciTask.fibonacci(FibonacciTask.java:19)
dave.FibonacciTask.fibonacci(FibonacciTask.java:19)
dave.FibonacciTask.fibonacci(FibonacciTask.java:19)
dave.FibonacciTask.fibonacci(FibonacciTask.java:19)
dave.FibonacciTask.fibonacci(FibonacciTask.java:19)
dave.FibonacciTask.fibonacci(FibonacciTask.java:19)
dave.FibonacciTask.fibonacci(FibonacciTask.java:19)
dave.FibonacciTask.fibonacci(FibonacciTask.java:19)
dave.FibonacciTask.fibonacci(FibonacciTask.java:19)
dave.FibonacciTask.fibonacci(FibonacciTask.java:19)
dave.FibonacciTask.fibonacci(FibonacciTask.java:19)
dave.FibonacciTask.fibonacci(FibonacciTask.java:19)
dave.FibonacciTask.fibonacci(FibonacciTask.java:19)
dave.FibonacciTask.run(FibonacciTask.java:13)
dave.FibWork.run(FibWork.java:29)
weblogic.work.j2ee.J2EEWorkManager$WorkWithListener.run(J2EEWorkManager.java:184)
weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
weblogic.work.ExecuteThread.run(ExecuteThread.java:221)


Processes
op - 08:37:09 up 10:55, 10 users,  load average: 10.68, 9.80, 5.91
Tasks: 177 total, 1 running, 176 sleeping, 0 stopped, 0 zombie
Cpu(s): 96.1%us, 3.9%sy, 0.0%ni, 0.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 1533932k total, 1411044k used, 122888k free, 13200k buffers
Swap: 2514100k total, 76348k used, 2437752k free, 369768k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
4219 dave 20 0 902m 235m 16m S 171.1 15.7 25:34.98 java
1951 dave 9 -11 160m 4832 4116 S 8.5 0.3 6:55.87 pulseaudio
3824 dave 20 0 530m 208m 24m S 6.2 13.9 6:08.51 firefox
3856 dave 20 0 317m 68m 11m S 6.2 4.6 7:35.17 plugin-containe
4273 dave 20 0 494m 139m 19m S 3.3 9.3 1:03.21 jconsole
1633 root 20 0 137m 22m 14m S 2.6 1.5 9:10.48 Xorg
2402 dave 20 0 124m 13m 9328 S 2.0 0.9 1:02.39 gnome-terminal
1155 root 20 0 0 0 0 S 0.3 0.0 0:34.19 kondemand/0
4337 dave 20 0 1001m 327m 29m S 0.3 21.9 1:14.09 eclipse
4575 dave 20 0 2728 1012 756 R 0.3 0.1 0:00.23 top
1 root 20 0 2888 1032 916 S 0.0 0.1 0:01.66 init
2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd
3 root 20 0 0 0 0 S 0.0 0.0 0:01.20 ksoftirqd/0
4 root RT 0 0 0 0 S 0.0 0.0 0:00.90 migration/0
5 root RT 0 0 0 0 S 0.0 0.0 0:00.00 watchdog/0
6 root RT 0 0 0 0 S 0.0 0.0 0:01.11 migration/1
7 root 20 0 0 0 0 S 0.0 0.0 0:00.86 ksoftirqd/1



Stuck thread
<Mar 4, 2012 8:39:35 AM CET> <Error> <WebLogicServer> <BEA-000337> <[STUCK] ExecuteThread: '11' for queue: 'weblogic.kernel.Default (self-tuning)' has been busy for "717" seconds working on the request "Workmanager: daveWM, Version: 1, Scheduled=true, Started=true, Started time: 717593 ms
", which is more than the configured time (StuckThreadMaxTime) of "600" seconds. Stack trace:



JVM overview


Application attributes


Weblogic process threads

Profile with jvisualvm

$
0
0
http://docs.oracle.com/javase/6/docs/technotes/guides/visualvm/

http://docs.oracle.com/javase/6/docs/technotes/tools/share/jvisualvm.html

Here is how to configure Eclipse IDE launcher
http://visualvm.java.net/eclipse-launcher.html


jvisualvm is part of JDK
[dave@dave ~]$ cd /app/jdk160_29/bin
[dave@dave bin]$ ls
appletviewer java jcontrol jstack policytool unpack200
apt javac jdb jstat rmic wsgen
ControlPanel javadoc jhat jstatd rmid wsimport
extcheck javah jinfo jvisualvm rmiregistry xjc
HtmlConverter javap jmap keytool schemagen
idlj java-rmi.cgi jps native2ascii serialver
jar javaws jrunscript orbd servertool
jarsigner jconsole jsadebugd pack200 tnameserv



Simple program comparing methods to create large string
package dave;

public class StringService {

int STRING_COUNT = 10000;

public String createString(String token) {

String out = "";

for (int i = 0; i < 1000; i++) {
out += token;
}

return out;

}

public String createStringWithStringBuffer(String token) {

StringBuffer out = new StringBuffer();

for (int i = 0; i < STRING_COUNT; i++) {
out.append(token);
}

return out.toString();
}

public String createStringWithStringBuilder(String token) {

StringBuilder out = new StringBuilder();

for (int i = 0; i < STRING_COUNT; i++) {
out.append(token);
}

return out.toString();

}

}




package dave;

public class TestProfiler {

public static void main(String[] args) {

String token = "dave";

StringService stringService = new StringService();

String result = null;

for (int i = 0; i < 10000; i++) {

result = stringService.createString(token);

result = stringService.createStringWithStringBuffer(token);

result = stringService.createStringWithStringBuilder(token);
}

}

}





Profiler with settings to select package


Sampler

Weblogic login module test - Firefox plugin to modify HTTP request header (also possible with Opera cookie editor)

$
0
0
Modify Headers Firefox plugin
https://addons.mozilla.org/en-US/firefox/addon/modify-headers/


Modify HTTP header


Capture HTTP headers




Weblogic Identity Assertion Concepts
http://docs.oracle.com/cd/E21764_01/web.1111/e13718/ia.htm#autoId0

Weblogic log of test Identity Asserter
SimpleSampleIdentityAsserterProviderImpl.assertIdentity
Type = SamplePerimeterAtnToken
Token = [B@f99f26
userName = dave



weblogic.xml assigns role to group
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app
xmlns="http://www.bea.com/ns/weblogic/90"
xmlns:j2ee="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-web-app.xsd">

<security-role-assignment>
<role-name>SamplePerimeterAtnRole</role-name>
<principal-name>SamplePerimeterAtnUsers</principal-name>
</security-role-assignment>

</weblogic-web-app>


web.xml configures web resource as secured
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

<!-- Specifies the security settings for the SamplePerimeterAtn web app.

This webapp is used to demonstrate how to use identity assertion to
perform perimeter authentication (where someone outside WLS is
responsible for authenticating the user).

Copyright (c) 2005 by BEA Systems, Inc. All Rights Reserved.
-->

<security-constraint>

<!-- all the pages in this webapp are secured -->
<web-resource-collection>
<web-resource-name>SecuredPages</web-resource-name>
<url-pattern>/</url-pattern>
</web-resource-collection>

<!-- only users in the SamplePerimeterAtnRole will
be granted access to the pages in this webapp
-->
<auth-constraint>
<role-name>
SamplePerimeterAtnRole
</role-name>
</auth-constraint>

<user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>

</security-constraint>

<!-- Use weblogic.xml to map the SamplePerimeterAtnRole
to the SamplePerimeterAtnUsers group. As a result,
"SamplePerimterAtnUsers" will be granted the role
for this webapp (thus be able to access its pages)
-->
<security-role>
<role-name>
SamplePerimeterAtnRole
</role-name>
</security-role>

<!-- turn on identity assertion

The webapp only specifies that identity assertion should be
used. It does not dictate what kind of tokens to use. Rather,
the client and the identity asserter have to agree on the token
type and format.

- the client is responsible sending in a token that identifies the user

- the identity asserter is responsible for converting that token
to a user name.

- the authenticators are responsible for putting that user
and its groups into the subject

The realm name is not used so set it to "NoSuchRealm". It
has nothing to do with the realm names in the console.

Set the auth method to CLIENT-CERT to turn on identity
assertion for this webapp.
-->
<login-config>
<auth-method>CLIENT-CERT</auth-method>
<realm-name>NoSuchRealm</realm-name>
</login-config>

</web-app>




Error without modified header

Error 401--Unauthorized
From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
10.4.2 401 Unauthorized

The request requires user authentication. The response MUST include a WWW-Authenticate header field (section 14.46) containing a challenge applicable to the requested resource. The client MAY repeat the request with a suitable Authorization header field (section 14.8). If the request already included Authorization credentials, then the 401 response indicates that authorization has been refused for those credentials. If the 401 response contains the same challenge as the prior response, and the user agent has already attempted authentication at least once, then the user SHOULD be presented the entity that was given in the response, since that entity MAY include relevant diagnostic information. HTTP access authentication is explained in section 11.



Result page with added header
SamplePerimeterAtn.jsp Subject: Principal: dave Principal: SamplePerimeterAtnUsers Private Credential: dave 


Authorized access with configured Identity Asserter


Modify SimpleSampleIdentityAsserter - set Base64DecodingRequired to false
http://docs.oracle.com/cd/E21764_01/web.1111/e13718/ia.htm#autoId15


<MBeanAttribute
Name = "Base64DecodingRequired"
Type = "boolean"
Writeable = "false"
Default = "false"
Description = "See MyIdentityAsserter-doc.xml."
/>


Capture HTTP headers
http://localhost:7001/samplePerimeterAtnWebApp/SamplePerimeterAtn.jsp

GET /samplePerimeterAtnWebApp/SamplePerimeterAtn.jsp HTTP/1.1
Host: localhost:7001
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:11.0) Gecko/20100101 Firefox/11.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Cookie: ADMINCONSOLESESSION=0X41P3rh1pbcCGhBn8nJ5yB55R9zds3v6fjD68QMjT5F6cYZqFGJ!-863651884; JSESSIONID=WVJXP3rJnc1tpjTn5SHW4TC5tRLGhgDBgBDTvZqTQGSR67r88XDR!-863651884
SamplePerimeterAtnToken: username=dave

HTTP/1.1 200 OK
Date: Sat, 31 Mar 2012 16:17:46 GMT
Content-Length: 116
Content-Type: text/html; charset=ISO-8859-1
X-Powered-By: Servlet/3.0 JSP/2.2



To change user it is necessary to remove cookie with JSESSIONID

Cookie: JSESSIONID=pZrFP3yQQpFLnJvPLGSTpcgnGRqCQtYJfdfpySLYJG1gd3QCTGWz!-863651884


In Firefox this is done using about:permissions


Opera allows to edit existing cookies
Cookie Information


Cookie Manager



IdentityAsserter MBean in WLS Admin console


All Weblogic users are assigned to group users. This can be used to allow access to authorized application for all authenticated users by mapping role to users principal in web.xml


 weblogic.security.Security.getCurrentSubject()


returns
SamplePerimeterAtn.jsp Subject: Principal: dave Private Credential: dave 



weblogic.xml
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app
xmlns="http://www.bea.com/ns/weblogic/90"
xmlns:j2ee="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-web-app.xsd">

<security-role-assignment>
<role-name>authusers</role-name>
<principal-name>users</principal-name>
</security-role-assignment>

</weblogic-web-app>



web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

<!-- Specifies the security settings for the SamplePerimeterAtn web app.

This webapp is used to demonstrate how to use identity assertion to
perform perimeter authentication (where someone outside WLS is
responsible for authenticating the user).

Copyright (c) 2005 by BEA Systems, Inc. All Rights Reserved.
-->

<security-constraint>

<!-- all the pages in this webapp are secured -->
<web-resource-collection>
<web-resource-name>SecuredPages</web-resource-name>
<url-pattern>/</url-pattern>
</web-resource-collection>

<!-- all authenticated users in the authusers will
be granted access to the pages in this webapp
-->
<auth-constraint>
<role-name>authusers</role-name>
</auth-constraint>

<user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>

</security-constraint>

<!-- Use weblogic.xml to map the authusers
to the users group. As a result,
"users" will be granted the role
for this webapp (thus be able to access its pages)
-->
<security-role>
<role-name>
authusers
</role-name>
</security-role>

<!-- turn on identity assertion

The webapp only specifies that identity assertion should be
used. It does not dictate what kind of tokens to use. Rather,
the client and the identity asserter have to agree on the token
type and format.

- the client is responsible sending in a token that identifies the user

- the identity asserter is responsible for converting that token
to a user name.

- the authenticators are responsible for putting that user
and its groups into the subject

The realm name is not used so set it to "NoSuchRealm". It
has nothing to do with the realm names in the console.

Set the auth method to CLIENT-CERT to turn on identity
assertion for this webapp.
-->
<login-config>
<auth-method>CLIENT-CERT</auth-method>
<realm-name>NoSuchRealm</realm-name>
</login-config>

<servlet>
<description></description>
<display-name>AuthenticationSnoop</display-name>
<servlet-name>AuthenticationSnoop</servlet-name>
<servlet-class>dave.AuthenticationSnoop</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>AuthenticationSnoop</servlet-name>
<url-pattern>/AuthenticationSnoop</url-pattern>
</servlet-mapping>

</web-app>

Mock Weblogic Login module - Identity Asserter and Authenticator

$
0
0
This module is strictly for testing as it does not validate user.

Based on this log http://weblogic-wonders.com/weblogic/2010/03/15/custom-identity-asserter-for-weblogic-server/

Oracle® Fusion Middleware Developing Security Providers for Oracle WebLogic Server
http://docs.oracle.com/cd/E14571_01/web.1111/e13718/atn.htm#i115061
Identity Assertion Providers
http://docs.oracle.com/cd/E14571_01/web.1111/e13718/ia.htm#i1156163


Steps to create login module
1. Create MBean definition file SimpleSampleIdentityAsserter.xml
<?xml version="1.0" ?>
<!DOCTYPE MBeanType SYSTEM "commo.dtd">

<!-- MBean Definition File (MDF) for the Simple Sample Identity Asserter.

Copyright (c) 2002 by BEA Systems, Inc. All Rights Reserved.
-->

<!-- Declare your mbean.

Since it is for an identity asserter, it must extend the
weblogic.management.security.authentication.IdentityAsserter mbean.

The Name and DisplayName must be the same.
They specify the name that will appear on the
console for this provider.

Set the PeristPolicy to "OnUpdate" so that if an attribute
value is changed, the new value is written to disk immediately.
See the "Developing Security Services" manual for more info.

Note that since this is an xml document, you can't use double
quotes directly. Instead you need to use &quot;

Note that setting "Writeable" to "false" on an attribute
makes the attribute read-only. The default is read-write.
-->

<MBeanType
Name = "SimpleSampleIdentityAsserter"
DisplayName = "SimpleSampleIdentityAsserter"
Package = "examples.security.providers.identityassertion.simple"
Extends = "weblogic.management.security.authentication.IdentityAsserter"
PersistPolicy = "OnUpdate"
>

<!-- You must set the value of the ProviderClassName attribute
(inherited from the weblogic.management.security.Provider mbean)
to the name of the java class you wrote that implements the
weblogic.security.spi.AuthenticationProvider interface.

You can think of the provider's mbean as the factory
for your provider's runtime implementation.
-->
<MBeanAttribute
Name = "ProviderClassName"
Type = "java.lang.String"
Writeable = "false"
Preprocessor = "weblogic.management.configuration.LegalHelper.checkClassName(value)"
Default = "&quot;examples.security.providers.identityassertion.simple.SimpleSampleIdentityAsserterProviderImpl&quot;"
/>

<!-- You must set the value of the Description attribute
(inherited from the weblogic.management.security.Provider mbean)
to a brief description of your provider.
It is displayed in the console.
-->
<MBeanAttribute
Name = "Description"
Type = "java.lang.String"
Writeable = "false"
Default = "&quot;WebLogic Simple Sample Identity Asserter Provider&quot;"
/>

<!-- You must set the value of the Version attribute
(inherited from the weblogic.management.security.Provider mbean)
to your provider's version. There is no required format.
-->
<MBeanAttribute
Name = "Version"
Type = "java.lang.String"
Writeable = "false"
Default = "&quot;1.0&quot;"
/>

<!-- You must set the value of the SupportedTypes attribute
(inherited from the
weblogic.management.security.authentication.IdentityAsserter mbean)
to the list of token types that your identity asserter supports.

Whoever is initiating the identity assertion (eg. a client sending
a perimeter authentication token via an HTTP request header), must
use the same token type.
-->
<MBeanAttribute
Name = "SupportedTypes"
Type = "java.lang.String[]"
Writeable = "false"
Default = "new String[] { &quot;SamplePerimeterAtnToken&quot; }"
/>
<!-- The ActiveTypes attribute (a settable attribute inherited from the
weblogic.management.security.authentication.IdentityAsserter mbean)
contains the subset of your mbean's SupportedTypes that are active
in the realm.

Which way you should default the active types attribute depends
on your token types. The basic rule is that for any token
type, there must only be one identity asserter in the realm with
that token type as an active type. In short, you can only have
one identity asserter turned on for a given type.

If your token types are commonly implemented by other identity
asserters (eg. X509 certificates), then you should not set them
as default active types. Otherwise, it would be very easy for
an administrator to configure an invalid realm where more than
one identity asserter has the same type turned on. Best
practice is that all the identity asserters turn off the type
by default then the administrator manually turns on the
type in one of the identity asserters that support it.
Look at the weblogic.security.spi.IdentityAsserter javadoc
for some standard token types.

On the other hand, if you have a custom token type that no
other identity asserter will ever implement, you may default the
active types attribute to include your token type. If you do,
then the adminstrator doesn't have to manually turn on your token
type.

Since the simple sample identity asserter's token type is very specific
to the sample (instead of a common type like X509), turn on the
token type by default.
-->
<MBeanAttribute
Name = "ActiveTypes"
Type = "java.lang.String[]"
Default = "new String[] { &quot;SamplePerimeterAtnToken&quot; }"
/>

<!-- Add any custom attributes for your provider here.

The simple sample identity asserter does not have any custom attributes.

Note: custom attributes do not appear in the
console in WLS 7.0. Use the admin command line tool
(java weblogic.Admin) to view and set their values.

Refer to the "Developing Security Services" manual
for more info on defining custom attributes.
-->

<MBeanAttribute
Name = "Base64DecodingRequired"
Type = "boolean"
Writeable = "false"
Default = "false"
Description = "See MyIdentityAsserter-doc.xml."
/>

</MBeanType>



2. copy commo.dtd from WLS installation
[dave@dave src]$ find /app/weblogic121/ -name commo.dtd
/app/weblogic121/wlserver_12.1/server/lib/commo.dtd
/app/weblogic121/wlserver_12.1/server/lib/mbeantypes/commo.dtd
[dave@dave src]$ cp /app/weblogic121/wlserver_12.1/server/lib/mbeantypes/commo.dtd .




3. modify classes for IdentityAsserter, LoginModule and CallbackHandler - only 3 classes have to be provided , rest is generated
[dave@dave src]$ ls -1
build.xml
commo.dtd
SimpleSampleCallbackHandlerImpl.java
SimpleSampleIdentityAsserterImpl.java
SimpleSampleIdentityAsserter.jar
SimpleSampleIdentityAsserterProviderImpl.java
SimpleSampleIdentityAsserter.xml
SimpleSampleLoginModuleImpl.java
test



This is main Provider class which drives the process SimpleSampleIdentityAsserterProviderImpl.
It provides IdentityAsserter and it calls SimpleSampleLoginModule
package examples.security.providers.identityassertion.simple;

import java.util.HashMap;

import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.login.AppConfigurationEntry;
import javax.security.auth.login.AppConfigurationEntry.LoginModuleControlFlag;

import weblogic.management.security.ProviderMBean;
import weblogic.security.provider.PrincipalValidatorImpl;
import weblogic.security.service.ContextHandler;
import weblogic.security.spi.AuthenticationProviderV2;
import weblogic.security.spi.IdentityAsserterV2;
import weblogic.security.spi.IdentityAssertionException;
import weblogic.security.spi.PrincipalValidator;
import weblogic.security.spi.SecurityServices;

/**
* The simple sample identity asserter's runtime implementation.
*
* It looks for tokens of type "SamplePerimeterAtnToken"
* whose matching token is an array of bytes containing a
* string in the form "username=someusername".
*
* It extracts the username from the token and stores it
* in a SimpleSampleCallbackHandlerImpl. This is returned to the
* security framework who hands it to the authenticators'
* login modules. The login modules can use a NameCallback
* to retrieve the user name from the simple sample identity
* asserter's callback handler.
*
* Since it is an identity asserter, it must implement
* the weblogic.security.spi.AuthenticationProvider and
* the weblogic.security.spi.IdentityAsserter interfaces.
*
* It can either implement two classes, and use the
* provider implementation as the factory as the
* factory for the identity asserter, or it can implement
* both interfaces in one class. The simple sample identity
* asserter implments both interfaces in one class.
*
* Note: The simple sample identity asserter's mbean's ProviderClassName
* attribute must be set the the name of this class.
*
* @author Copyright (c) 2002 by BEA Systems. All Rights Reserved.
*/
public final class SimpleSampleIdentityAsserterProviderImpl implements AuthenticationProviderV2, IdentityAsserterV2
{
final static private String TOKEN_TYPE = "SamplePerimeterAtnToken"; // the kind of token's we handle
final static private String TOKEN_PREFIX = "username="; // the token contains a string in the form "username=someusername"

private String description; // a description of this provider
private LoginModuleControlFlag controlFlag; // how this provider's login module should be used during the JAAS login


/**
* Initialize the simple sample identity asserter.
*
* @param mbean A ProviderMBean that holds the simple sample identity asserter's
* configuration data. This mbean must be an instance of the simple sample
* identity asserter's mbean.
*
* @param services The SecurityServices gives access to the auditor
* so that the provider can to post audit events.
* The simple sample role mapper doesn't use this parameter.
*
* @see SecurityProvider
*/
public void initialize(ProviderMBean mbean, SecurityServices services)
{
System.out.println("SimpleSampleIdentityAsserterProviderImpl.initialize");
SimpleSampleIdentityAsserterMBean myMBean = (SimpleSampleIdentityAsserterMBean)mbean;
description = myMBean.getDescription() + "\n" + myMBean.getVersion();

controlFlag = LoginModuleControlFlag.SUFFICIENT;
/* String flag = myMBean.getControlFlag();
if (flag.equalsIgnoreCase("REQUIRED")) {
controlFlag = LoginModuleControlFlag.REQUIRED;
} else if (flag.equalsIgnoreCase("OPTIONAL")) {
controlFlag = LoginModuleControlFlag.OPTIONAL;
} else if (flag.equalsIgnoreCase("REQUISITE")) {
controlFlag = LoginModuleControlFlag.REQUISITE;
} else if (flag.equalsIgnoreCase("SUFFICIENT")) {
controlFlag = LoginModuleControlFlag.SUFFICIENT;
} else {
throw new IllegalArgumentException("invalid flag value" + flag);
}*/
}

/**
* Get the simple sample identity asserter's description.
*
* @return A String containing a brief description of the simple sample identity asserter.
*
* @see SecurityProvider
*/
public String getDescription()
{
return description;
}

/**
* Shutdown the simple sample identity asserter.
*
* A no-op.
*
* @see SecurityProvider
*/
public void shutdown()
{
System.out.println("SimpleSampleIdentityAsserterProviderImpl.shutdown");
}

/**
* Gets the simple sample identity assertion provider's identity asserter object.
*
* @return The simple sample identity assertion provider's IdentityAsserter object.
*
* @see AuthenticationProvider
*/
public IdentityAsserterV2 getIdentityAsserter()
{
return this;
}

/**
* Assert identity given a token that identifies the user.
*
* @param type A String containing the token type. The simple sample identity
* asserter only supports tokens of type "SamplePerimeterAtnToken".
* Also, the simple sample identity asserter's mbean's "ActiveTypes" attribute
* must be set to "SamplePerimeterAtnToken" (which is done by default
* when the mbean is created).
*
* @param token An Object containing the token that identifies the user.
* The simple sample identity asserter's token must be an array of bytes
* containing a String of the form "username=someusername".
*
* @param handler A ContextHandler object that can optionally
* be used to obtain additional information that may be used in
* asserting the identity. If the caller is unable to provide additional
* information, a null value should be specified. This sample
* ignores the handler.
*
* While, for simplicity, this sample does not validate the
* contents of the token, identity asserters typically should do
* this (to prevent someone from forging a token). For
* example, when using Kerberos, the token may be generated
* and "signed" by a Kerberos server and the identity asserter
* hands the token back to the Kerberos server to get it
* validated. Another example: when asserting identity from
* X509 certificates, then identity asserter should validate the
* certificate - that it hasn't been tampered, that it's been
* signed by a trusted CA, that it hasn't expired or revoked, etc.
*
* @return a CallbackHandler that stores the username from the token.
* The username can only be retrieved from the callback handler by
* passing in a NameCallback. The sample returns an instance of
* its CallbackHandler implementation (SimpleSampleCallbackHandlerImpl).
*
* @throws IdentityAssertionException if another token type is passed
* in or the token doesn't have the correct form.
*/
public CallbackHandler assertIdentity(String type, Object token, ContextHandler context) throws IdentityAssertionException
{
System.out.println("SimpleSampleIdentityAsserterProviderImpl.assertIdentity");
System.out.println("\tType\t\t= " + type);
System.out.println("\tToken\t\t= " + token);

// check the token type
if (!(TOKEN_TYPE.equals(type))) {
String error =
"SimpleSampleIdentityAsserter received unknown token type \"" + type + "\"." +
" Expected " + TOKEN_TYPE;
System.out.println("\tError: " + error);
throw new IdentityAssertionException(error);
}

// make sure the token is an array of bytes
if (!(token instanceof byte[])) {
String error =
"SimpleSampleIdentityAsserter received unknown token class \"" + token.getClass() + "\"." +
" Expected a byte[].";
System.out.println("\tError: " + error);
throw new IdentityAssertionException(error);
}

// convert the array of bytes to a string
byte[] tokenBytes = (byte[])token;
if (tokenBytes == null || tokenBytes.length < 1) {
String error =
"SimpleSampleIdentityAsserter received empty token byte array";
System.out.println("\tError: " + error);
throw new IdentityAssertionException(error);
}

String tokenStr = new String(tokenBytes);

// make sure the string contains "username=someusername
if (!(tokenStr.startsWith(TOKEN_PREFIX))) {
String error =
"SimpleSampleIdentityAsserter received unknown token string \"" + type + "\"." +
" Expected " + TOKEN_PREFIX + "username";
System.out.println("\tError: " + error);
throw new IdentityAssertionException(error);
}

// extract the username from the token
String userName = tokenStr.substring(TOKEN_PREFIX.length());
System.out.println("\tuserName\t= " + userName);

// store it in a callback handler that authenticators can use
// to retrieve the username.
return new SimpleSampleCallbackHandlerImpl(userName);
}

/**
* Create a JAAS AppConfigurationEntry (which tells JAAS
* how to create the login module and how to use it) when
* the simple sample authenticator is used to authenticate (vs. to
* complete identity assertion).
*
* @return An AppConfigurationEntry that tells JAAS how to use the simple sample
* authenticator's login module for authentication.
*/
public AppConfigurationEntry getLoginModuleConfiguration()
{
// Don't pass in any special options.
// By default, the simple sample authenticator's login module
// will authenticate (by checking that the passwords match).
HashMap options = new HashMap();
return getConfiguration(options);
}

/**
* Create a JAAS AppConfigurationEntry (which tells JAAS
* how to create the login module and how to use it).
* This helper method is used both for authentication mode
* and identity assertion mode.
*
* @param options A HashMap containing the options to pass to the
* simple sample authenticator's login module. This method adds the
* "database helper" object to the options. This allows the
* login module to access the users and groups.
*
* @return An AppConfigurationEntry that tells JAAS how to use the simple sample
* authenticator's login module.
*/
private AppConfigurationEntry getConfiguration(HashMap options)
{
System.out.println("SimpleSampleIdentityAsserterProviderImpl: getConfiguration");
// make sure to specify the simple sample authenticator's login module
// and to use the control flag from the simple sample authenticator's mbean.
return new
AppConfigurationEntry(
"examples.security.providers.authentication.simple.SimpleSampleLoginModuleImpl",
controlFlag,
options
);
}

/**
* Create a JAAS AppConfigurationEntry (which tells JAAS
* how to create the login module and how to use it) when
* the simple sample authenticator is used to complete identity
* assertion (vs. to authenticate).
*
* @return An AppConfigurationEntry that tells JAAS how to use the simple sample
* authenticator's login module for identity assertion.
*/
public AppConfigurationEntry getAssertionModuleConfiguration()
{
System.out.println("SimpleSampleIdentityAsserterProviderImpl: getAssertionModuleConfiguration");
// Pass an option indicating that we're doing identity
// assertion (vs. authentication) therefore the login module
// should only check that the user exists (instead of checking
// the password)
HashMap options = new HashMap();
options.put("IdentityAssertion","true");
return getConfiguration(options);
}

/**
* Return the principal validator that can validate the
* principals that the authenticator's login module
* puts into the subject.
*
* Since the simple sample authenticator uses the built in
* WLSUserImpl and WLSGroupImpl principal classes, just
* returns the built in PrincipalValidatorImpl that knows
* how to handle these kinds of principals.
*/
public PrincipalValidator getPrincipalValidator()
{
return new PrincipalValidatorImpl();
}
}



SimpleSampleLoginModule - set as SUFFICIENT

package examples.security.providers.authentication.simple;

import java.io.IOException;
import java.util.Enumeration;
import java.util.Map;
import java.util.Vector;
import javax.security.auth.Subject;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.NameCallback;
import javax.security.auth.callback.PasswordCallback;
import javax.security.auth.callback.UnsupportedCallbackException;
import javax.security.auth.login.LoginException;
import javax.security.auth.login.FailedLoginException;
import javax.security.auth.spi.LoginModule;
import weblogic.management.utils.NotFoundException;
import weblogic.security.principal.WLSGroupImpl;
import weblogic.security.principal.WLSUserImpl;

/**
* The simple sample authenticator's login module implementation.
*
* It is used in one of two modes:
* - authentication where it validates the user's password
* then populates the subject with the user and the user's groups.
* - identity assertion where it checks that the user exists,
* then populates the subject with the user and the user's groups.
*
* The SimpleSampleAuthenticationProviderImpl creates an options hash map
* that is passed to this login module. It contains one entry,
* named "database", that is an object that manages the
* user and group definitions. It optionally contains another entry,
* named "IdentityAssertion", that puts the login module in
* "identity assertion" mode (vs. the default which is "authenticadtion"
* mode).
*
* It uses the built in WLSUserImpl and WLSGroupImpl classes to
* populate the subject with users and groups.
*
* @author Copyright (c) 2002 by BEA Systems. All Rights Reserved.
*/
final public class SimpleSampleLoginModuleImpl implements LoginModule
{
private Subject subject; // the subject for this login
private CallbackHandler callbackHandler; // where to get user names, passwords, ... for this login

private boolean isIdentityAssertion; // are we in authentication or identity assertion mode?

// Authentication status
private boolean loginSucceeded; // have we successfully logged in?
private boolean principalsInSubject; // did we add principals to the subject?
private Vector principalsForSubject = new Vector(); // if so, what principals did we add to the subject
// (so we can remove the principals we added if the login is aborted)
/**
* Initialize a login attempt.
*
* @param subject the Subject this login attempt will populate.
*
* @param callbackhandler the CallbackHandler that can be used to
* get the user name, and in authentication mode, the user's password
*
* @param sharedState A Map containing data shared between login
* modules when there are multiple authenticators configured. This
* simple sample does not use this parameter.
*
* @param options A Map containing options that the authenticator's
* authentication provider impl wants to pass to its login module impl.
* For example, it can be used to pass in configuration data (where
* is the database holding user and group info) and to pass in whether
* the login module is used for authentication or to complete identity
* assertion.
* The SimpleSampleAuthenticationProviderImpl adds an option named "database".
* The value is a SimpleSampleAuthenticatorDatabase object. It gives the
* login module access to the user and group definitions.
* When the authenticator is being used in identity assertion mode,
* the SimpleSampleAuthenticationProviderImpl also adds an option named
* "IdentityAssertion". It indicates that the login module should only
* verify that the user exists (vs. checking the password too). If
* this option is not specified (or is set to false), then the
* login module checks the user's password too (that is, it assumes
* authentication mode).
*/
public void
initialize(
Subject subject,
CallbackHandler callbackHandler,
Map sharedState,
Map options
)
{
// only called (once!) after the constructor and before login

System.out.println("SimpleSampleLoginModuleImpl.initialize");
this.subject = subject;
this.callbackHandler = callbackHandler;

// Determine if we're in identity assertion or authentication mode
isIdentityAssertion =
"true".equalsIgnoreCase((String)options.get("IdentityAssertion"));

}

/**
* Attempt to login.
*
* If we're in authentication mode, extract the user name and password
* from the callback handler. If the user exists and the password matches,
* then populate the subject with the user and the user's group. Otherwise,
* the login fails.
*
* If we're in identity assertion mode, extract the user name (only)
* from the callback handler. If the user exists, then populate the
* subject with the user and the user's groups. Otherwise, the
* login fails.
*
* @return A boolean indicating whether or not the login for
* this login module succeeded.
*/
public boolean login() throws LoginException
{
// only called (once!) after initialize

System.out.println("SimpleSampleLoginModuleImpl.login");

// loginSucceeded should be false
// principalsInSubject should be false

// Call a method to get the callbacks.
// For authentication mode, it will have one for the
// username and one for the password.
// For identity assertion mode, it will have one for
// the user name.
Callback[] callbacks = getCallbacks();

// Get the user name.
String userName = getUserName(callbacks);

if (userName.length() > 0) {
// We have a user name
System.out.println("\tuserName=" + userName);
} else {
// anonymous login.
System.out.println("\tempty userName");
}

loginSucceeded = true;

// since the login succeeded, add the user and its groups to the
// list of principals we want to add to the subject.
principalsForSubject.add(new WLSUserImpl(userName));
addGroupsForSubject(userName);

return loginSucceeded;
}

/**
* Completes the login by adding the user and the user's groups
* to the subject.
*
* @return A boolean indicating whether or not the commit succeeded.
*/
public boolean commit() throws LoginException
{
// only called (once!) after login

// loginSucceeded should be true or false
// principalsInSubject should be false
// user should be null if !loginSucceeded, null or not-null otherwise
// group should be null if user == null, null or not-null otherwise

System.out.println("SimpleSampleLoginModule.commit");
if (loginSucceeded) {
// put the user and the user's groups (computed during the
// login method and stored in the principalsForSubject object)
// into the subject.
subject.getPrincipals().addAll(principalsForSubject);
principalsInSubject = true;
return true;
} else {
return false;
}
}

/**
* Aborts the login attempt. Remove any principals we put
* into the subject during the commit method from the subject.
*
* @return A boolean indicating whether or not the abort succeeded.
*/
public boolean abort() throws LoginException
{
// only called (once!) after login or commit
// or may be? called (n times) after abort

// loginSucceeded should be true or false
// principalsInSubject should be false if user is null, otherwise true or false

System.out.println("SimpleSampleLoginModule.abort");
if (principalsInSubject) {
subject.getPrincipals().removeAll(principalsForSubject);
principalsInSubject = false;
}
return true;
}

/**
* Logout. This should never be called.
*
* @return A boolean indicating whether or not the logout succeeded.
*/
public boolean logout() throws LoginException
{
// should never be called

System.out.println("SimpleSampleLoginModule.logout");
return true;
}

/**
* Throw an invalid login exception.
*
* @param msg A String containing the text of the LoginException.
*
* @throws LoginException
*/
private void throwLoginException(String msg) throws LoginException
{
System.out.println("Throwing LoginException(" + msg + ")");
throw new LoginException(msg);
}

/**
* Throws a failed login excception.
*
* @param msg A String containing the text of the FailedLoginException.
*
* @throws LoginException
*/
private void throwFailedLoginException(String msg) throws FailedLoginException
{
System.out.println("Throwing FailedLoginException(" + msg + ")");
throw new FailedLoginException(msg);
}

/**
* Get the list of callbacks needed by the login module.
*
* @return The array of Callback objects by the login module.
* Returns one for the user name and password if in authentication mode.
* Returns one for the user name if in identity assertion mode.
*/
private Callback[] getCallbacks() throws LoginException
{
if (callbackHandler == null) {
throwLoginException("No CallbackHandler Specified");
}

Callback[] callbacks;
if (isIdentityAssertion) {
callbacks = new Callback[1]; // need one for the user name
} else {
callbacks = new Callback[2]; // need one for the user name and one for the password

// add in the password callback
callbacks[1] = new PasswordCallback("password: ",false);
}

// add in the user name callback
callbacks[0] = new NameCallback("username: ");

// Call the callback handler, who in turn, calls back to the
// callback objects, handing them the user name and password.
// These callback objects hold onto the user name and password.
// The login module retrieves the user name and password from them later.
try {
callbackHandler.handle(callbacks);
} catch (IOException e) {
throw new LoginException(e.toString());
} catch (UnsupportedCallbackException e) {
throwLoginException(e.toString() + " " + e.getCallback().toString());
}

return callbacks;
}

/**
* Get the user name from the callbacks (that the callback handler
* has already handed the user name to).
*
* @param callbacks The array of Callback objects used by this login module.
* The first in the list must be the user name callback object.
*
* @return A String containing the user name (from the user name callback object)
*/
private String getUserName(Callback[] callbacks) throws LoginException
{
String userName = ((NameCallback)callbacks[0]).getName();
if (userName == null) {
throwLoginException("Username not supplied.");
}
System.out.println("\tuserName\t= " + userName);
return userName;
}

/**
* Add the user's groups to the list of principals to be added to the subject.
*
* @param A String containing the user name the user's name.
*/
private void addGroupsForSubject(String userName)
{
// Get the user's list of groups (recursively - so, if user1 is a member
// of group1 and group1 is a member of group2, then it returns group1 and
// group2). Iterate over the groups, adding each to the list of principals
// to add to the subject.
String groupName = "SamplePerimeterAtnUsers";
System.out.println("\tgroupName\t= " + groupName);
principalsForSubject.add(new WLSGroupImpl(groupName));
}

/**
* Get the password from the callbacks (that the callback handler
* has already handed the password to) - that is, the password from
* the login attempt. Must only be used for authentication mode, not
* for identity assertion mode.
*
* @param useName A String containing the name of the user
* (already retrieved from the callbacks). Only passed in
* so that we can print a better error message if the password
* is bogus.
*
* @param callbacks The array of Callback objects used by this login module.
* The second in the list must be the password callback object.
*
* @return A String containing the password from the login attempt
*
* @throws LoginException if no password was supplied in the login attempt.
*/
private String getPasswordHave(String userName, Callback[] callbacks) throws LoginException
{
PasswordCallback passwordCallback = (PasswordCallback)callbacks[1];
char[] password = passwordCallback.getPassword();
passwordCallback.clearPassword();
if (password == null || password.length < 1) {
throwLoginException("Authentication Failed: User " + userName + ". Password not supplied");
}
String passwd = new String(password);
System.out.println("\tpasswordHave\t= " + passwd);
return passwd;
}
}



CallbackHandler
package examples.security.providers.identityassertion.simple;

import javax.security.auth.callback.Callback;
import javax.security.auth.callback.NameCallback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.UnsupportedCallbackException;

/**
* The simple sample identity asserter's implementation of the
* CallbackHandler interface.
*
* It is used to make the name of the user from the identity
* assertion token available to the authenticators (who, in
* turn, will populate the subject with the user and the user's
* groups).
*
* This class is internal to the simple sample identity asserter.
* It is not a public class.
*
* @author Copyright (c) 2002 by BEA Systems. All Rights Reserved.
*/
/*package*/ class SimpleSampleCallbackHandlerImpl implements CallbackHandler
{
private String userName; // the name of the user from the identity assertion token

/**
* Create a callback handler that stores the user name.
*
* @param user A String containing the name of the user
* from the identity assertion token
*/
/*package*/ SimpleSampleCallbackHandlerImpl(String user)
{
userName = user;
}

/**
* Used by the authenticators' login modules to get the user name
* that the identity asserter extracted from the identity assertion token.
* This name can only be retrieved via a NameCallback.
*
* @param callbacks An array of Callback objects indicating what data
* the login module is trying to extract from this callback handler.
* It must only contain NameCallbacks.
*
* @exception UnsupportedCallbackException thrown if any of the callbacks
* aren't NameCallbacks.
*
* @see CallbackHandler
*/
public void handle(Callback[] callbacks) throws UnsupportedCallbackException
{
// loop over the callbacks
for (int i = 0; i < callbacks.length; i++) {

Callback callback = callbacks[i];

// we only handle NameCallbacks
if (!(callback instanceof NameCallback)) {
throw new UnsupportedCallbackException(callback, "Unrecognized Callback");
}

// send the user name to the name callback:
NameCallback nameCallback = (NameCallback)callback;
nameCallback.setName(userName);
}
}
}





4.Build jar with ant using build.xml
<project name="Expenselink Build" default="all" basedir=".">
<property name="fileDir" value="test" />

<target name="all" depends="build"/>

<target name="build" depends="clean,build.mdf,build.mjf"/>

<target name="clean">
<delete dir="${fileDir}" failonerror="false"/>
<delete file="SimpleSampleIdentityAsserter.jar" failonerror="false"/>
<echo message="Clean finish" />
</target>

<!-- helper to build an MDF (mbean definition file) -->
<target name="build.mdf">
<java dir="${basedir}" fork="false" classname="weblogic.management.commo.WebLogicMBeanMaker">
<arg line="-files ${fileDir}" />
<arg value="-createStubs" />
<arg line="-MDF SimpleSampleIdentityAsserter.xml" />
</java>
<echo message="Created Supporting Classes" />
</target>

<target name="build.mjf">

<copy todir="${fileDir}" flatten="true">
<fileset dir=".">
<include name="*.java" />
</fileset>
</copy>

<java dir="${basedir}" fork="false" classname="weblogic.management.commo.WebLogicMBeanMaker">
<arg line="-MJF SimpleSampleIdentityAsserter.jar" />
<arg line="-files ${fileDir}" />
</java>
<echo message="Created Mbean Jar" />
</target>

</project>



Set WLS environment

[dave@dave src]$ . /app/weblogic121/wlserver_12.1/server/bin/setWLSEnv.sh




[dave@dave src]$ ant
Buildfile: build.xml

clean:
[delete] Deleting directory /home/dave/workspace1211/testIdentityAsserter/src/test
[delete] Deleting: /home/dave/workspace1211/testIdentityAsserter/src/SimpleSampleIdentityAsserter.jar
[echo] Clean finish

build.mdf:
[java] Working directory ignored when same JVM is used.
[java] Parsing the MBean definition file: SimpleSampleIdentityAsserter.xml
[echo] Created Supporting Classes

build.mjf:
[copy] Copying 3 files to /home/dave/workspace1211/testIdentityAsserter/src/test
[java] Working directory ignored when same JVM is used.
[java] Creating an MJF from the contents of directory test...
[java] Compiling the files...
[java] Creating the list.
[java] Doing the compile.
[java] Note: /home/dave/workspace1211/testIdentityAsserter/src/test/SimpleSampleIdentityAsserterProviderImpl.java uses or overrides a deprecated API.
[java] Note: Recompile with -Xlint:deprecation for details.
[java] Note: Some input files use unchecked or unsafe operations.
[java] Note: Recompile with -Xlint:unchecked for details.
[java] WLMaker-SubProcess: : EXTRACT FROM /usr/app/weblogic121/wlserver_12.1/server/lib/mbeantypes/wlManagementMBean.jar
[java] WLMaker-SubProcess: : INTO wlMakerTempDir
[java] WLMaker-SubProcess: :
[java] WLMaker-SubProcess: :
[java] WLMaker-SubProcess: :
[java] WLMaker-SubProcess: : Generating the implementations for security MBeans
[java] WLMaker-SubProcess: : Generating for examples.security.providers.identityassertion.simple.SimpleSampleIdentityAsserterMBean to /home/dave/workspace1211/testIdentityAsserter/src/test/examples/security/providers/identityassertion/simple/SimpleSampleIdentityAsserterMBeanImpl.java
[java] WLMaker-SubProcess: : no annotation found for key [i]
[java] WLMaker-SubProcess: : no annotation found for key [velocityCount]
[java] WLMaker-SubProcess: : no annotation found for key [line]
[java] WLMaker-SubProcess: : no annotation found for key [f]
[java] WLMaker-SubProcess: : no annotation found for key [m]
[java] WLMaker-SubProcess: : no annotation found for key [p]
[java] WLMaker-SubProcess: : no annotation found for key [n]
[java] WLMaker-SubProcess: : done
[java] WLMaker-SubProcess: :
[java] WLMaker-SubProcess: :
[java] WLMaker-SubProcess: :
[java] WLMaker-SubProcess: : Generating the parsing binders for security MBeans
[java] WLMaker-SubProcess: : Generating for examples.security.providers.identityassertion.simple.SimpleSampleIdentityAsserterMBean to /home/dave/workspace1211/testIdentityAsserter/src/test/examples/security/providers/identityassertion/simple/SimpleSampleIdentityAsserterMBeanBinder.java
[java] WLMaker-SubProcess: : done
[java] WLMaker-SubProcess: :
[java] WLMaker-SubProcess: :
[java] WLMaker-SubProcess: :
[java] WLMaker-SubProcess: : Generating the bean infos for security MBeans ...
[java] WLMaker-SubProcess: : Generating for examples.security.providers.identityassertion.simple.SimpleSampleIdentityAsserterMBean to /home/dave/workspace1211/testIdentityAsserter/src/test/examples/security/providers/identityassertion/simple/SimpleSampleIdentityAsserterMBeanImplBeanInfo.java
[java] WLMaker-SubProcess: : no annotation found for key [import]
[java] WLMaker-SubProcess: : no annotation found for key [property]
[java] WLMaker-SubProcess: : no annotation found for key [beanConfigurable]
[java] WLMaker-SubProcess: : no annotation found for key [beanIntfExclude]
[java] WLMaker-SubProcess: : no annotation found for key [propertyMethod]
[java] WLMaker-SubProcess: : no annotation found for key [method]
[java] WLMaker-SubProcess: : Generating Bean Factory Class to test/weblogic/management/security/SIMPLESAMPLEIDENTITYASSERTERBeanInfoFactory.java
[java] WLMaker-SubProcess: : done
[java] WLMaker-SubProcess: : Stopped draining WLMaker-SubProcess:
[java] WLMaker-SubProcess: : Stopped draining WLMaker-SubProcess:
[java] WLMaker-SchemaGen-SubProcess: Generating schema for security provider mbeans ...
[java] WLMaker-SchemaGen-SubProcess: MBEAN TYPES DIR : null
[java] WLMaker-SchemaGen-SubProcess: SET BASE LIB /usr/app/weblogic121/wlserver_12.1/server/lib/schema/weblogic-domain-binding.jar
[java] WLMaker-SchemaGen-SubProcess: Stopped draining WLMaker-SchemaGen-SubProcess
[java] WLMaker-SchemaGen-SubProcess: Stopped draining WLMaker-SchemaGen-SubProcess
[java] Creating the list.
[java] Doing the compile.
[java] Note: Some input files use or override a deprecated API.
[java] Note: Recompile with -Xlint:deprecation for details.
[java] Note: Some input files use unchecked or unsafe operations.
[java] Note: Recompile with -Xlint:unchecked for details.
[java] Creating the MJF...
[java] MJF is created.
[echo] Created Mbean Jar

build:

all:

BUILD SUCCESSFUL



5. copy provider to Weblogic installation dir
see http://docs.oracle.com/cd/E21764_01/web.1111/e13718/ia.htm#autoId18
Note:
WL_HOME\server\lib\mbeantypes is the default directory for installing MBean types.
(Beginning with 9.0, security providers can be loaded from ...\domaindir\lib\mbeantypes as well.)
However, if you want WebLogic Server to look for MBean types in additional directories, use the -Dweblogic.alternateTypesDirectory=<dir> command-line flag when starting your server,
where <dir> is a comma-separated list of directory names. When you use this flag, WebLogic Server will always load MBean types from WL_HOME\server\lib\mbeantypes first,
then will look in the additional directories and load all valid archives present in those directories (regardless of their extension).
For example, if -Dweblogic.alternateTypesDirectory = dirX,dirY, WebLogic Server will first load MBean types from WL_HOME\server\lib\mbeantypes, then any valid archives present in dirX and dirY.


[dave@dave src]$ cp  SimpleSampleIdentityAsserter.jar /app/weblogic121/wlserver_12.1/server/lib/mbeantypes/
[dave@dave src]$


6. configure new provider using WLS console



7. test using Modify HTTP headers plugin or cookie editor ( see previous blog entry)
user token is retrieved by this custom provider from HTTP request header or from cookie

Weblogic logs
SimpleSampleIdentityAsserterProviderImpl.initialize
SimpleSampleIdentityAsserterProviderImpl: getAssertionModuleConfiguration
SimpleSampleIdentityAsserterProviderImpl: getConfiguration
SimpleSampleIdentityAsserterProviderImpl: getConfiguration
<Apr 1, 2012 10:44:29 AM CEST> <Notice> <Security> <BEA-090082> <Security initializing using security realm myrealm.>
SimpleSampleIdentityAsserterProviderImpl: getConfiguration
<Apr 1, 2012 10:44:32 AM CEST> <Notice> <LoggingService> <BEA-320400> <The log file /usr/app/domains/base_domain/servers/AdminServer/logs/access.log will be rotated. Reopen the log file if tailing has stopped. This can happen on some platforms, such as Windows.>
<Apr 1, 2012 10:44:32 AM CEST> <Notice> <LoggingService> <BEA-320401> <The log file has been rotated to /usr/app/domains/base_domain/servers/AdminServer/logs/access.log00029. Log messages will continue to be logged in /usr/app/domains/base_domain/servers/AdminServer/logs/access.log.>
<Apr 1, 2012 10:44:34 AM CEST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STANDBY.>
<Apr 1, 2012 10:44:34 AM CEST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STARTING.>
<Apr 1, 2012 10:44:37 AM CEST> <Notice> <LoggingService> <BEA-320400> <The log file /usr/app/domains/base_domain/servers/AdminServer/logs/base_domain.log will be rotated. Reopen the log file if tailing has stopped. This can happen on some platforms, such as Windows.>
<Apr 1, 2012 10:44:37 AM CEST> <Notice> <LoggingService> <BEA-320401> <The log file has been rotated to /usr/app/domains/base_domain/servers/AdminServer/logs/base_domain.log00032. Log messages will continue to be logged in /usr/app/domains/base_domain/servers/AdminServer/logs/base_domain.log.>
<Apr 1, 2012 10:44:37 AM CEST> <Notice> <Log Management> <BEA-170027> <The server has successfully established a connection with the Domain level Diagnostic Service.>
<Apr 1, 2012 10:44:37 AM CEST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to ADMIN.>
<Apr 1, 2012 10:44:37 AM CEST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RESUMING.>
<Apr 1, 2012 10:44:37 AM CEST> <Notice> <Server> <BEA-002613> <Channel
<Apr 1, 2012 10:44:37 AM CEST> <Notice> <WebLogicServer> <BEA-000331> <Started the WebLogic Server Administration Server "AdminServer" for domain "base_domain" running in development mode.>
<Apr 1, 2012 10:44:37 AM CEST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RUNNING.>
<Apr 1, 2012 10:44:37 AM CEST> <Notice> <WebLogicServer> <BEA-000360> <The server started in RUNNING mode.>
SimpleSampleIdentityAsserterProviderImpl: getConfiguration
SimpleSampleIdentityAsserterProviderImpl: getConfiguration
SimpleSampleIdentityAsserterProviderImpl: getConfiguration
SimpleSampleIdentityAsserterProviderImpl: getConfiguration
SimpleSampleIdentityAsserterProviderImpl: getConfiguration
SimpleSampleIdentityAsserterProviderImpl: getConfiguration
SimpleSampleIdentityAsserterProviderImpl: getConfiguration
SimpleSampleIdentityAsserterProviderImpl: getConfiguration
SimpleSampleIdentityAsserterProviderImpl: getConfiguration
SimpleSampleIdentityAsserterProviderImpl.assertIdentity
Type = SamplePerimeterAtnToken
Token = [B@8393a
userName = dave
SimpleSampleIdentityAsserterProviderImpl: getAssertionModuleConfiguration
SimpleSampleIdentityAsserterProviderImpl: getConfiguration
SimpleSampleLoginModuleImpl.initialize
SimpleSampleLoginModuleImpl.login
userName = dave
userName=dave
groupName = SamplePerimeterAtnUsers
SimpleSampleLoginModule.commit
SimpleSampleIdentityAsserterProviderImpl.assertIdentity
Type = SamplePerimeterAtnToken
Token = [B@8393a
userName = dave
SimpleSampleIdentityAsserterProviderImpl.assertIdentity
Type = SamplePerimeterAtnToken
Token = [B@8393a
userName = dave
SimpleSampleIdentityAsserterProviderImpl.assertIdentity
Type = SamplePerimeterAtnToken
Token = [B@8393a
userName = dave
SimpleSampleIdentityAsserterProviderImpl.assertIdentity
Type = SamplePerimeterAtnToken
Token = [B@8393a
userName = dave
SimpleSampleIdentityAsserterProviderImpl.assertIdentity
Type = SamplePerimeterAtnToken
Token = [B@8393a
userName = dave
SimpleSampleIdentityAsserterProviderImpl.assertIdentity
Type = SamplePerimeterAtnToken
Token = [B@8393a
userName = dave
SimpleSampleIdentityAsserterProviderImpl.assertIdentity
Type = SamplePerimeterAtnToken
Token = [B@8393a
userName = dave
SimpleSampleIdentityAsserterProviderImpl: getConfiguration
SimpleSampleLoginModuleImpl.initialize
SimpleSampleLoginModuleImpl.login
userName = weblogic
userName=weblogic
groupName = SamplePerimeterAtnUsers
SimpleSampleLoginModule.commit
SimpleSampleIdentityAsserterProviderImpl.assertIdentity
Type = SamplePerimeterAtnToken
Token = [B@8393a
userName = dave
SimpleSampleIdentityAsserterProviderImpl.assertIdentity
Type = SamplePerimeterAtnToken
Token = [B@8393a
userName = dave
SimpleSampleIdentityAsserterProviderImpl: getConfiguration
SimpleSampleIdentityAsserterProviderImpl.assertIdentity
Type = SamplePerimeterAtnToken
Token = [B@8393a
userName = dave
SimpleSampleIdentityAsserterProviderImpl: getAssertionModuleConfiguration
SimpleSampleIdentityAsserterProviderImpl: getConfiguration
SimpleSampleLoginModuleImpl.initialize
SimpleSampleLoginModuleImpl.login
userName = dave
userName=dave
groupName = SamplePerimeterAtnUsers
SimpleSampleLoginModule.commit



Domain config with new provider - default provider must be set to SUFFICIENT because mock users do not exist in WLS LPAP
<name>base_domain</name>
<domain-version>12.1.1.0</domain-version>
<security-configuration>
<name>base_domain</name>
<realm>
<sec:authentication-provider xsi:type="wls:default-authenticatorType">
<sec:control-flag>SUFFICIENT</sec:control-flag>
</sec:authentication-provider>
<sec:authentication-provider xsi:type="wls:default-identity-asserterType">
<sec:active-type>AuthenticatedUser</sec:active-type>
</sec:authentication-provider>
<sec:authentication-provider xmlns:ext="http://xmlns.oracle.com/weblogic/security/extension" xsi:type="ext:simple-sample-identity-asserterType">
<sec:name>SimpleSampleIdentityAserter</sec:name>
</sec:authentication-provider>
<sec:role-mapper xmlns:xac="http://xmlns.oracle.com/weblogic/security/xacml" xsi:type="xac:xacml-role-mapperType"></sec:role-mapper>
<sec:authorizer xmlns:xac="http://xmlns.oracle.com/weblogic/security/xacml" xsi:type="xac:xacml-authorizerType"></sec:authorizer>
<sec:adjudicator xsi:type="wls:default-adjudicatorType"></sec:adjudicator>
<sec:credential-mapper xsi:type="wls:default-credential-mapperType"></sec:credential-mapper>
<sec:cert-path-provider xsi:type="wls:web-logic-cert-path-providerType"></sec:cert-path-provider>
<sec:cert-path-builder>WebLogicCertPathProvider</sec:cert-path-builder>
<sec:name>myrealm</sec:name>
<sec:password-validator xmlns:pas="http://xmlns.oracle.com/weblogic/security/providers/passwordvalidator" xsi:type="pas:system-password-validatorType">
<sec:name>SystemPasswordValidator</sec:name>
<pas:min-password-length>8</pas:min-password-length>
<pas:min-numeric-or-special-characters>1</pas:min-numeric-or-special-characters>
</sec:password-validator>
</realm>
<default-realm>myrealm</default-realm>




Captured HTTP header using Firefox plugin Live HTTP headers
First run without added token in HTTP request header

http://localhost:7002/samplePerimeterAtnWebApp/SamplePerimeterAtn.jsp

GET /samplePerimeterAtnWebApp/SamplePerimeterAtn.jsp HTTP/1.1
Host: localhost:7001
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:11.0) Gecko/20100101 Firefox/11.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Cookie: ADMINCONSOLESESSION=GGfvP4VP5YBZbBcQXb4vQJVF1TRPTq1Qsn4b8yLx1m2H7Q8PlT8v!385259249

HTTP/1.1 401 Unauthorized
Date: Sun, 01 Apr 2012 09:10:09 GMT
Content-Length: 1468
Content-Type: text/html; charset=UTF-8
X-Powered-By: Servlet/3.0 JSP/2.2
----------------------------------------------------------
http://localhost:7001/samplePerimeterAtnWebApp/SamplePerimeterAtn.jsp

GET /samplePerimeterAtnWebApp/SamplePerimeterAtn.jsp HTTP/1.1
Host: localhost:7001
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:11.0) Gecko/20100101 Firefox/11.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Cookie: ADMINCONSOLESESSION=GGfvP4VP5YBZbBcQXb4vQJVF1TRPTq1Qsn4b8yLx1m2H7Q8PlT8v!385259249
SamplePerimeterAtnToken: username=dave

HTTP/1.1 200 OK
Date: Sun, 01 Apr 2012 09:10:18 GMT
Content-Length: 90
Content-Type: text/html; charset=ISO-8859-1
Set-Cookie: JSESSIONID=x1yHP4bhj2RjFQL7Ph46hkysTmZC4LXm0gglyL3DsSh2hmTGhVt2!385259249; path=/; HttpOnly
X-Powered-By: Servlet/3.0 JSP/2.2
----------------------------------------------------------

WebLogic X509 Certificate Authentication

$
0
0
Securing Web Applications http://docs.oracle.com/cd/E14571_01/web.1111/e13711/thin_client.htm#i1044688

How to Set Up X509 Certificate Authentication for Oracle WebLogic Server http://www.oracle.com/technetwork/articles/damo-howto-091164.html

Installing and Configuring the Apache HTTP Server Plug-In
http://docs.oracle.com/cd/E14571_01/web.1111/e14395/apache.htm Certificate is send by Weblogic plugin in WL-Proxy-Client-Cert HTTP header

in weblogic.xml
client-cert-proxy-enabled The element default value is true. When set to true, WebLogic Server passes identity certificates from the clients to the backend servers. Also, WebLogic Server is notified whether to honor or discard the incoming WL-Proxy-Client-Cert header. A proxy-server plugin encodes each identity certification in the WL-Proxy-Client-Cert header and passes it to the backend WebLogic Server instances. Each WebLogic Server instance takes the certificate information from the header, ensures it came from a secure source, and uses that information to authenticate the user. For the background WebLogic Server instances, this parameter must be set to true (either at the cluster/server level or at the Web application level). If you set this element to true, use a weblogic.security.net.ConnectionFilter to ensure that each WebLogic Server instance accepts connections only from the machine on which the proxy-server plugin is running. If you specify true without using a connection filter, a potential security vulnerability is created because the WL-Proxy-Client-Cert header can be spoofed.

web.xmlhttp://docs.oracle.com/cd/E23943_01/web.1111/e13712/web_xml.htm

<security-constraint>
<web-resource-collection>
<web-resource-name>Faces Servlet</web-resource-name>
<url-pattern>/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>AppUser</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>
<login-config>
<auth-method>CLIENT-CERT</auth-method>
<realm-name>NoSuchRealm</realm-name>
</login-config>
<security-role>
<role-name>AppUser</role-name>
</security-role>

</web-app>
weblogic.xml http://docs.oracle.com/cd/E14571_01/web.1111/e13712/weblogic_xml.htm

<wls:security-role-assignment>
<wls:role-name>AppUser</wls:role-name>
<wls:principal-name>AppUsers</wls:principal-name>
</wls:security-role-assignment>

Configure slf4j with log4j on Weblogic

$
0
0


It is neccessary to use filtering classloader to avoid discovery of Weblogic own version of slf4j jars. With prefer-application-packages option application classloader loads org.slf4j packages from application instead of Weblogic installation

Annoying SLF4J problem in Weblogic server 12c http://blog.terrencemiao.com/archives/annoying-slf4j-problem-in-weblogic-server-12c

 prefer-application-packages
Used for filtering ClassLoader configuration. Specifies a list of packages for classes that must always be loaded from the application.http://docs.oracle.com/cd/E24329_01/web.1211/e21049/weblogic_xml.htm#autoId24

Weblogic log without prefer-application-packages and after redeploy with the option set in weblogic.xml
Aug 3, 2012 11:20:03 PM dave.TestSlf4jLogger doGet
INFO: Hello World- info
Aug 3, 2012 11:20:04 PM dave.TestSlf4jLogger doGet
INFO: Hello World- info
Aug 3, 2012 11:20:05 PM dave.TestSlf4jLogger doGet
INFO: Hello World- info
Aug 3, 2012 11:20:05 PM dave.TestSlf4jLogger doGet
INFO: Hello World- info
Aug 3, 2012 11:20:05 PM dave.TestSlf4jLogger doGet
INFO: Hello World- info
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/app/weblogic121/modules/org.slf4j.jdk14_1.6.1.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [zip:/home/dave/workspace38/testSLF4JWAR/WebContent/WEB-INF/lib/slf4j-log4j12-1.6.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
log4j: Parsing for [root] with value=[DEBUG, file, stdout].
log4j: Level token is [DEBUG].
log4j: Category root set to DEBUG
log4j: Parsing appender named "file".
log4j: Parsing layout options for "file".
log4j: Setting property [conversionPattern] to [%d{ABSOLUTE} %5p %c{1}:%L - %m%n].
log4j: End of parsing for "file".
log4j: Setting property [file] to [/tmp/testSLF4j.log].
log4j: Setting property [maxBackupIndex] to [1].
log4j: Setting property [maxFileSize] to [1MB].
log4j: setFile called: /tmp/testSLF4j.log, true
log4j: setFile ended
log4j: Parsed "file" options.
log4j: Parsing appender named "stdout".
log4j: Parsing layout options for "stdout".
log4j: Setting property [conversionPattern] to [%d{ABSOLUTE} %5p %c{1}:%L - %m%n].
log4j: End of parsing for "stdout".
log4j: Setting property [target] to [System.out].
log4j: Parsed "stdout" options.
log4j: Finished configuring.
23:23:07,943 DEBUG TestSlf4jLogger:41 - Hello World - debug
23:23:07,949 INFO TestSlf4jLogger:42 - Hello World- info
23:23:08,590 DEBUG TestSlf4jLogger:41 - Hello World - debug
23:23:08,592 INFO TestSlf4jLogger:42 - Hello World- info
23:23:09,386 DEBUG TestSlf4jLogger:41 - Hello World - debug
23:23:09,387 INFO TestSlf4jLogger:42 - Hello World- info

log file created
[dave@dave testSLF4JWAR]$ more /tmp/testSLF4j.log 
23:23:07,943 DEBUG TestSlf4jLogger:41 - Hello World - debug
23:23:07,949 INFO TestSlf4jLogger:42 - Hello World- info
23:23:08,590 DEBUG TestSlf4jLogger:41 - Hello World - debug
23:23:08,592 INFO TestSlf4jLogger:42 - Hello World- info
23:23:09,386 DEBUG TestSlf4jLogger:41 - Hello World - debug
23:23:09,387 INFO TestSlf4jLogger:42 - Hello World- info

libraries in project
[dave@dave testSLF4JWAR]$ ls -1 WebContent/WEB-INF/lib/ 
log4j-1.2.16.jar
slf4j-api-1.6.6.jar
slf4j-log4j12-1.6.6.jar


slf4j libraries in Weblogic
[dave@dave testSLF4JWAR]$ find /app/weblogic121/ -name "*slf4j*"
/app/weblogic121/modules/org.slf4j.jdk14_1.6.1.0.jar
/app/weblogic121/modules/org.slf4j.ext_1.6.1.0.jar
/app/weblogic121/modules/org.slf4j.api_1.6.1.0.jar

log4j.properties
log4j.debug=true

# Root logger option
log4j.rootLogger=DEBUG, file, stdout

# Direct log messages to a log file
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.File=/tmp/testSLF4j.log
log4j.appender.file.MaxFileSize=1MB
log4j.appender.file.MaxBackupIndex=1
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n

# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n

weblogic.xml
<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-web-app xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.4/weblogic-web-app.xsd">
<wls:weblogic-version>12.1.1</wls:weblogic-version>
<wls:context-root>testSLF4JWAR</wls:context-root>
<wls:container-descriptor>
<wls:prefer-application-packages>
<wls:package-name>org.slf4j</wls:package-name>
</wls:prefer-application-packages>
</wls:container-descriptor>
</wls:weblogic-web-app>
Test servlet
package dave;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


/**
* Servlet implementation class TestSlf4jLogger
*/
@WebServlet("/TestSlf4jLogger")
public class TestSlf4jLogger extends HttpServlet {
private static final long serialVersionUID = 1L;

final Logger logger = LoggerFactory.getLogger(TestSlf4jLogger.class);

/**
* @see HttpServlet#HttpServlet()
*/
public TestSlf4jLogger() {
super();
// TODO Auto-generated constructor stub
}

/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
* response)
*/
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
PrintWriter out = response.getWriter();
out.println("Hello World");
logger.debug("Hello World - debug");
logger.info("Hello World- info");

}

/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
* response)
*/
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
}

}

Weblogic log with added ejb module
LF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/app/weblogic121/modules/org.slf4j.jdk14_1.6.1.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [zip:/home/dave/workspace38/testSLF4jEAR/EarContent/APP-INF/lib/slf4j-log4j12-1.6.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [zip:/home/dave/workspace38/testSLF4JWAR/WebContent/WEB-INF/lib/slf4j-log4j12-1.6.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
log4j: Parsing for [root] with value=[DEBUG, file, stdout].
log4j: Level token is [DEBUG].
log4j: Category root set to DEBUG
log4j: Parsing appender named "file".
log4j: Parsing layout options for "file".
log4j: Setting property [conversionPattern] to [%d{ABSOLUTE} %5p %c{1}:%L - %m%n].
log4j: End of parsing for "file".
log4j: Setting property [file] to [/tmp/testSLF4j.log].
log4j: Setting property [maxBackupIndex] to [1].
log4j: Setting property [maxFileSize] to [1MB].
log4j: setFile called: /tmp/testSLF4j.log, true
log4j: setFile ended
log4j: Parsed "file" options.
log4j: Parsing appender named "stdout".
log4j: Parsing layout options for "stdout".
log4j: Setting property [conversionPattern] to [%d{ABSOLUTE} %5p %c{1}:%L - %m%n].
log4j: End of parsing for "stdout".
log4j: Setting property [target] to [System.out].
log4j: Parsed "stdout" options.
log4j: Finished configuring.
00:07:24,873 DEBUG TestSlf4jLogger:46 - Hello World - debug
00:07:24,928 INFO TestSlf4jLogger:47 - Hello World- info
TestSLF4JService: Hello World
Aug 4, 2012 12:07:25 AM dave.TestSLF4JBean testLogger
INFO: TestSLF4JService: Hello World- info

Weblogic log after adding prefer-application-packages into weblogic-application.xml descriptor
00:14:48,273 DEBUG TestSlf4jLogger:46 - Hello World - debug
00:14:48,277 INFO TestSlf4jLogger:47 - Hello World- info
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/app/weblogic121/modules/org.slf4j.jdk14_1.6.1.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [zip:/home/dave/workspace38/testSLF4jEAR/EarContent/APP-INF/lib/slf4j-log4j12-1.6.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
TestSLF4JService: Hello World
00:14:48,297 DEBUG TestSLF4JBean:26 - TestSLF4JService: Hello World - debug
00:14:48,297 INFO TestSLF4JBean:27 - TestSLF4JService: Hello World- info

weblogic-application.xml descriptor
<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-application xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-application" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/javaee_5.xsd http://xmlns.oracle.com/weblogic/weblogic-application http://xmlns.oracle.com/weblogic/weblogic-application/1.4/weblogic-application.xsd">
<!--weblogic-version:12.1.1-->
<wls:application-param>
<wls:param-name>webapp.encoding.default</wls:param-name>
<wls:param-value>UTF-8</wls:param-value>
</wls:application-param>
<wls:prefer-application-packages>
<wls:package-name>org.slf4j</wls:package-name>
</wls:prefer-application-packages>
</wls:weblogic-application>
EAR content
dave@dave workspace38]$ ls testSLF4jEAR/EarContent/APP-INF/lib
log4j-1.2.16.jar slf4j-api-1.6.6.jar slf4j-log4j12-1.6.6.jar
[dave@dave workspace38]$ ls -1 testSLF4jEAR/EarContent/APP-INF/lib
log4j-1.2.16.jar
slf4j-api-1.6.6.jar
slf4j-log4j12-1.6.6.jar
[dave@dave workspace38]$ ls -1 testSLF4jEAR/EarContent/META-INF
weblogic-application.xml

test Session Bean
package dave;

import javax.ejb.Stateless;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Session Bean implementation class TestSLF4JService
*/
@Stateless
public class TestSLF4JBean implements TestSLF4JService {

final Logger logger = LoggerFactory.getLogger(TestSLF4JBean.class);

/**
* Default constructor.
*/
public TestSLF4JBean() {
// TODO Auto-generated constructor stub
}

public void testLogger(){

System.out.println("TestSLF4JService: Hello World");
logger.debug("TestSLF4JService: Hello World - debug");
logger.info("TestSLF4JService: Hello World- info");

}

}

injection of Session Bean in Servlet

@EJB
TestSLF4JService service;


/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
* response)
*/
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
PrintWriter out = response.getWriter();
out.println("Hello World");
logger.debug("Hello World - debug");
logger.info("Hello World- info");

service.testLogger();

}

Debug Identity Assertion on Weblogic

$
0
0

Debug Identity Assertion on Weblogic 


Identity Assertion Providers
http://docs.oracle.com/cd/E21764_01/web.1111/e13718/ia.htm#autoId7

 Enable DebugSecurityAtn andRedirect stdout logging enabled inWeblogic console


[dave@dave logs]$ grep newuser *
AdminServer.log:####<Aug 6, 2012 11:23:56 PM CEST> <Notice> <Stdout> <dave> <AdminServer> <[ACTIVE] ExecuteThread: '6' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1344288236861> <BEA-000000> <userName = newuser>
AdminServer.log:####<Aug 6, 2012 11:23:56 PM CEST> <Debug> <SecurityAtn> <dave> <AdminServer> <[ACTIVE] ExecuteThread: '6' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1344288236865> <BEA-000000> <com.bea.common.security.internal.service.IdentityAssertionCallbackServiceImpl.assertIdentity returning newuser>
AdminServer.log:####<Aug 6, 2012 11:23:56 PM CEST> <Debug> <SecurityAtn> <dave> <AdminServer> <[ACTIVE] ExecuteThread: '6' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1344288236865> <BEA-000000> <com.bea.common.security.internal.service.IdentityCacheServiceImpl.getCachedIdentity(newuser)>
AdminServer.log:####<Aug 6, 2012 11:23:56 PM CEST> <Debug> <SecurityAtn> <dave> <AdminServer> <[ACTIVE] ExecuteThread: '6' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1344288236865> <BEA-000000> <com.bea.common.security.internal.service.IdentityCacheServiceImpl.getCachedIdentity(newuser) returning null>
AdminServer.log:####<Aug 6, 2012 11:23:56 PM CEST> <Debug> <SecurityAtn> <dave> <AdminServer> <[ACTIVE] ExecuteThread: '6' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1344288236872> <BEA-000000> <com.bea.common.security.internal.service.CallbackHandlerWrapper.handle got username from callbacks[0], UserName=newuser>
AdminServer.log:####<Aug 6, 2012 11:23:56 PM CEST> <Debug> <SecurityAtn> <dave> <AdminServer> <[ACTIVE] ExecuteThread: '6' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1344288236872> <BEA-000000> <LDAP Atn Login username: newuser>
AdminServer.log:####<Aug 6, 2012 11:23:56 PM CEST> <Debug> <SecurityAtn> <dave> <AdminServer> <[ACTIVE] ExecuteThread: '6' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1344288236872> <BEA-000000> <userExists? user:newuser>
AdminServer.log:####<Aug 6, 2012 11:23:56 PM CEST> <Debug> <SecurityAtn> <dave> <AdminServer> <[ACTIVE] ExecuteThread: '6' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1344288236873> <BEA-000000> <getDNForUser search("ou=people,ou=myrealm,dc=base_domain", "(&(uid=newuser)(objectclass=person))", base DN& below)>
AdminServer.log:####<Aug 6, 2012 11:23:56 PM CEST> <Debug> <SecurityAtn> <dave> <AdminServer> <[ACTIVE] ExecuteThread: '6' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1344288236874> <BEA-000000> <DN for user newuser: null>
AdminServer.log:####<Aug 6, 2012 11:23:56 PM CEST> <Debug> <SecurityAtn> <dave> <AdminServer> <[ACTIVE] ExecuteThread: '6' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1344288236874> <BEA-000000> <user does not exist, user:newuser>
AdminServer.log:####<Aug 6, 2012 11:23:56 PM CEST> <Debug> <SecurityAtn> <dave> <AdminServer> <[ACTIVE] ExecuteThread: '6' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1344288236878> <BEA-000000> <javax.security.auth.login.LoginException: [Security:090300]Identity Assertion Failed: User newuser does not exist
AdminServer.log:####<Aug 6, 2012 11:23:56 PM CEST> <Notice> <Stdout> <dave> <AdminServer> <[ACTIVE] ExecuteThread: '6' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1344288236887> <BEA-000000> <LoginModule: getUserName userName = newuser&gt;
AdminServer.log:####<Aug 6, 2012 11:23:56 PM CEST> <Notice> <Stdout> <dave> <AdminServer> <[ACTIVE] ExecuteThread: '6' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1344288236888> <BEA-000000> <login: userName=newuser>
AdminServer.log: Principal: newuser
AdminServer.log: Principal = class weblogic.security.principal.WLSUserImpl("newuser")
AdminServer.log:####<Aug 6, 2012 11:23:56 PM CEST> <Debug> <SecurityAtn> <dave> <AdminServer> <[ACTIVE] ExecuteThread: '6' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1344288236892> <BEA-000000> <com.bea.common.security.internal.service.PrincipalValidationServiceImpl.sign(Principal) Principal=newuser>
AdminServer.log:####<Aug 6, 2012 11:23:56 PM CEST> <Debug> <SecurityAtn> <dave> <AdminServer> <[ACTIVE] ExecuteThread: '6' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1344288236893> <BEA-000000> <Generated signature and signed WLS principal newuser>
AdminServer.log: Principal = class weblogic.security.principal.WLSUserImpl("newuser")
AdminServer.log:####<Aug 6, 2012 11:23:56 PM CEST> <Debug> <SecurityAtn> <dave> <AdminServer> <[ACTIVE] ExecuteThread: '6' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1344288236897> <BEA-000000> <weblogic.security.service.internal.WLSJAASLoginServiceImpl$ServiceImpl.authenticate authenticate succeeded for user newuser, Identity=Subject: 3
AdminServer.log: Principal = class weblogic.security.principal.WLSUserImpl("newuser")

AdminServer.log:####<Aug 6, 2012 11:23:56 PM CEST> <Debug> <SecurityAtn> <dave> <AdminServer> <[ACTIVE] ExecuteThread: '6' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1344288236897> <BEA-000000> <weblogic.security.service.internal.WLSJAASLoginServiceImpl$ServiceImpl.authenticate login succeeded and newuser was not previously locked out>
AdminServer.log: Principal = class weblogic.security.principal.WLSUserImpl("newuser")
AdminServer.log:####<Aug 6, 2012 11:23:56 PM CEST> <Debug> <SecurityAtn> <dave> <AdminServer> <[ACTIVE] ExecuteThread: '6' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1344288236900> <BEA-000000> <com.bea.common.security.internal.service.PrincipalValidationServiceImpl.validate(Principal) Principal=newuser>
AdminServer.log:####<Aug 6, 2012 11:23:56 PM CEST> <Debug> <SecurityAtn> <dave> <AdminServer> <[ACTIVE] ExecuteThread: '6' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1344288236901> <BEA-000000> <Validate WLS principal newuser returns true>
AdminServer.log: Principal = class weblogic.security.principal.WLSUserImpl("newuser")
AdminServer.log: Principal = weblogic.security.principal.WLSUserImpl("newuser")
AdminServer.log:####<Aug 6, 2012 11:23:57 PM CEST> <Notice> <Stdout> <dave> <AdminServer> <[ACTIVE] ExecuteThread: '6' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1344288237047> <BEA-000000> <23:23:57,047 INFO TestSlf4jLogger:53 - Hello World- principalnewuser>
AdminServer.log:####<Aug 6, 2012 11:23:57 PM CEST> <Notice> <Stdout> <dave> <AdminServer> <[ACTIVE] ExecuteThread: '6' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1344288237048> <BEA-000000> <23:23:57,048 INFO TestSlf4jLogger:57 - Hello World- subject[newuser, SamplePerimeterAtnUsers, DaveUsers]>
base_domain.log:####<Aug 6, 2012 11:23:56 PM CEST> <Notice> <Stdout> <dave> <AdminServer> <[ACTIVE] ExecuteThread: '6' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1344288236861> <BEA-000000> <userName = newuser>
base_domain.log:####<Aug 6, 2012 11:23:56 PM CEST> <Notice> <Stdout> <dave> <AdminServer> <[ACTIVE] ExecuteThread: '6' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1344288236887> <BEA-000000> <LoginModule: getUserName userName = newuser>
base_domain.log:####<Aug 6, 2012 11:23:56 PM CEST> <Notice> <Stdout> <dave> <AdminServer> <[ACTIVE] ExecuteThread: '6' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1344288236888> <BEA-000000> <login: userName=newuser>
base_domain.log:####<Aug 6, 2012 11:23:57 PM CEST> <Notice> <Stdout> <dave> <AdminServer> <[ACTIVE] ExecuteThread: '6' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1344288237047> <BEA-000000> <23:23:57,047 INFO TestSlf4jLogger:53 - Hello World- principalnewuser>
base_domain.log:####<Aug 6, 2012 11:23:57 PM CEST> <Notice> <Stdout> <dave> <AdminServer> <[ACTIVE] ExecuteThread: '6' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1344288237048> <BEA-000000> <23:23:57,048 INFO TestSlf4jLogger:57 - Hello World- subject[newuser, SamplePerimeterAtnUsers, DaveUsers]>


web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>testSLF4JWAR</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<!-- Specifies the security settings for the SamplePerimeterAtn web app.

This webapp is used to demonstrate how to use identity assertion to
perform perimeter authentication (where someone outside WLS is
responsible for authenticating the user).

Copyright (c) 2005 by BEA Systems, Inc. All Rights Reserved.
-->

<security-constraint>

<!-- all the pages in this webapp are secured -->
<web-resource-collection>
<web-resource-name>SecuredPages</web-resource-name>
<url-pattern>/</url-pattern>
</web-resource-collection>

<!-- only users in the SamplePerimeterAtnRole will
be granted access to the pages in this webapp
-->
<auth-constraint>
<role-name>
SamplePerimeterAtnRole
</role-name>
</auth-constraint>

<user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>

</security-constraint>

<!-- Use weblogic.xml to map the SamplePerimeterAtnRole
to the SamplePerimeterAtnUsers group. As a result,
"SamplePerimterAtnUsers" will be granted the role
for this webapp (thus be able to access its pages)
-->
<security-role>
<role-name>
SamplePerimeterAtnRole
</role-name>
</security-role>

<!-- turn on identity assertion

The webapp only specifies that identity assertion should be
used. It does not dictate what kind of tokens to use. Rather,
the client and the identity asserter have to agree on the token
type and format.

- the client is responsible sending in a token that identifies the user

- the identity asserter is responsible for converting that token
to a user name.

- the authenticators are responsible for putting that user
and its groups into the subject

The realm name is not used so set it to "NoSuchRealm". It
has nothing to do with the realm names in the console.

Set the auth method to CLIENT-CERT to turn on identity
assertion for this webapp.
-->
<login-config>
<auth-method>CLIENT-CERT</auth-method>
<realm-name>NoSuchRealm</realm-name>
</login-config>

</web-app>

weblogic.xml


<wls:weblogic -web-app="-web-app" xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.4/weblogic-web-app.xsd">
<wls:weblogic -version="-version">12.1.1</wls:weblogic>
<wls:context -root="-root">testSLF4JWAR</wls:context>
<wls:container -descriptor="-descriptor">
<wls:prefer -application-packages="-application-packages">
<wls:package -name="-name">org.slf4j</wls:package>
</wls:prefer>
</wls:container>
<wls:security -role-assignment="-role-assignment">
<wls:role-name=">SamplePerimeterAtnRole</wls:role-name>
<wls:principal-name="">SamplePerimeterAtnUsers</wls:principal-name>
</wls:security>
</wls:weblogic>
</div>

JBoss Portal 6.2 - deploy sample portlet

$
0
0
JBoss Portal 6.2 release notes

https://access.redhat.com/documentation/en-US/Red_Hat_JBoss_Portal/6.2/pdf/6.2.0_Release_Notes/Red_Hat_JBoss_Portal-6.2-6.2.0_Release_Notes-en-US.pdf

JBoss Portal 6.2 supported configurations
ttps://access.redhat.com/articles/119833#Comp_6_2

JBoss Portal samples on GitHub
https://github.com/jboss-developer/jboss-portal-quickstarts

Install JBoss Portal - download installation and samples using  JBoss Developer account

Download zip installation and unzip
[dave@localhost ~]$ ls -1  ~/Downloads/jboss-portal-6.2.0*
/home/dave/Downloads/jboss-portal-6.2.0-quickstarts.zip
/home/dave/Downloads/jboss-portal-6.2.0.zip


Start JBoss Portal
[dave@localhost bin]$ ./standalone.sh 
=========================================================================

JBoss Bootstrap Environment

JBOSS_HOME: /app/jboss-portal-6.2

JAVA: /usr/java/jdk1.8.0_45/bin/java

JAVA_OPTS: -server -XX:+UseCompressedOops -verbose:gc -Xloggc:"/app/jboss-portal-6.2/standalone/log/gc.log" -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=3M -XX:-TraceClassUnloading -Xms1303m -Xmx1303m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Djboss.modules.policy-permissions=true

=========================================================================

Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
20:57:34,870 INFO [org.jboss.modules] (main) JBoss Modules version 1.3.6.Final-redhat-1
20:57:36,835 INFO [org.jboss.msc] (main) JBoss MSC version 1.1.5.Final-redhat-1
20:57:37,151 INFO [org.jboss.as] (MSC service thread 1-7) JBAS015899: JBoss Portal 6.2.0.GA (AS 7.5.0.Final-redhat-21) starting
20:57:42,059 INFO [org.gatein] (ServerService Thread Pool -- 24) Setting 'exo.conf.dir'
20:57:42,061 INFO [org.gatein] (ServerService Thread Pool -- 24) Setting 'exo.conf.dir.name'
20:57:42,061 INFO [org.gatein] (ServerService Thread Pool -- 24) Setting 'gatein.conf.dir'
20:57:44,362 INFO [org.xnio] (MSC service thread 1-7) XNIO Version 3.0.13.GA-redhat-1
20:57:44,381 INFO [org.jboss.as.server] (Controller Boot Thread) JBAS015888: Creating http management service using socket-binding (management-http)




Install portlet sample via Maven

[dave@localhost jboss-portal-6.2.0-quickstarts]$ cd simplest-hello-world-portlet
[dave@localhost simplest-hello-world-portlet]$ ls
pom.xml README.html README.md src
[dave@localhost simplest-hello-world-portlet]$ pwd
[dave@localhost simplest-hello-world-portlet]$ mvn clean package jboss-as:deploy
[INFO] Scanning for projects...
Downloading: http://maven.repository.redhat.com/earlyaccess/all/org/jboss/bom/portal/jboss-portal-bom/6.2.0.GA/jboss-portal-bom-6.2.0.GA.pom
Downloading: http://maven.repository.redhat.com/techpreview/all/org/jboss/bom/portal/jboss-portal-bom/6.2.0.GA/jboss-portal-bom-6.2.0.GA.pom
Downloaded: http://maven.repository.redhat.com/techpreview/all/org/jboss/bom/portal/jboss-portal-bom/6.2.0.GA/jboss-portal-bom-6.2.0.GA.pom (6 KB at 5.0 KB/sec)
Downloading: http://maven.repository.redhat.com/earlyaccess/all/org/jboss/bom/eap/jboss-eap-bom-parent/6.4.0.GA/jboss-eap-bom-parent-6.4.0.GA.pom
Downloading: http://maven.repository.redhat.com/techpreview/all/org/jboss/bom/eap/jboss-eap-bom-parent/6.4.0.GA/jboss-eap-bom-parent-6.4.0.GA.pom
Downloaded: http://maven.repository.redhat.com/techpreview/all/org/jboss/bom/eap/jboss-eap-bom-parent/6.4.0.GA/jboss-eap-bom-parent-6.4.0.GA.pom (7 KB at 27.3 KB/sec)
Downloading: http://maven.repository.redhat.com/earlyaccess/all/org/jboss/spec/jboss-javaee-6.0/3.0.2.Final-redhat-15/jboss-javaee-6.0-3.0.2.Final-redhat-15.pom
Downloaded: http://maven.repository.redhat.com/earlyaccess/all/org/jboss/spec/jboss-javaee-6.0/3.0.2.Final-redhat-15/jboss-javaee-6.0-3.0.2.Final-redhat-15.pom (18 KB at 22.1 KB/sec)
Downloading: http://maven.repository.redhat.com/earlyaccess/all/org/jboss/jboss-parent/14.0.0.redhat-1/jboss-parent-14.0.0.redhat-1.pom
Downloaded: http://maven.repository.redhat.com/earlyaccess/all/org/jboss/jboss-parent/14.0.0.redhat-1/jboss-parent-14.0.0.redhat-1.pom (33 KB at 42.5 KB/sec)
Downloading: http://maven.repository.redhat.com/earlyaccess/all/org/richfaces/richfaces-bom/4.3.7.Final-redhat-1/richfaces-bom-4.3.7.Final-redhat-1.pom
Downloading: http://maven.repository.redhat.com/techpreview/all/org/richfaces/richfaces-bom/4.3.7.Final-redhat-1/richfaces-bom-4.3.7.Final-redhat-1.pom
Downloaded: http://maven.repository.redhat.com/techpreview/all/org/richfaces/richfaces-bom/4.3.7.Final-redhat-1/richfaces-bom-4.3.7.Final-redhat-1.pom (12 KB at 12.6 KB/sec)
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Simplest Hello World Portlet 6.2.0.GA
[INFO] ------------------------------------------------------------------------
Downloading: http://maven.repository.redhat.com/earlyaccess/all/org/apache/maven/plugins/maven-war-plugin/2.2/maven-war-plugin-2.2.pom
Downloading: http://maven.repository.redhat.com/techpreview/all/org/apache/maven/plugins/maven-war-plugin/2.2/maven-war-plugin-2.2.pom
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-war-plugin/2.2/maven-war-plugin-2.2.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-war-plugin/2.2/maven-war-plugin-2.2.pom (7 KB at 43.0 KB/sec)
Downloading: http://maven.repository.redhat.com/earlyaccess/all/org/apache/maven/plugins/maven-war-plugin/2.2/maven-war-plugin-2.2.jar
Downloading: http://maven.repository.redhat.com/techpreview/all/org/apache/maven/plugins/maven-war-plugin/2.2/maven-war-plugin-2.2.jar
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-war-plugin/2.2/maven-war-plugin-2.2.jar
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-war-plugin/2.2/maven-war-plugin-2.2.jar (77 KB at 609.6 KB/sec)
Downloading: http://maven.repository.redhat.com/earlyaccess/all/javax/portlet/portlet-api/2.0/portlet-api-2.0.pom
Downloading: http://maven.repository.redhat.com/techpreview/all/javax/portlet/portlet-api/2.0/portlet-api-2.0.pom
Downloading: http://repo.maven.apache.org/maven2/javax/portlet/portlet-api/2.0/portlet-api-2.0.pom
Downloaded: http://repo.maven.apache.org/maven2/javax/portlet/portlet-api/2.0/portlet-api-2.0.pom (5 KB at 58.4 KB/sec)
Downloading: http://maven.repository.redhat.com/earlyaccess/all/javax/portlet/portlet-api/2.0/portlet-api-2.0.jar
Downloading: http://maven.repository.redhat.com/techpreview/all/javax/portlet/portlet-api/2.0/portlet-api-2.0.jar
Downloading: http://repo.maven.apache.org/maven2/javax/portlet/portlet-api/2.0/portlet-api-2.0.jar
Downloaded: http://repo.maven.apache.org/maven2/javax/portlet/portlet-api/2.0/portlet-api-2.0.jar (47 KB at 700.3 KB/sec)
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ simplest-hello-world-portlet ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ simplest-hello-world-portlet ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/app/jboss-portal-6.2.0-quickstarts/simplest-hello-world-portlet/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ simplest-hello-world-portlet ---
[INFO] Compiling 1 source file to /home/app/jboss-portal-6.2.0-quickstarts/simplest-hello-world-portlet/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ simplest-hello-world-portlet ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/app/jboss-portal-6.2.0-quickstarts/simplest-hello-world-portlet/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) @ simplest-hello-world-portlet ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.10:test (default-test) @ simplest-hello-world-portlet ---
[INFO] No tests to run.
[INFO] Surefire report directory: /home/app/jboss-portal-6.2.0-quickstarts/simplest-hello-world-portlet/target/surefire-reports

-------------------------------------------------------
T E S T S
-------------------------------------------------------

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

[INFO]
[INFO] --- maven-war-plugin:2.2:war (default-war) @ simplest-hello-world-portlet ---
[INFO] Packaging webapp
[INFO] Assembling webapp [simplest-hello-world-portlet] in [/home/app/jboss-portal-6.2.0-quickstarts/simplest-hello-world-portlet/target/simplest-hello-world-portlet]
[INFO] Processing war project
[INFO] Copying webapp resources [/home/app/jboss-portal-6.2.0-quickstarts/simplest-hello-world-portlet/src/main/webapp]
[INFO] Webapp assembled in [40 msecs]
[INFO] Building war: /home/app/jboss-portal-6.2.0-quickstarts/simplest-hello-world-portlet/target/simplest-hello-world-portlet.war
[INFO] WEB-INF/web.xml already added, skipping
[INFO]
[INFO] >>> jboss-as-maven-plugin:7.4.Final:deploy (default-cli) > package @ simplest-hello-world-portlet >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ simplest-hello-world-portlet ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/app/jboss-portal-6.2.0-quickstarts/simplest-hello-world-portlet/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ simplest-hello-world-portlet ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ simplest-hello-world-portlet ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/app/jboss-portal-6.2.0-quickstarts/simplest-hello-world-portlet/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) @ simplest-hello-world-portlet ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.10:test (default-test) @ simplest-hello-world-portlet ---
[INFO] No tests to run.
[INFO] Skipping execution of surefire because it has already been run for this configuration
[INFO]
[INFO] --- maven-war-plugin:2.2:war (default-war) @ simplest-hello-world-portlet ---
[INFO] Packaging webapp
[INFO] Assembling webapp [simplest-hello-world-portlet] in [/home/app/jboss-portal-6.2.0-quickstarts/simplest-hello-world-portlet/target/simplest-hello-world-portlet]
[INFO] Processing war project
[INFO] Copying webapp resources [/home/app/jboss-portal-6.2.0-quickstarts/simplest-hello-world-portlet/src/main/webapp]
[INFO] Webapp assembled in [2 msecs]
[INFO] Building war: /home/app/jboss-portal-6.2.0-quickstarts/simplest-hello-world-portlet/target/simplest-hello-world-portlet.war
[INFO] WEB-INF/web.xml already added, skipping
[INFO]
[INFO] <<< jboss-as-maven-plugin:7.4.Final:deploy (default-cli) < package @ simplest-hello-world-portlet <<<
[INFO]
[INFO] --- jboss-as-maven-plugin:7.4.Final:deploy (default-cli) @ simplest-hello-world-portlet ---
Sep 14, 2015 9:10:12 PM org.xnio.Xnio <clinit>
INFO: XNIO Version 3.0.7.GA
Sep 14, 2015 9:10:12 PM org.xnio.nio.NioXnio <clinit>
INFO: XNIO NIO Implementation Version 3.0.7.GA
Sep 14, 2015 9:10:12 PM org.jboss.remoting3.EndpointImpl <clinit>
INFO: JBoss Remoting version 3.2.12.GA
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15.949 s
[INFO] Finished at: 2015-09-14T21:10:13+02:00
[INFO] Final Memory: 21M/86M
[INFO] ------------------------------------------------------------------------
[dave@localhost simplest-hello-world-portlet]$

JBoss EAP 6 profiling - running jconsole and jvisualvm

$
0
0
JVisualVM and JConsole are part of Oracle Java SE

 JConsole

JConsole can be started with script provided already with JBoss EAP 6 installation
http://jaitechwriteups.blogspot.cz/2014/12/remote-jmx-access-to-wildfly-or-jboss.html

[dave@localhost jboss-eap-6.4.0]$ find -name  jconsole.sh
./bin/jconsole.sh


Connect via JMX remote process  - use connection string  service:jmx:remoting-jmx://localhost:9999
[dave@localhost bin]$ ./jconsole.sh 
CLASSPATH /usr/java/jdk1.8.0_45/lib/jconsole.jar:/usr/java/jdk1.8.0_45/lib/tools.jar:/app/jboss-eap-6.4.0/bin/client/jboss-cli-client.jar

 

 

 JVisualVM

To use JVisualVM   download script from GitHub here https://github.com/johnaoahra80/jboss-as-tool-integration/blob/master/visualvm/visualvm.sh

Using JVisualVM with JBoss AS7   https://developer.jboss.org/thread/196428

Here is more detailed description for connection http://blog.akquinet.de/2012/11/01/connecting-visualvm-with-a-remote-jboss-as-7-eap6-jvm-process/

CLASSPATH in the script must be modified  due to changed modules path
Add
 JBOSS_MODULEPATH="$JBOSS_HOME/modules/system/layers/base"


[dave@localhost bin]$ ./jvisualvm.sh 
/app/jboss-eap-6.4.0/modules/system/layers/base/org/jboss/remoting3/remoting-jmx/main/
ls: cannot access *.jar: No such file or directory
/app/jboss-eap-6.4.0/modules/system/layers/base/org/jboss/remoting3/main/
/app/jboss-eap-6.4.0/modules/system/layers/base/org/jboss/logging/main/
/app/jboss-eap-6.4.0/modules/system/layers/base/org/jboss/xnio/main/
/app/jboss-eap-6.4.0/modules/system/layers/base/org/jboss/xnio/nio/main/
/app/jboss-eap-6.4.0/modules/system/layers/base/org/jboss/sasl/main/
/app/jboss-eap-6.4.0/modules/system/layers/base/org/jboss/marshalling/main/
/app/jboss-eap-6.4.0/modules/system/layers/base/org/jboss/marshalling/river/main/





Viewing all 181 articles
Browse latest View live