Saturday, December 25, 2010

Log4j wrapper

package daveutil;

import org.apache.log4j.Level;
import org.apache.log4j.Logger;

public class Log4jWrapper {

/*
* TRACE, DEBUG, INFO, WARN, ERROR, FATAL
*/
Level level = Level.DEBUG;

public static Log4jWrapper LOG;

private Logger logger;

static {
synchronized(Log4jWrapper.class){
if(LOG == null){
LOG = new Log4jWrapper("daveapp");
}
}
}

private Log4jWrapper(String logger) {
this.logger = Logger.getLogger(logger);
}

public void log(Object o) {
logger.log(level, o);
}

public void log(Object o,Throwable e) {
logger.log(level, o, e);
}

public void log(String callerFCQN,Object o,Throwable e) {
logger.log(callerFCQN,level, o, e);
}

public void trace(Object o) {
logger.trace(o);
}

public void trace(Object o,Throwable e) {
logger.trace(o,e);
}

public void debug(Object o) {
logger.debug(o);
}

public void debug(Object o,Throwable e) {
logger.debug(o,e);
}

public void info(Object o) {
logger.info(o);
}

public void info(Object o,Throwable e) {
logger.info(o,e);
}

public void warn(Object o) {
logger.warn(o);
}

public void warn(Object o,Throwable e) {
logger.warn(o,e);
}

public void error(Object o) {
logger.error(o);
}

public void error(Object o,Throwable e) {
logger.error(o,e);
}

public void fatal(Object o) {
logger.fatal(o);
}

public void fatal(Object o,Throwable e) {
logger.fatal(o,e);
}

}





Using log4j wrapper
package daveapp;

import daveutil.Log4jWrapper;

public class TestDaveApp {

public void testDaveApp(){

System.out.println("Use Log4jWrapper");
Log4jWrapper.LOG.info("TestDaveApp info");

Log4jWrapper.LOG.info("TestDaveApp info",new Exception("TestDaveApp"));
}

}


log4j properties configuration
Pattern layout
http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/PatternLayout.html


Property Configurator

http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/PropertyConfigurator.html

All option values admit variable substitution. The syntax of variable substitution is similar to that of Unix shells. The string between an opening "${" and closing "}" is interpreted as a key. The value of the substituted variable can be defined as a system property or in the configuration file itself.

#log4j.rootLogger=debug, stdout, dave, daveutil

log4j.logger.dave=DEBUG,stdout, dave
log4j.logger.daveutil=DEBUG, stdout, daveutil
log4j.logger.daveapp=DEBUG, stdout, daveapp

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout

# Pattern to output the caller's file name and line number.
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n

log4j.appender.dave=org.apache.log4j.RollingFileAppender
# do not send to other logs
log4j.additivity.dave=false
log4j.appender.dave.File=${weblogic.Name}.dave.log

log4j.appender.dave.MaxFileSize=10KB
# Keep one backup file
log4j.appender.dave.MaxBackupIndex=5

log4j.appender.dave.layout=org.apache.log4j.PatternLayout
log4j.appender.dave.layout.ConversionPattern=%p %t %c - %m%n

log4j.appender.daveutil=org.apache.log4j.RollingFileAppender
# do not send to other logs
log4j.additivity.daveutil=false
log4j.appender.daveutil.File=${weblogic.Name}.daveutil.log

log4j.appender.daveutil.MaxFileSize=10KB
# Keep one backup file
log4j.appender.daveutil.MaxBackupIndex=5

log4j.appender.daveutil.layout=org.apache.log4j.PatternLayout
log4j.appender.daveutil.layout.ConversionPattern=%p %t %c - %m%n

log4j.appender.daveapp=org.apache.log4j.RollingFileAppender
# do not send to other logs
log4j.additivity.daveapp=false
log4j.appender.daveapp.File=${weblogic.Name}.daveapp.log

log4j.appender.daveapp.MaxFileSize=10KB
# Keep one backup file
log4j.appender.daveapp.MaxBackupIndex=5

log4j.appender.daveapp.layout=org.apache.log4j.PatternLayout
log4j.appender.daveapp.layout.ConversionPattern=%p %t %c - %m%n



Using FCQN - fully qualified class name
Log4jWrapper.LOG.log(TestDaveApp.class.getName(),"TestDaveApp info",new Exception("TestDaveApp"));



INFO (Log4jWrapper.java:62) - TestDaveApp info


DEBUG (TestDave.java:22) - TestDaveApp info

Log into separate files according to package

log4j.properties

#log4j.rootLogger=debug, stdout, dave, daveutil

log4j.logger.dave=DEBUG, dave
log4j.logger.daveutil=DEBUG, daveutil

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout

# Pattern to output the caller's file name and line number.
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n

log4j.appender.dave=org.apache.log4j.RollingFileAppender
# do not send to other logs
log4j.additivity.dave=false
log4j.appender.dave.File=dave.log

log4j.appender.dave.MaxFileSize=10KB
# Keep one backup file
log4j.appender.dave.MaxBackupIndex=5

log4j.appender.dave.layout=org.apache.log4j.PatternLayout
log4j.appender.dave.layout.ConversionPattern=%p %t %c - %m%n


