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>

6 comments:

  1. Ecorptrainings.com provides J2EE in hyderabad with best faculties on real time projects. We give the best online trainingamong the J2EE in Hyderabad. Classroom Training in Hyderabad India

    ReplyDelete
  2. You're blog is so interesting and Fantastic, I've truly read through a single thing like this before. So nice to find someone with some original thoughts on this subject seriously. Many thanks for starting this up.
    R12 Procurement Training

    ReplyDelete
  3. this very valuable and interesting blog.
    Thanks for sharing this blog.
    oracle fusion SCM on line training

    ReplyDelete
  4. I really appreciate information shared above. It’s of great help. If someone want to learn Online (Virtual) instructor
    lead live training in Oracle Fusion Financials online Training , World Class Virtual Instructor led training on Oracle fusion Financials Training. We have industry expert trainer. We provide Training Material and Software Support. calfre has successfully conducted 100000+ trainings in Hyderabad, Ameerpet, Mumbai, Chennai, India, USA, UK, Australlia,
    Switzerland, Qatar, Saudi Arabia, Bangladesh, Bahrain and UAE etc.

    ReplyDelete
  5. Very nice post here and thanks for it .I always like and such a super contents of these post.Excellent and very cool idea and great content of different kinds of the valuable information's.
    Weblogic Training in Chennai

    ReplyDelete
  6. It is amazing and wonderful to visit your site.Thanks for sharing this information,this is useful to me...
    Android Training in Chennai
    Ios Training in Chennai

    ReplyDelete