log4j.appender.daveutil=org.apache.log4j.RollingFileAppender
# do not send to other logs
log4j.additivity.daveutil=false
log4j.appender.daveutil.File=daveutil.log

log4j.appender.daveutil.MaxFileSize=10KB
# Keep one backup file
log4j.appender.daveutil.MaxBackupIndex=5

log4j.appender.daveutil.layout=org.apache.log4j.PatternLayout
log4j.appender.daveutil.layout.ConversionPattern=%p %t %c - %m%n




configure log4j in application lifecycle listener

package start;


import java.net.URL;

import org.apache.log4j.PropertyConfigurator;
import org.apache.log4j.helpers.Loader;

import weblogic.application.ApplicationLifecycleEvent;
import weblogic.application.ApplicationLifecycleListener;

public class DaveStart extends ApplicationLifecycleListener {


public void preStart(ApplicationLifecycleEvent event){

System.out.println("DaveStart preStart");
}

public void postStart(ApplicationLifecycleEvent event){

System.out.println("DaveStart postStart");

// configure log4j
URL url = Loader.getResource("log4j.properties");
PropertyConfigurator.configure(url);

System.out.println("DaveStart log4j initialized");

}


}



using defined logger
package daveutil;

import org.apache.log4j.Logger;

public class TestDave {

static Logger logger = Logger.getLogger(TestDave.class.getName());

public String hello(String name) {

System.out.println("TestDave: START ");
logger.info("TestDave: START ");

System.out.println("Hello from TestDave to " + name);
logger.info("Hello from TestDave to " + name);

System.out.println("Using fast-swap");
logger.info("Using fast-swap");

return name;
}

}


created logs
[dave@dave base_domain]$ ls -lt
total 84
-rw-r-----. 1 dave vesedan 1112 Dec 25 15:37 dave.log
-rw-r-----. 1 dave vesedan 4888 Dec 25 15:37 daveutil.log
-rw-r-----. 1 dave vesedan 10830 Dec 25 15:37 dave.log.1



dave.log
[dave@dave base_domain]$ more dave.log
INFO [ACTIVE] ExecuteThread: '19' for queue: 'weblogic.kernel.Default (self-tuning)' dave.TestSesssionEJB - timeFromBegin2 timeToLive180000
0



daveutil.log
[dave@dave base_domain]$ more daveutil.log 
INFO [ACTIVE] ExecuteThread: '20' for queue: 'weblogic.kernel.Default (self-tuning)' daveutil.TestDave - TestDave: START
INFO [ACTIVE] ExecuteThread: '20' for queue: 'weblogic.kernel.Default (self-tuning)' daveutil.TestDave - Hello from TestDave to dave
INFO [ACTIVE] ExecuteThread: '20' for queue: 'weblogic.kernel.Default (self-tuning)' daveutil.TestDave - Using fast-swap
INFO [ACTIVE] ExecuteThread: '20' for queue: 'weblogic.kernel.Default (self-tuning)' daveutil.TestDave - TestDave: START
INFO [ACTIVE] ExecuteThread: '20' for queue: 'weblogic.kernel.Default (self-tuning)' daveutil.TestDave - Hello from TestDave to dave
INFO [ACTIVE] ExecuteThread: '20' for queue: 'weblogic.kernel.Default (self-tuning)' daveutil.TestDave - Using fast-swap

Friday, December 24, 2010

Using FastSwap

Using FastSwap Deployment to Minimize Redeployment

http://download.oracle.com/docs/cd/E12839_01/web.1111/e13702/deployunits.htm




Ant build script using FastSwap ant task

<project basedir="." default="deploy" name="deploy">
<property environment="env"/>

<property name="wl.home" value="/app/wlserver_10.3"/>
<property name="application.dir" value="/home/dave/workspace/wls1033/.metadata/.plugins/org.eclipse.core.resources/.projects/testEAR/beadep/base_domain/testEAR/" />

<echo message="${wl.home}/server/lib"/>

<path id="wlappc.classpath">
<fileset dir="${wl.home}/server/lib">
<include name="weblogic.jar"/>
</fileset>
</path>

<echo message="${toString:wlappc.classpath}"/>

<taskdef name="wlappc" classpathref="wlappc.classpath" classname="weblogic.ant.taskdefs.j2ee.Appc"/>
<taskdef name="wldeploy" classpathref="wlappc.classpath" classname="weblogic.ant.taskdefs.management.WLDeploy"/>
<taskdef name='fast-swap' classpathref="wlappc.classpath" classname='com.bea.wls.redef.ant.FastSwapTask'/>


<target name="deploy">
<wldeploy user="weblogic"
password="weblogic123"
verbose="true"
adminurl="t3://localhost:7001"
targets="AdminServer"
action="deploy"
source="${application.dir}"
name = "testEAR"
/>
</target>


<target name="fast-swap">
<fast-swap user="weblogic"
password="weblogic123"
adminurl="t3://localhost:7001"
server="AdminServer"
application = "testEAR"
/>
</target>

</project>





Ant build script output
Buildfile: /home/dave/workspace/wls1033/testEAR/build.xml
[echo] /app/wlserver_10.3/server/lib
[echo] /app/wlserver_10.3/server/lib/weblogic.jar
fast-swap:
[fast-swap] Performing FastSwap.
[fast-swap] adminUrl: t3://localhost:7001
[fast-swap] server: AdminServer
[fast-swap] application: testEAR
[fast-swap] module: null
[fast-swap] classes:
[fast-swap] Using JMX Connector to connect to service:jmx:t3://localhost:7001/jndi/weblogic.management.mbeanservers.runtime
[fast-swap] Processed 1 classes from 1 candidate classes.
[fast-swap] FastSwap operation completed successfully.
[fast-swap] ----------------------------------------------------
BUILD SUCCESSFUL


AdminServer log
####<Dec 24, 2010 8:33:14 AM CET> <Info> <FastSwap> <dave> <AdminServer> <[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1293175994484> <BEA-2154001> <Starting FastSwap operation on application "testEAR".> 
####<Dec 24, 2010 8:33:14 AM CET> <Info> <FastSwap> <dave> <AdminServer> <[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1293175994527> <BEA-2154002> <Finished FastSwap operation on application "testEAR" with status FINISHED.>



<!--
Redefine classes which have changed since they were last loaded.
Required parameters:
adminUrl: Connection url
user: User name
password: User password
server: Managed server name
application: Deployed application name
Optional parameters:
module: Name of the module within the application.
If not specified, all modules within the application
will be processed.
failonerror: Default=true. If true, task will fail if fast-swap failed.
Otherwise, a message will be displayed and the task will
return success.
timeout: Default=300. Timeout in seconds.
classnames: Comma separated list of classnames to process. If not
specified, all classes within specified modules (if any)
in the application will be considered.
-->

Thursday, December 23, 2010

Weblogic tool appc for EJB pre-compilation

<project basedir="." default="appc-ejb" name="appc-ejb">
<property environment="env"/>

<property name="wl.home" value="/app/wlserver_10.3"/>
<property name="application.dir" value="/home/dave/workspace/wls1033/testEJBGen/build/classes" />

<echo message="${wl.home}/server/lib"/>

<path id="wlappc.classpath">
<fileset dir="${wl.home}/server/lib">
<include name="*.jar"/>
</fileset>
</path>

<echo message="${toString:wlappc.classpath}"/>

<taskdef name="wlappc" classpathref="wlappc.classpath" classname="weblogic.ant.taskdefs.j2ee.Appc"/>

<target name="appc-ejb">
<wlappc source="${application.dir}"
keepgenerated="true"
verbose="true"
classpathref="wlappc.classpath"/>
</target>
</project>


Buildfile: /home/dave/workspace/wls1033/testEJBGen/build.xml
[echo] /app/wlserver_10.3/server/lib
[echo] /app/wlserver_10.3/server/lib/weblogic.jar
appc-ejb:
[wlappc] <Dec 23, 2010 9:28:28 PM CET> <Warning> <EJB> <BEA-010212> <The EJB 'TestSessionEJBGen(Jar: /home/dave/workspace/wls1033/testEJBGen/build/classes)' contains at least one method without an explicit transaction attribute setting. The default transaction attribute of Supports will be used for the following methods: remote[helloEJBGen(java.lang.String)] >
[wlappc] <Dec 23, 2010 9:28:31 PM CET> <Info> <J2EE> <BEA-160220> <Compilation completed successfully>
BUILD SUCCESSFUL


[dave@dave dave]$ pwd
/home/dave/workspace/wls1033/testEJBGen/build/classes/dave
[dave@dave dave]$ ls -lt
total 196
-rw-r--r--. 1 dave vesedan 3834 Dec 23 21:28 TestSessionEJBGen_pq6ajk_EOImpl_1033_WLStub.class
-rw-r--r--. 1 dave vesedan 1003 Dec 23 21:28 TestSessionEJBGen_pq6ajk_EOImplRTD.xml
-rw-r--r--. 1 dave vesedan 3387 Dec 23 21:28 TestSessionEJBGen_pq6ajk_EOImpl_WLSkel.class
-rw-r--r--. 1 dave vesedan 4957 Dec 23 21:28 TestSessionEJBGen_pq6ajk_HomeImpl_1033_WLStub.class
-rw-r--r--. 1 dave vesedan 4172 Dec 23 21:28 TestSessionEJBGen_pq6ajk_HomeImpl_WLSkel.class
-rw-r--r--. 1 dave vesedan 2635 Dec 23 21:28 TestSessionEJBGen_pq6ajk_ELOImpl.class
-rw-r--r--. 1 dave vesedan 4447 Dec 23 21:28 TestSessionEJBGen_pq6ajk_EOImpl.class
-rw-r--r--. 1 dave vesedan 3152 Dec 23 21:28 TestSessionEJBGen_pq6ajk_HomeImpl.class
-rw-r--r--. 1 dave vesedan 1087 Dec 23 21:28 TestSessionEJBGen_pq6ajk_HomeImplRTD.xml
-rw-r--r--. 1 dave vesedan 3763 Dec 23 21:28 TestSessionEJBGen_pq6ajk_Impl.class
-rw-r--r--. 1 dave vesedan 416 Dec 23 21:28 TestSessionEJBGen_pq6ajk_Intf.class
-rw-r--r--. 1 dave vesedan 2732 Dec 23 21:28 TestSessionEJBGen_pq6ajk_LocalHomeImpl.class
-rw-r--r--. 1 dave vesedan 2594 Dec 23 21:28 TestSessionEJBGen_pq6ajk_ELOImpl.java
-rw-r--r--. 1 dave vesedan 4006 Dec 23 21:28 TestSessionEJBGen_pq6ajk_EOImpl.java
-rw-r--r--. 1 dave vesedan 2999 Dec 23 21:28 TestSessionEJBGen_pq6ajk_HomeImpl.java
-rw-r--r--. 1 dave vesedan 4083 Dec 23 21:28 TestSessionEJBGen_pq6ajk_Impl.java
-rw-r--r--. 1 dave vesedan 626 Dec 23 21:28 TestSessionEJBGen_pq6ajk_Intf.java
-rw-r--r--. 1 dave vesedan 2540 Dec 23 21:28 TestSessionEJBGen_pq6ajk_LocalHomeImpl.java
-rw-r--r--. 1 dave vesedan 1447 Dec 23 20:53 TestSessionEJBGen.class
-rw-r--r--. 1 dave vesedan 162 Dec 23 20:53 TestSessionEJBGenLocal.class
-rw-r--r--. 1 dave vesedan 275 Dec 23 20:53 TestSessionEJBGenLocalHome.class
-rw-r--r--. 1 dave vesedan 275 Dec 23 20:53 TestSessionEJBGenRemote.class
-rw-r--r--. 1 dave vesedan 305 Dec 23 20:53 TestSessionEJBGenRemoteHome.class

Wednesday, December 15, 2010

Get Weblogic Transaction details - timeout, time to live

weblogic.transaction.TransactionHelper
http://download.oracle.com/docs/cd/E14571_01/apirefs.1111/e13941/weblogic/transaction/TransactionHelper.html

weblogic.transaction.Transaction - extends javax.transaction.Transaction
http://download.oracle.com/docs/cd/E14571_01/apirefs.1111/e13941/weblogic/transaction/Transaction.html


EJB 3.0 Metadata Annotations Reference
http://download.oracle.com/docs/cd/E12840_01/wls/docs103/ejb30/annotations.html#wp1438355

package dave;

import java.sql.Connection;
import weblogic.javaee.TransactionTimeoutSeconds;
import java.sql.SQLException;

import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;
import javax.transaction.SystemException;

import weblogic.transaction.Transaction;
import weblogic.transaction.TransactionHelper;

/**
* Session Bean implementation class TestSesssionEJB
*/
@Stateless(mappedName = "TestSesssionEJB")
@TransactionAttribute(TransactionAttributeType.REQUIRED)
@TransactionTimeoutSeconds(1800)
public class TestSesssionEJB implements TestSesssionEJBRemote, TestSesssionEJBLocal {

/**
* Default constructor.
*/
public TestSesssionEJB() {
}


public int testTransactionTimeout(int timeout) {

int out = 0;

TransactionHelper th = weblogic.transaction.TransactionHelper.getTransactionHelper();

weblogic.transaction.Transaction transaction = (Transaction) th.getTransaction();

System.out.println("Transaction: "+ transaction);

try {
System.out.println("Transaction status: "+ transaction.getStatus());
} catch (SystemException e) {
e.printStackTrace();
}

long timeFromBegin = transaction.getMillisSinceBegin();
long timeToLive = transaction.getTimeToLiveMillis();

System.out.println("timeFromBegin" + timeFromBegin + " timeToLive" + timeToLive);

return out;

}

}




Default 900s set in JTA
Transaction:  Name=[EJB dave.TestSesssionEJB.testTransactionTimeout(int)],Xid=BEA1-000002B089C73057A4BD(11628244),Status=Active,
numRepliesOwedMe=0,numRepliesOwedOthers=0,seconds since begin=0,seconds left=899,activeThread=Thread[[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)',5,Pooled Threads],SCInfo[base_domain+AdminServer]=(state=active),properties=({weblogic.transaction.name=[EJB dave.TestSesssionEJB.testTransactionTimeout(int)]}),OwnerTransactionManager=ServerTM[ServerCoordinatorDescriptor=(CoordinatorURL=AdminServer+localhost:7001+base_domain+t3+,
XAResources={WSATGatewayRM_AdminServer_base_domain},NonXAResources={})],
CoordinatorURL=AdminServer+localhost:7001+base_domain+t3+)
Transaction status: 0
timeFromBegin934 timeToLive899000



Changed on EJB to 1800s
Transaction:  Name=[EJB dave.TestSesssionEJB.testTransactionTimeout(int)],Xid=BEA1-000302B089C73057A4BD(11110649),Status=Active,
numRepliesOwedMe=0,numRepliesOwedOthers=0,seconds since begin=0,seconds left=1800,
activeThread=Thread[[ACTIVE] ExecuteThread: '5' for queue: 'weblogic.kernel.Default (self-tuning)',5,Pooled Threads],SCInfo[base_domain+AdminServer]=(state=active),properties=({weblogic.transaction.name=[EJB dave.TestSesssionEJB.testTransactionTimeout(int)]}),OwnerTransactionManager=ServerTM[ServerCoordinatorDescriptor=(CoordinatorURL=AdminServer+localhost:7001+base_domain+t3+, XAResources={WSATGatewayRM_AdminServer_base_domain},NonXAResources={})],
CoordinatorURL=AdminServer+localhost:7001+base_domain+t3+)
Transaction status: 0
timeFromBegin12 timeToLive1800000

Sunday, December 5, 2010

Upgrading Deployment Descriptors From Previous Releases of J2EE and WebLogic Server

XML Deployment Descriptors
http://download.oracle.com/docs/cd/E14571_01/web.1111/e13706/overview.htm#i1074199


java weblogic.DDConverter -verbose -d /tmp/ddconv/  testWeb/WebContent/
[DDConverter] inputFile /home/dave/workspace/wls1033/testWeb/WebContent
[DDConverter] outputDir /tmp/ddconv
[DDConverter] Using exploded dir /home/dave/workspace/wls1033/testWeb/WebContent
[DDConverter] Trying factory weblogic.application.ddconvert.EJBConverterFactory
[DDConverter] Called Factory weblogic.application.ddconvert.EJBConverterFactory recognized application: false
[DDConverter] Trying factory weblogic.application.ddconvert.WarConverterFactory
[DDConverter] Called Factory weblogic.application.ddconvert.WarConverterFactory recognized application: true
[DDConverter] START Converting WAR WebContent
[DDConverter] Converting WEB-INF/web.xml
[DDConverter] Converting WEB-INF/weblogic.xml
[DDConverter] END Converting WAR WebContent

Saturday, December 4, 2010

Weblogic build time compilation tool appc and wlappc ant task

http://download.oracle.com/docs/cd/E14571_01/web.1111/e13706/splitbuild.htm#i1113891

http://download.oracle.com/docs/cd/E14571_01/web.1111/e13719/appc_ejbc.htm#EJBPG1088
appc

The appc compiler generates and compiles the classes needed to deploy EJBs and JSPs to WebLogic Server. It also validates the deployment descriptors for compliance with the current specifications at both the individual module level and the application level. The application-level checks include checks between the application-level deployment descriptors and the individual modules as well as validation checks across the modules.

java weblogic.appc [options]

ant task weblogic.ant.taskdefs.j2ee.Appc
<project basedir="." default="appc" name="appc">
<property environment="env"/>

<property name="wl.home" value="/app/wlserver_10.3"/>
<property name="application.dir" value="/home/dave/workspace/wls1033/testWeb/WebContent" />

<echo message="${wl.home}/server/lib"/>

<path id="wlappc.classpath">
<fileset dir="${wl.home}/server/lib">
<include name="*.jar"/>
</fileset>
</path>

<echo message="${toString:wlappc.classpath}"/>


<taskdef name="wlappc" classpathref="wlappc.classpath" classname="weblogic.ant.taskdefs.j2ee.Appc"/>

<target name="appc">
<wlappc source="${application.dir}"
keepgenerated="true"
verbose="true"/>
</target>
</project>


Setting project property: wl.home -> /app/wlserver_10.3
Setting project property: application.dir -> /home/dave/workspace/wls1033/testWeb/WebContent
[echo] /app/wlserver_10.3/server/lib
Adding reference: wlappc.classpath
fileset: Setup scanner in dir /app/wlserver_10.3/server/lib with patternSet{ includes: [**/*.jar] excludes: [] }
[echo] /app/wlserver_10.3/server/lib/EccpressoAsn1.jar:/app/wlserver_10.3/server/lib/EccpressoCore.jar:/app/wlserver_10.3/server/lib/EccpressoJcae.jar:/app/wlserver_10.3/server/lib/api.jar:/app/wlserver_10.3/server/lib/aqapi.jar:/app/wlserver_10.3/server/lib/bea_wls_async_response.jar:/app/wlserver_10.3/server/lib/bea_wls_remote_deployer.jar:/app/wlserver_10.3/server/lib/app/wlserver_10.3/server/lib/consoleapp/consolehelp/WEB-INF/lib/beehive-netui-core.jar:/app/wlserver_10.3/server/lib/consoleapp/consolehelp/WEB-INF/lib/beehive-netui-tags.jar:/app/wlserver_10.3/server/lib/consoleapp/consolehelp/WEB-INF/lib/console.jar:/app/wlserver_10.3/server/lib/consoleapp/consolehelp/WEB-INF/lib/jh.jar:/app/wlserver_10.3/server/lib/consoleapp/consolehelp/WEB-INF/lib/l10n_taglib.jar:/app/wlserver_10.3/server/lib/consoleapp/consolehelp/WEB-INF/lib/netuix_common_web.jar:/app/wlserver_10.3/server/lib/consoleapp/consolehelp/WEB-INF/lib/netuix_servlet.jar:/app/wlserver_10.3/server/lib/consoleapp/consolehelp/WEB-INF/lib/prefs-spi.jar:/app/wlserver_10.3/server/lib/consoleapp/consolehelp/WEB-INF/lib/render_taglib.jar:/app/wlserver_10.3/server/lib/consoleapp/consolehelp/WEB-INF/lib/skeleton_taglib.jar:/app/wlserver_10.3/server/lib/consoleapp/consolehelp/WEB-INF/lib/standard.jar:/app/wlserver_10.3/server/lib/consoleapp/consolehelp/WEB-INF/lib/struts-adapter.jar:/app/wlserver_10.3/server/lib/consoleapp/consolehelp/WEB-INF/lib/struts.jar:/app/wlserver_10.3/server/lib/consoleapp/webapp/WEB-INF/lib/beehive-controls.jar:/app/wlserver_10.3/server/lib/consoleapp/webapp/WEB-INF/lib/beehive-netui-core.jar:/app/wlserver_10.3/server/lib/consoleapp/webapp/WEB-INF/lib/beehive-netui-tags.jar:/app/wlserver_10.3/server/lib/consoleapp/webapp/WEB-INF/lib/client_taglib.jar:/app/wlserver_10.3/server/lib/consoleapp/webapp/WEB-INF/lib/console-de.jar:/app/wlserver_10.3/server/lib/consoleapp/webapp/WEB-INF/lib/console-es.jar:/app/wlserver_10.3/server/lib/consoleapp/webapp/WEB-INF/lib/console-fr.jar:/app/wlserver_10.3/server/lib/consoleapp/webapp/WEB-INF/lib/console-it.jar:/app/wlserver_10.3/server/lib/consoleapp/webapp/WEB-INF/lib/console-ja.jar:/app/wlserver_10.3/server/lib/consoleapp/webapp/WEB-INF/lib/console-ko.jar:/app/wlserver_10.3/server/lib/consoleapp/webapp/WEB-INF/lib/console-page-spec.jar:/app/wlserver_10.3/server/lib/consoleapp/webapp/WEB-INF/lib/console-pt_BR.jar:/app/wlserver_10.3/server/lib/consoleapp/webapp/WEB-INF/lib/console-zh_CN.jar:/app/wlserver_10.3/server/lib/consoleapp/webapp/WEB-INF/lib/console-zh_TW.jar:/app/wlserver_10.3/server/lib/consoleapp/webapp/WEB-INF/lib/console.jar:/app/wlserver_10.3/server/lib/consoleapp/webapp/WEB-INF/lib/faces-adapter.jar:/app/wlserver_10.3/server/lib/consoleapp/webapp/WEB-INF/lib/jsf-api.jar:/app/wlserver_10.3/server/lib/consoleapp/webapp/WEB-INF/lib/jsf-impl.jar:/app/wlserver_10.3/server/lib/consoleapp/webapp/WEB-INF/lib/l10n_taglib.jar:/app/wlserver_10.3/server/lib/consoleapp/webapp/WEB-INF/lib/netui-adapter.jar:/app/wlserver_10.3/server/lib/consoleapp/webapp/WEB-INF/lib/netuix_common_web.jar:/app/wlserver_10.3/server/lib/consoleapp/webapp/WEB-INF/lib/netuix_servlet.jar:/app/wlserver_10.3/server/lib/consoleapp/webapp/WEB-INF/lib/prefs-spi.jar:/app/wlserver_10.3/server/lib/consoleapp/webapp/WEB-INF/lib/render_taglib.jar:/app/wlserver_10.3/server/lib/consoleapp/webapp/WEB-INF/lib/skeleton_taglib.jar:/app/wlserver_10.3/server/lib/consoleapp/webapp/WEB-INF/lib/standard.jar:/app/wlserver_10.3/server/lib/consoleapp/webapp/WEB-INF/lib/struts-adapter.jar:/app/wlserver_10.3/server/lib/consoleapp/webapp/WEB-INF/lib/struts.jar:/app/wlserver_10.3/server/lib/consoleapp/webapp/WEB-INF/lib/wldfclient-min.jar:/app/wlserver_10.3/server/lib/diagnostics-agent.jar:/app/wlserver_10.3/server/lib/jcom.jar:/app/wlserver_10.3/server/lib/jms-local-adp/jmsadapter.jar:/app/wlserver_10.3/server/lib/jms-notran-adp/jmsadapter.jar:/app/wlserver_10.3/server/lib/jms-notran-adp51/jmsadapter.jar:/app/wlserver_10.3/server/lib/jms-xa-adp/jmsadapter.jar:/app/wlserver_10.3/server/lib/jms51-interop.jar:/app/wlserver_10.3/server/lib/jrmp.jar:/app/wlserver_10.3/server/lib/jrmpclient.jar:/app/wlserver_10.3/server/lib/jsafeFIPS.jar:/app/wlserver_10.3/server/lib/mbeantypes/WLSSSecurityProviders.jar:/app/wlserver_10.3/server/lib/mbeantypes/cssWlSecurityProviders.jar:/app/wlserver_10.3/server/lib/mbeantypes/saml2CredentialMapper.jar:/app/wlserver_10.3/server/lib/mbeantypes/saml2IdentityAsserter.jar:/app/wlserver_10.3/server/lib/mbeantypes/systemPasswordValidatorProvider.jar:/app/wlserver_10.3/server/lib/mbeantypes/wlManagementImplSource.jar:/app/wlserver_10.3/server/lib/mbeantypes/wlManagementMBean.jar:/app/wlserver_10.3/server/lib/mbeantypes/xacmlSecurityProviders.jar:/app/wlserver_10.3/server/lib/mejb.jar:/app/wlserver_10.3/server/lib/mysql-connector-java-commercial-5.0.3-bin.jar:/app/wlserver_10.3/server/lib/ojdbc6.jar:/app/wlserver_10.3/server/lib/pcl2.jar:/app/wlserver_10.3/server/lib/schema/diagnostics-binding.jar:/app/wlserver_10.3/server/lib/schema/diagnostics-image-binding.jar:/app/wlserver_10.3/server/lib/schema/weblogic-domain-binding-compatibility.jar:/app/wlserver_10.3/server/lib/schema/weblogic-domain-binding.jar:/app/wlserver_10.3/server/lib/weblogic-L10N.jar:/app/wlserver_10.3/server/lib/weblogic-de.jar:/app/wlserver_10.3/server/lib/weblogic-es.jar:/app/wlserver_10.3/server/lib/weblogic-fr.jar:/app/wlserver_10.3/server/lib/weblogic-it.jar:/app/wlserver_10.3/server/lib/weblogic-ja.jar:/app/wlserver_10.3/server/lib/weblogic-ko.jar:/app/wlserver_10.3/server/lib/weblogic-pt_BR.jar:/app/wlserver_10.3/server/lib/weblogic-spring.jar:/app/wlserver_10.3/server/lib/weblogic-zh_CN.jar:/app/wlserver_10.3/server/lib/weblogic-zh_TW.jar:/app/wlserver_10.3/server/lib/weblogic.jar:/app/wlserver_10.3/server/lib/webserviceclient+ssl.jar:/app/wlserver_10.3/server/lib/webserviceclient.jar:/app/wlserver_10.3/server/lib/webservices.jar:/app/wlserver_10.3/server/lib/wl-j2ee-client.jar:/app/wlserver_10.3/server/lib/wlcipher.jar:/app/wlserver_10.3/server/lib/wlclient.jar:/app/wlserver_10.3/server/lib/wlcommons-logging.jar:/app/wlserver_10.3/server/lib/wlconnector.jar:/app/wlserver_10.3/server/lib/wldb2.jar:/app/wlserver_10.3/server/lib/wldeploy.jar:/app/wlserver_10.3/server/lib/wlfullclient.jar:/app/wlserver_10.3/server/lib/wlinformix.jar:/app/wlserver_10.3/server/lib/wljarbuilder.jar:/app/wlserver_10.3/server/lib/wljmsclient.jar:/app/wlserver_10.3/server/lib/wljmxclient.jar:/app/wlserver_10.3/server/lib/wllog4j.jar:/app/wlserver_10.3/server/lib/wlnmclient.jar:/app/wlserver_10.3/server/lib/wls-api.jar:/app/wlserver_10.3/server/lib/wlsafclient.jar:/app/wlserver_10.3/server/lib/wlsqlserver.jar:/app/wlserver_10.3/server/lib/wlsybase.jar:/app/wlserver_10.3/server/lib/wlthint3client.jar:/app/wlserver_10.3/server/lib/wlw-langx-ja.jar:/app/wlserver_10.3/server/lib/wlw-langx-ko.jar:/app/wlserver_10.3/server/lib/wlw-langx-zh_CN.jar:/app/wlserver_10.3/server/lib/wlw-langx-zh_TW.jar:/app/wlserver_10.3/server/lib/wlw-langx.jar:/app/wlserver_10.3/server/lib/wlw-wsee-soapfault.jar:/app/wlserver_10.3/server/lib/wsee_scj/wseejb.jar:/app/wlserver_10.3/server/lib/wseeclient.jar:/app/wlserver_10.3/server/lib/wsse.jar:/app/wlserver_10.3/server/lib/xmlx.jar:/app/wlserver_10.3/server/lib/xqrl.jar
Class weblogic.ant.taskdefs.j2ee.Appc loaded from parent loader (parentFirst)
+Datatype wlappc weblogic.ant.taskdefs.j2ee.Appc
Adding reference: eclipse.ant.targetVector
Build sequence for target(s) `appc' is [appc]
Complete build sequence is [appc, ]
appc:
[wlappc] [JspcInvoker]Checking web app for compliance.
[wlappc] [jspc] Overriding descriptor option 'keepgenerated' with value specified on command-line 'true'
[wlappc] [jspc] -webapp specified, searching . for JSPs
[wlappc] [jspc] Compiling /index.jsp
[wlappc] <Dec 5, 2010 12:08:52 PM CET> <Info> <J2EE> <BEA-160220> <Compilation completed successfully>
BUILD SUCCESSFUL




java weblogic.appc -help
Usage: java weblogic.appc [options] <ear, jar, war or rar file or directory>

where options include:
-help Print the standard usage message.
-version Print version information.
-output <file> Specifies an alternate output archive or
directory. If not set, output will be
placed in the source archive or directory.
-plan <file> Specifies an optional deployment plan.
-forceGeneration Force generation of EJB and JSP classes.
Without this flag the classes may not be
regenerated if it is determined to be
unnecessary.
-quiet Turns off output except for errors
-lineNumbers Add JSP line numbers to generated class
files to aid in debugging.
-library <file> Comma-separated list of libraries. Each
library may optionally set its name and
versions, if not already set in its
manifest, using the following syntax: <file>
[@name=<string>@libspecver=<version>
@libimplver=<version|string>]
-librarydir <dir> Registers all files in specified directory
as libraries.
-writeInferredDescriptors Write out the descriptors with inferred
information including annotations.
-manifest <file> Include manifest information from specified
manifest file.
-clientJarOutputDir <dir> Specifies a directory to put generated
client jars.
-keepgenerated Keep the generated .java files.
-verbose Compile with verbose output.
-classpath <path> Classpath to use.
-source <source> Source version.
-target <target> Target version.
-advanced Print advanced usage options.



 java weblogic.appc -verbose -keepgenerated .
[JspcInvoker]Checking web app for compliance.
[jspc] Overriding descriptor option 'keepgenerated' with value specified on command-line 'true'
[jspc] -webapp specified, searching . for JSPs
[jspc] Compiling /index.jsp
<Dec 4, 2010 4:38:03 PM CET> <Info> <J2EE> <BEA-160220> <Compilation completed successfully>


ls -lR
.:
total 24
-rw-r--r--. 1 dave vesedan 353 Dec 4 15:42 index.jsp
drwxr-xr-x. 2 dave vesedan 4096 Dec 4 15:40 META-INF
drwxr-xr-x. 4 dave vesedan 4096 Dec 4 16:22 WEB-INF

./META-INF:
total 8
-rw-r--r--. 1 dave vesedan 39 Dec 4 15:40 MANIFEST.MF

./WEB-INF:
total 32
drwxr-xr-x. 3 dave vesedan 4096 Dec 4 16:22 classes
drwxr-xr-x. 2 dave vesedan 4096 Dec 4 15:40 lib
-rw-r--r--. 1 dave vesedan 536 Dec 4 15:40 weblogic.xml
-rw-r--r--. 1 dave vesedan 701 Dec 4 15:40 web.xml

./WEB-INF/classes:
total 8
drwxr-xr-x. 2 dave vesedan 4096 Dec 4 16:22 jsp_servlet

./WEB-INF/classes/jsp_servlet:
total 20
-rw-r--r--. 1 dave vesedan 4888 Dec 4 16:22 __index.class
-rw-r--r--. 1 dave vesedan 3814 Dec 4 16:22 __index.java

./WEB-INF/lib:
total 0



Compile JSF web project
JSF library needed
<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.1/weblogic-web-app.xsd">
<wls:weblogic-version>10.3.3</wls:weblogic-version>
<wls:context-root>testJSF</wls:context-root>
<wls:library-ref>
<wls:library-name>jsf</wls:library-name>
<wls:specification-version>1.2</wls:specification-version>
<wls:exact-match>true</wls:exact-match>
</wls:library-ref>
</wls:weblogic-web-app>


Eclipse Shared libraries


JSF shared library




java weblogic.appc -verbose -keepgenerated testJSF/WebContent/
Unresolved WebApp library references defined in weblogic.xml, of module 'WebContent' [Extension-Name: jsf, Specification-Version: 1.2, exact-match: true]
[dave@dave wls1033]$ java weblogic.appc -verbose -keepgenerated -library /usr/app/wlserver_10.3/common/deployable-libraries/jsf-1.2.war testJSF/WebContent/
<Dec 5, 2010 1:45:33 PM CET> <Info> <J2EE> <BEA-160151> <Registered library Extension-Name: jsf, Specification-Version: 1.2, Implementation-Version: 1.2.9.0 (WAR).>
[JspcInvoker]Checking web app for compliance.
<Dec 5, 2010 1:45:37 PM CET> <Info> <HTTP> <BEA-101047> <[ComplianceChecker] Validating the servlet element with servlet-name named "Faces Servlet".>
<Dec 5, 2010 1:45:38 PM CET> <Info> <HTTP> <BEA-101047> <[ComplianceChecker] Checking servlet-mapping for servlet name : "Faces Servlet".>
[jspc] Overriding descriptor option 'keepgenerated' with value specified on command-line 'true'
[jspc] -webapp specified, searching . for JSPs
[jspc] Compiling /index.jsp
<Dec 5, 2010 1:45:50 PM CET> <Info> <J2EE> <BEA-160220> <Compilation completed successfully>


Use separate classpath for compilation if there are libraries in WEB-INF/lib
<project name="Appc" default="appc" basedir="./">

<target name="appc" description="Packages the WAR file">
<!-- Precompile JSP pages using appc -->
<echo message="Precompile JSP pages using appc in ${assemble.war}" />
<path id="wlappc.classpath">
<fileset dir="${env.WL_HOME}/server/lib">
<include name="weblogic.jar" />
</fileset>
</path>
<path id="compile.classpath">
<fileset dir="${assemble.war}/WEB-INF/lib">
<include name="*.jar" />
</fileset>
</path>

<echo message="${toString:wlappc.classpath}" />
<taskdef name="wlappc" classname="weblogic.ant.taskdefs.j2ee.Appc"
classpathref="wlappc.classpath" />
<wlappc verbose="true" forcegeneration="true" source="${assemble.war}"
classpathref="compile.classpath">

</wlappc>

</target>


</project>