Precompiling JSPs using ant

Hi
Does anyone know a documented way to precompile a JSP using an ant script. I've tried a lot, but didn't find a satisfying solution. The best solution I've found was calling OJSPC from commandline via ants "java" task, but even this solution does not work in JDeveloper 9.0.4 anymore.
If anyone can give me a hint, I'd be really happy.
Thanks

Anybody ?

Similar Messages

  • Tomcat5 and precompiling JSPs with Ant

    Hi I'm trying to precompile my JSPs in ANT and I'm using Tomcat5. Below is my taskdef:
    <target name="jsp" depends="build">
        <!--
             The Ant JSPC task doesn't work with Tomcat 5.0
             so in the meantime we need to define our own task.
          -->
        <taskdef name="jspc50" classname="org.apache.jasper.JspC">
            <classpath id="jspc50.classpath">
                <fileset dir="${tomcat.home}">
                    <include name="*.jar"/>
                </fileset>
            </classpath>
        </taskdef>
        <jspc50 outputDir="${classes}"
                uriroot="${src}"
                package="jsp"
                validateXml="false">
            <include name="**/*.jsp" />
            <exclude name="**/includes/**/*.jsp" />
        </jspc50>
        <javac srcdir="${classes}"
               destdir="${classes}"
               debug="true"
               optimize="false"
               includes="**/*.java"
               source="1.4">
        </javac>
    </target>Now, this actually works but if I use an absolute include directive in my JSPs like:
    <%@ include file="/includes/header.jsp" %>Then I get the "/include/header.jsp" not found. However, if I change to
    <jsp:include page="/includes/header.jsp" />It works fine. Now, I want to use an absolute path and I also want to use the include directive. Has anybody seen this problem and know a solution?
    Thanks,
    Mike

    Hi All,
    Pls. help
    I have deployed my application on Sun Appln server 9.0. When I try to lauch the application it gives following error.
    [#|2007-11-06T17:31:16.451+0530|SEVERE|sun-appserver-pe9.0|javax.enterprise.system.container.web|_Th
    readID=13;_ThreadName=httpWorkerThread-8080-0;_RequestID=076de172-4f31-4f76-888d-a19cc736c3ee;|Stand
    ardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exception
    java.lang.NoClassDefFoundError: javax/servlet/jsp/tagext/TagExtraInfo
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
    at com.sun.appserv.server.util.ASURLClassLoader.loadClass(ASURLClassLoader.java:100)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at com.sun.enterprise.util.ConnectorClassLoader.loadClass(ConnectorClassLoader.java:176)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1405)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1292)
    at org.apache.jasper.compiler.TagLibraryInfoImpl.createTagInfo(TagLibraryInfoImpl.java:478)
    at org.apache.jasper.compiler.TagLibraryInfoImpl.parseTLD(TagLibraryInfoImpl.java:298)
    at org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:176)
    at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:445)
    at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:513)
    at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1579)
    at org.apache.jasper.compiler.Parser.parse(Parser.java:151)
    at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:212)
    at org.apache.jasper.compiler.ParserController.parse(ParserController.java:129)
    at org.apache.jasper.compiler.Parser.processIncludeDirective(Parser.java:360)
    at org.apache.jasper.compiler.Parser.parseIncludeDirective(Parser.java:397)
    at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:505)
    at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1579)
    at org.apache.jasper.compiler.Parser.parse(Parser.java:151)
    at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:212)
    at org.apache.jasper.compiler.ParserController.parse(ParserController.java:113)
    at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:224)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:526)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:507)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:495)
    at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:530)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:412)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:318)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.jav
    a:397)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j
    ava:303)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
    at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:39)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j
    ava:216)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
    at com.fdu.mdsgui.web.filter.LocaleFilter.doFilter(LocaleFilter.java:58)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j
    ava:216)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
    at org.securityfilter.filter.SecurityFilter.doFilter(SecurityFilter.java:188)
    at com.fdu.mdsgui.web.filter.MDSSecurityFilter.doFilter(MDSSecurityFilter.java:57)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j
    ava:216)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:276)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
    at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:24
    0)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:179)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
    at com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
    at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:239)
    at com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:6
    67)
    at com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.ja
    va:574)
    at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)
    at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)
    at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)
    at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
    at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)
    |#]

  • Precompile jsps via ant

    I have a development project that has been setup to use JDeveloper 10.1.3.5.0 to create and EAR for deployment. The EAR is comprised of three sub applications - appData, appEjb, appWeb. Each subapplication has its own resource to deploy in JDeveloper. The appWeb has an additional resource defined in JDeveloper to deploy the EAR.
    I am attempting to move the build process out of JDeveloper and into ant in order to integrate the application with an automated build management framework.
    I have been successful in creating an ant build.xml to pull the code from source control, compile the three subapplications, jar the appData, and jar the appEjb. The issue I am having is precompiling the jsp files in the appWeb.
    The JDeveloper resource for appWeb.deploy precompiles all the jsps and packages the jsp class files along with all the other appWeb content as part of the appWeb.war.
    I thought JDeveloper was utilizing an internal J2EE standalone OC4J. I created a classpath and taskdef as follows
    <path id="ojspc.classpath">
    <fileset dir="jdevstudio">
    <include name="**/*.jar"/>
    </fileset>
    <pathelement location="${env.JAVA_HOME}/lib/tools.jar" />
    <pathelement location="${outDir}/appData"/>
    <pathelement location="${outDir}/appWeb"/>
    <pathelement location="${outDir}/appEjb"/>
    </path>
    <taskdef name="ojspc" classpathref="ojspc.classpath" classname="org.apache.tools.ant.taskdefs.optional.jsp.OjspC" />
    My original attempts had a much more constrained classpath definition (using the classpath found in the manifest file within j2ee\home\ojspc.jar); however, ant is unable to find the OjspC class and thus I expanded the classpath to include all jar files.
    After reading through blogs, forums, and documentation, I am unable to figure out how to define a task within ant to precompile the jsps in my project which mirrors the work being done via the JDeveloper deploy resource. Does anyone know the actual class to use for precompiling the jsps?
    Any help is greatly apprciated,
    /dclink

    GR wrote:
              > Is there any ant task for precompiling jsp provided by weblogic 8.1.2?
              > (Ant's wljspc doesnt work with 8.1.2).
              Have you tired a regular java task that calls the class weblogic.jspc?
              A little more direct but I imagine it would work
              ~Ryan
              

  • Error in precompiling JSPs using OJSPC

    Hi,
    I am precompiling JSPs in war file using ojspc as specified below.
         ojspc -output myapp.war app.war
    However I am getting following error:
    Detected archive, now processing contents of app.war...
    Setting up temp area...
    Expanding archive in temp area...
    WARNING: IGNORED file: /WEB-INF/lib/jsf-impl.jar
    WARNING: IGNORED file: /WEB-INF/lib/jsf-ri.jar
    Parse error in AddNewAttachment.jsp:
    oracle.jsp.parse.JspParseException: /AddNewAttachment.jsp: Line # 48,
    actionListener="#{addAttachmentBackingBean.cancel}"/>
    Error: A String literal value, "#{addAttachmentBackingBean.cancel}", has been pr
    ovided for attribute actionListener which has an associated deferred method with
    void signature
    Removing temp area...
    Can anbody help me to solve this problem?
    Thanks.
    Regards,
    Umesh

    Hi,
    If I create a method via the binding editor in JDev it creates a managed bean method with a void return type as default.
    eg.
        public void cmdlink_actionListener(ActionEvent actionEvent) {
            // Add event code here...
        }could it have anything to do with the two OJSPC warnings? jsf-impl.jar should be included in your war file. I haven't seen this warning when OJSPC is compiling.
    Brenden

  • Precompiling JSPs using weblogic.jspc

    Hello,
    My question has more to do with getting the Weblogic precompiler to understand <%@ include file="myFilejsp" %> directives.
    Test scenario:
    In our application, we have used a common JSP page say 'commonJSP' as a header and have included 'commonJSP' in all our other JSP pages.
    Suppose my commonJSP is like this:
    <%
    String hello= "Hello";
    %>
    and suppose my index.jsp is like this
    <%@ include file="commonJSP" %>
    <%
    System.out.println(hello);
    %>
    Now when I serve index.jsp to clients it compiles correctly because the commonJSP is included in the source before compiling.
    HOWEVER, when precompiling the JSPs in my web application using the <java weblogic.jspc ..> tag in my ant build file, I am getting errors on compiling index.jsp that 'hello' cannot be resolved.
    When using the WebLogic JSP compiler, is there any way to tell the compiler to not treat JSP pages as individual 'servlet' classes but look at the 'big picture'?

    Anybody ?

  • Weblogic.jspc outofmemory error while compiling jsps using ant in eclipse

    Hi all,
    I am trying to execute this target in my ant build:
         <target name="jspc">
              <java classname="weblogic.jspc" fork="yes">
                   <arg line="-verbose -verboseJavac -compileAll -webapp ${project.jsp.dir} -d ${project.jsp.class.dir}" />
                   <classpath>
                        <pathelement path="${classpath}" />
                   </classpath>
         </java>
         </target>
    I am getting the following error:
    [java] Error: [jspc]: 0 file(s) failed:
    [java] [Compilation errors : ]
    [java] The system is out of resources.
    [java] Consult the following stack trace for details.
    [java] java.lang.OutOfMemoryError
    [java] at weblogic.jspc.doCompile(jspc.java:861)
    [java] at weblogic.jspc.runJspc(jspc.java:654)
    [java] at weblogic.jspc.runBodyInternal(jspc.java:412)
    [java] at weblogic.jspc.runBody(jspc.java:319)
    [java] at weblogic.utils.compiler.Tool.run(Tool.java:192)
    I am using weblogic 8.1, eclipse3.1, java1.4.1.
    Can some one please help me with this issue?
    thanks in advance.

    --> some error on posting please refer to the next post...
    From the error logs we can trace it out to the web project's Build.xml file ....I was getting a similar error and by commenting out the following lines in the web project's Build.xml I am able to run the build script correctly and get a EAR file. The lines are
    <!--
    <assemble
    moduleDir="${generated.module.root}"
    moduleName="${project.name}"
    srcOutputDir="${assembly.src}"
    appRootDir="${ear.root}">
    <assemblyContext factory="org.apache.beehive.controls.runtime.assembly.WebAppAssemblyContext$Factory" />
    <assemblyContext factory="org.apache.beehive.controls.runtime.assembly.AppAssemblyContext$Factory" />
    <classpath refid="assembly.classpath" />
    <fileset dir="${project.dir}">
    <include name="**/*.controls.properties" />
    </fileset>
    </assemble>
         -->
    Please check it now, also if any one can let us know the function or role played by the above lines it would be great. Also if there would be any future or unseen problems by commenting out these lines please do let us know...
    Thanks
    -MiM
    Edited by prodigymonish83 at 10/22/2007 5:56 AM

  • JSP precompilation and my .java files compilation issues /  building WAR file using ANT

    Hello.
    I am new to working with WAR files and the whole process of it. A little
    background on what we are using. We are using, WLS 6.1 SP3. I am using the
    ant.bat that is supplied in the bin directory of the WLS install.
    I am trying to work with ANT and getting it to build the file. I am making
    progress, but at a point where I am having trouble getting my java code
    files to compile using ant. I am having one issue and looking to do one
    other item.
    1) I would like to precompile the JSPs if possible prior to putting into the
    WAR file. Not sure if this is done or not, but there was a utility when I
    was working with ibm's app server that gave us the ability to do a batch
    complile. Was thinking that maybe a similair concept is possibly here.
    2) Having issue getting ant to compile code properly. In the compile
    section of the build.xml file for ant, I tell it where the source files are,
    and the destionation folder for the compiled class files. I then try to set
    the classpath so that it finds the .jar files that are necessary for my
    source files to complile. But, it won't find them. And not sure how come.
    I may be going about this all wrong, but dont know. Here is the compile
    section of the build.xml I am using:
    <target name="compile" depends="prepare">
    <javac srcdir="classes" destdir="${deploy.home}/WEB-INF/classes"
    classpath="$(lib.home)"
    debug="on" optimize="on" deprecation="off"/>
    </target>
    One note, I've tried many different items in the classpath line, which
    don't work. if I do *.jar it fails at complie time, invalid argument. As
    well as if I use *.* and so on. if I list the explicit file names, it still
    doesn't seem to find them.
    I was wondering if anyone could help, if you need anymore information let me
    know, I can send the entire build.xml if necessary. I may be missing
    items, seeing that this is my first try at using ANT.
    Any help is appreciated and thanks in advance. Hopefully not sounding too
    off the wall. Hopefully get some clarification and understanding.
    Thank you.
    Kevin.

    Kevin Price wrote:
    Hello.
    I am new to working with WAR files and the whole process of it. A little
    background on what we are using. We are using, WLS 6.1 SP3. I am using the
    ant.bat that is supplied in the bin directory of the WLS install.
    I am trying to work with ANT and getting it to build the file. I am making
    progress, but at a point where I am having trouble getting my java code
    files to compile using ant. I am having one issue and looking to do one
    other item.
    1) I would like to precompile the JSPs if possible prior to putting into the
    WAR file. Not sure if this is done or not, but there was a utility when I
    was working with ibm's app server that gave us the ability to do a batch
    complile. Was thinking that maybe a similair concept is possibly here.you can use weblogic.jspc
    http://e-docs.bea.com/wls/docs70/jsp/reference.html#57794
    or just set the precompile flag in weblogic.xml
    You can configure WebLogic Server to precompile your JSPs when a Web
    Application is deployed or re-deployed or when WebLogic Server starts up
    by setting the precompile parameter to true in the <jsp-descriptor>
    element of the weblogic.xml deployment descriptor.
    >
    2) Having issue getting ant to compile code properly. In the compile
    section of the build.xml file for ant, I tell it where the source files are,
    and the destionation folder for the compiled class files. I then try to set
    the classpath so that it finds the .jar files that are necessary for my
    source files to complile. But, it won't find them. And not sure how come.
    I may be going about this all wrong, but dont know. Here is the compile
    section of the build.xml I am using:
    <target name="compile" depends="prepare">
    <javac srcdir="classes" destdir="${deploy.home}/WEB-INF/classes"
    classpath="$(lib.home)"
    debug="on" optimize="on" deprecation="off"/>
    </target>
    maybe because you are not using curly braces there on lib.home??
    if you do it the way above, you would have to list all your jars
    classpath="$(lib.home)\lib1.jar:$(lib.home)\lib2.jar"
    or you can nest
    <javac srcdir="classes" destdir="${deploy.home}/WEB-INF/classes"
    debug="on" optimize="on" deprecation="off">
         <classpath>
              <fileset dir="${lib.home}" includes="*.jar" />
         </classpath>
    </javac>
    One note, I've tried many different items in the classpath line, which
    don't work. if I do *.jar it fails at complie time, invalid argument. As
    well as if I use *.* and so on. if I list the explicit file names, it still
    doesn't seem to find them.
    I was wondering if anyone could help, if you need anymore information let me
    know, I can send the entire build.xml if necessary. I may be missing
    items, seeing that this is my first try at using ANT.
    Any help is appreciated and thanks in advance. Hopefully not sounding too
    off the wall. Hopefully get some clarification and understanding.
    Thank you.
    Kevin.

  • Using precompiled JSPs on Sun ONE 6.1 SP5

    I"m using precompiled JSPs on Sun ONE 6.1 SP5. I have created a virtual server which has one web application deployed as the default web application located at <server-instance>/webapps/myapp. So in the server.xml it appears as :
    <webapp uri="/" path="<server-instnce/webapps/myapp"
    I have precompiled the JSPs using the jspc tool and created the directory containing the class files and have put them under WEB-INF/classes directory. I also generated the web.xml file with mappings for all jsps.
    My problem is that in my web.xml I have specified the <welcome-file> as index.jsp which used to reside under the <server-instance>/webapps/myapp directory. but now since i'm using precompiled versions i have physically removed that file. And now when i point my browser to the app's URL in the browser, i get the app's directory structure and only when i explicitly point my browser to https://<ip>:port/index.jsp then only the index.jsp page is invoked. I'm confused with this behavior. Do I need to change my docsroot directory to point to where the jsp class files are stored? I dont know what else can be going wrong...
    Any help appreciated :D
    Thanks

    Okkay i'll make my question easier.. if i'm using precompiled JSPs i.e. all compiled JSP files (.class files) including index.jsp is in the WEB-INF/classes directory then what is our docroot property supposed to be. Since if I give the document root as <server-instance>/webapps/myapp then it doesnt show the index.jsp that its supposed to when i point my browser to https://<host>:port. Only when I do https://<host>:port/index.jsp the index.jsp servlet is called and the index.jsp page is rendered.... I removed all the jsps physically from my apps folder but when I put only index.jsp there then it does work properly.... so any thoughts on this anyone...

  • Error while precompiling the JSP using weblogic 7.0

    Hi
    I am trying to precompile jsp file which is there in a war.Main jsp file code includes one more jsp which is there in other folder under defaultweb directory.
    While deploying the war i am getting the following error.Can any bosy help me in this regard
    <Nov 23, 2002 5:01:28 PM IST> <Error> <HTTP> <101045> <[ServletContext(id=464413
    3,name=ArkinTestWeb,context-path=/ArkinTestWeb-3)] translation of /Admin/account
    _access.jsp failed: weblogic.utils.ParsingException: nested TokenStreamException
    : antlr.TokenStreamException: Could not include ./../includes/sessionStatusPage.
    jsp>
    <Nov 23, 2002 5:01:28 PM IST> <Error> <Deployer> <149201> <The Slave Deployer fa
    iled to complete the deployment task with id 1 for the application ArkinTestWeb.
    weblogic.management.ApplicationException: Prepare failed. Task Id = 5
    Module Name: ArkinTestWeb, Error: Could not load ArkinTestWeb: weblogic.utils.Ne
    stedException: ArkinTestWeb:ArkinTestWeb Failure while Precompiling JSPs: weblog
    ic.utils.ParsingException: nested TokenStreamException: antlr.TokenStreamExcepti
    on: Could not include ./../includes/sessionStatusPage.jsp - with nested exceptio
    n:
    [weblogic.utils.ParsingException: nested TokenStreamException: antlr.TokenStream
    Exception: Could not include ./../includes/sessionStatusPage.jsp]
    at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContain
    er.java:657)
    at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContain
    er.java:548)
    at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(Sla
    veDeployer.java:1026)
    at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDep
    loyer.java:700)
    at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHan
    dler.java:24)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:152)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:133)
    >
    Regards
    Anand Mohan

    Hi
    All jsp pages are under one web application only.Can you help more on this.
    Regards
    Anand

  • Java.lang.VerifyError when using ant 1.6.2

    In short, I get the VerifyError when deploying my .ear in Weblogic 8.1 SP2. I have nailed down the issue to this:
    I compile all my code using Ant 1.6.2. If I package the code up using ant 1.6.2 I get the VerifyError. If I pacakge the code up using ant 1.4, all is well. Note that when I deploy the 1.6.2 packaged ear file on Windows, all is well also.
    During the ant package target I assembly the war and ear using the core war and ear tasks.
    We are using precompiled JSPs in the war file. It seems that WL8.1 wants to recompile the JSP file. I am not sure why - the ant 1.4 packaged ear does not want to recompile the same JSP.
    The detailed error is:
    Servlet class jsp_servlet._portal.__capitalmarketsoverview for servlet /portal/CapitalMarketsOverview.jsp could not be verified.
    java.lang.VerifyError: (class: jsp_servlet/_portal/__capitalmarketsoverview, method: _jspService signature: (Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V) Incompatible object argument for function call.>
    Any help is appreciated,
    Harry Duin

    Hello,
    I could not find an easy way to get the wls version of ant to start using the tasks you mention from ant 1.6.2.
    I tried defining the tasks using taskdef and also adding them to wls ant.jar and updating the deafult.properties file but the ant complained about unexpected elements in the build.xml file where I added the new tags (e.g import)
    If your really up against it you can try adding wls tasks to ant 1.6.2, they are listed here:
    http://e-docs.bea.com/wls/docs81/toolstable/ToolsTable.html#1009580
    Although I could not located exactly which jar they are in. Good luck.
    Cheers
    Hussein Badakhchani
    www.orbism.com

  • Precompiling JSPs Outside Weblogic Home Directory

    Using Weblogic Server 9.2. Was able to precompile JSPs in a war file with weblogic.appc at the command line with only the weblogic.jar inside the Weblogic installation directory in my classpath. I then translated this into an Ant task, and because the script may need to run on a box that does not have Weblogic installed, copied weblogic.jar to my build area and included that one in my classpath. It immediately began throwing NoClassDefFound exceptions. Discovered the "Class-Path" list of additional jars in the MANIFEST inside weblogic.jar, searched these jars and found all of the missing classes--except for the last one. The missing class is org/apache/bcelx/classfile/ClassParser, and the error I'm getting is "WARNING: unable to get an input stream for jar:file:D:\APPS\Java\jdk1.5.0_13\jre\lib\rt.jar!" followed by java.lang.NoClassDefFoundError. The error occurs in javelin.java.JavaClassFile.getParseTree() at line 178. There is a BCEL Apache project, but they have no mention of BCELX on their website. Anyone know where I can find this class, or source code for javelin.java.JavaClassFile?
    Edited by willhandley at 06/06/2008 10:25 AM

    I tried the wlappc target:
    <target name="_precompile-jsp">
         <taskdef name="wlappc" classname="weblogic.ant.taskdefs.j2ee.Appc" classpathref="class.path" />
         <echo message="Precompiling JSPs in ${appfile}"/>
              <wlappc source="${appfile}" debug="true" verbosejavac="true" verbose="true" runtimeflags="-J-ms1024m -J-mx2048m"/>
    </target>
    But I keep getting:
    [java] [wlappc] java.lang.OutOfMemoryError: Java heap space
    We've got quite a lot of jsps in our application. It seems the memory options are being ignored and it seems other people have experienced the same problem with the memory options being ignored when using wlappc and have switched to weblogic.appc.
    When I switch to weblogic.appc I don't get the out of memory issue, though of course I'm still getting the initial stack trace reported. Any other ideas?

  • Precompile JSPs before deployment

    Does anyone have a working sample of precompiled JSPs distributed inside an EAR for deployment on an Oracle 10g app server?
    I'm almost convinced it's impossible. Please prove me wrong.

    I am glad to know that ojspc is indeed getting better.
    Right, some ant file types can be helpful to provide list of files as argument to java command. Nice try!
    For a while, I was down the road of using the batch mode against the ear but that is a
    mess because it puts all the output in a "_pages" folder under the html root. I couldn't find
    a way to change that behavior.This was changed in the next release 10.1.3, where the generated classes are put into a jar inside WEB-INF/lib/. The only way to get around it in 10.1.2 is to extract the ear/war file so that you will get a hold on the generated classes. Then you can put them in WEB-INF/lib or WEB-INF/classes and re-wrap the ear/war file.
    It takes 8 minutes to compile 173 JSPs. I have an AMD 2200+ with 1GB RAM. You can use the "-verbose" option to feel how long each group of files got compiled. Does your jsp files have different encodings? Currently if a jsp file with each encoding is encountered, the java compiler used by ojspc will be recreated, which takes quite some time. Looking ahead, we are preparing to speed up the compile process by reusing the java compiler.
    I'm not sure why ojspc can't do the directory recursion by itself.I will see if directory recursion should be implemented. Other options are also considered, like a deploy time option to compile all jsp artifacts. Do you think that would be a better option?
    There also seems to be a bug in batch mode if ojspc is run from the Same directory as specified in the appRoot parameter.Can you give a bit more detail so that I can reproduce it? Thanks.
    Try it out. Overall, it wasn't a very intuitive experience. Thanks for your feedback. I believe your experience will be getting better with each release.

  • Can we precompile JSPs to avoid Weblogic Recompile JSPs

    We'll prevent Weblogic 10.3 to Recompile JSPs when deployment and running. So we precompile JSPs when build by weblogic.jspc and added staments below in weblogic.xml, but we failed, weblogic will recompile JSPs as before. Anybody can help me?
    <jsp-param>
    <param-name>precompile</param-name>
    <param-value>false</param-value>
    </jsp-param>
    <jsp-param>
    <param-name>pageCheckSeconds</param-name>
    <param-value>-1</param-value>
    </jsp-param>
    Comman in ANT build file is below:
    <java classname="weblogic.jspc" fork="yes" classpath="${esc2.classpath}">
                   <arg line="-webapp ${esc.buildwardir} -compileAll -compiler javac -d ${esc.buildwardir.classes} -k"/>
                   <arg line="-J-mx256m"/>
              </java>

    Hi,
    If the classes are still being recompiled then you are running different WLS versions - make sure you are compiling your classes using the same release & version as the one to which you are deploying
    You can have a look at the below URL for further information
    http://download-llnw.oracle.com/docs/cd/E13222_01/wls/docs81/jsp/reference.html

  • Cannot access precompiled JSP

    My application contains several JSP working correctly, but after I choose to precompile my JSP files (putting the compiled classes in classpath). The server return a 404 indicating cannot find the JSP pages.
    It seems like the
    RequestDispatcher dispatcher=request.getRequestDispatcher("xxx.jsp");
    can no longer find the JSP page anymore. What should I put there instead? Moreover, I will still use JSP for faster development and debugging purposes, can I write it so that the same code runs for both raw JSP pages and precompiled JSP?
    Any suggestion will be appreciated!

    Thanks for your info on the creation of web.xml fragment, it really helps. I am using Ant to precompile the JSP to deploy on Jetty.
    But, the webxml and webinc attribute just does not output any file as specified. However, when I tried it with the task like this:
    <java classname="org.apache.jasper.JspC" fork="true" failonerror="true">
    <arg line="-l -d ${web}/WEB-INF/work -webinc ${web}/jspc.xml -webapp ${web}"/>
    it seems to create the webinc, however, the JSPC just doesn't work as it says
    org.xml.sax.SAXException: Internal Error: File /javax/servlet/resources/web-app_2_3.dtd not found
    Now both ways seems unworkable, do you or anyone have any idea?

  • Deploying servlet on Tomcat using "ant install" not working. Please help.

    Hello. Normally I can find answers by using search, but I can't today for some reason. So please bare with me if this has been mentioned before. I will try to provide as much info as possible so that helping me isn't too much a chore. Thank you.
    I have downloaded and installed the JWSDP 1.3. and Tomcat is running. I am also using Ant 1.5.4 (previous installation - not one included with JWSDP) and modeled my build.xml file after the template provided here:
    http://jakarta.apache.org/tomcat/tomcat-5.0-doc/appdev/build.xml.txt.
    When I run ant on my respository, everything builds fine. But when I run Ant with the install target, I get the following error:
    BUILD FAILED
    file:C:/owl/build.xml:366: java.io.IOException: Server returned HTTP response co
    de: 401 for URL: http://localhost:8080/manager/deploy?path=%2Fowl&war=file%3A%2F
    %2FC%3A%5Cowl%2Fbuild
    Here is line 366 build.xml:
    localWar="file://${build.home}"/>
    ...which is included in this block for the target "install":
    <target name="install" depends="compile"
    description="Install application to servlet container">
    <deploy url="${manager.url}"
    username="${manager.username}"
    password="${manager.password}"
    path="${app.path}"
    localWar="file://${build.home}"/>
    </target>
    When I point my brower to the url located in the error verbose, I get the following:
    FAIL - Encountered exception java.lang.NullPointerException
    I am trying to get my environment set up correctly before I start spending time developing servlets, but I am getting tempted to just develop to servlets and "manually" installing/deploying them either by copying and pasting or by using the Tomcat manager. I would really like to do everything from Ant though if possible. Please help.

    I don't think this is at all correct:
    localWar="file://${build.home}"/>You've got to create a real WAR file - a JAR file with WEB-INF and all its minions inside it:
    http://access1.sun.com/techarticles/simple.WAR.html
    That's the file you need to refer to there. You can manage that with Ant too, of course.
    Here's what my Ant build.xml looks like for Web apps (there's a build-web.properties file that follows):
    build-web.xml
    <project name="Tomcat Build Tasks" default="clean" basedir=".">
        <target name="init-props">
            <tstamp>
                <format property="touch.time" pattern="MM/dd/yyyy hh:mm aa" />
            </tstamp>
            <filterset id="ant.filters">
                <filter token="DATE" value="${TODAY}" />
                <filter token="TIME" value="${TSTAMP}" />
            </filterset>
            <!-- Load in all the settings in the properties file -->
            <property file="build.properties" />
            <!-- Load in all Tomcat settings in the properties file -->
            <property file="build-web.properties" />
        </target>
        <target name="prepare" depends="init-props">
            <mkdir dir="${war.classes}"/>
            <mkdir dir="${war.lib}"/>       
            <mkdir dir="${manifest}" />
        </target>
        <target name="clean" depends="init-props" description="clean up temporary files">
            <delete file="${project}.war" />   
            <delete dir="${war.root}"/>
            <delete dir="${manifest}" />
        </target>
        <target name="set-tomcat-classpath" depends="prepare">
            <path id="tomcat.class.path">                  
                <fileset dir="${tomcat.home}/bin">
                    <patternset>
                        <include name="**/*.jar" />
                    </patternset>
                </fileset>
                <fileset dir="${tomcat.home}/shared/lib">
                    <patternset>
                        <include name="**/*.jar" />
                    </patternset>
                </fileset>
                <fileset dir="${tomcat.home}/common/lib">
                    <patternset>
                        <include name="**/*.jar" />
                    </patternset>
                </fileset>
                <fileset dir="${tomcat.home}/server/lib">
                    <patternset>
                        <include name="**/*.jar" />
                    </patternset>
                </fileset>
                <fileset dir="${ant.home}/lib">
                    <patternset>
                        <include name="**/*.jar" />
                    </patternset>
                </fileset>
            </path>              
        </target>
        <target name="create" depends="set-tomcat-classpath" description="create the war file">
            <!-- All files at root level -->       
            <!-- Temporarily put the JSPs at root until you figure this out -->
            <copy todir="${war.root}">
                <fileset dir="${src.jsp}"/>
            </copy>
    <!--
            <copy todir="${war.root}">
                <fileset dir="${src.html}" includes="*.html"/>
            </copy>
    -->
            <copy todir="${war.root}/css">
                <fileset dir="${src.css}"/>
            </copy>
            <copy todir="${war.root}/images">
                <fileset dir="${src.images}"/>
            </copy>
            <copy todir="${war.root}/js">
                <fileset dir="${src.js}"/>
            </copy>
            <!-- All files at the WEB-INF level and below -->       
            <copy todir="${war.web}">
                <fileset dir="${src.etc}" includes="web.xml"/>
            </copy>
            <!-- All files in the CLASSPATH lib -->
            <copy todir="${war.web}/lib">
                <fileset dir="${src.lib}" includes="**/*.jar" excludes="**/*-tests.jar, **/junit.jar"/>
            </copy>
            <!-- Put the dispatcher XML in WEB-INF/config -->
            <copy todir="${war.web}/config">
                <fileset dir="${src.etc}" includes="${project}-config.xml"/>
            </copy>
            <!-- Put XSL stylesheets in WEB-INF/xsl -->
            <copy todir="${war.web}/xsl">
                <fileset dir="${src.xsl}" includes="**/*.xsl"/>
            </copy>
            <!-- Put the project JAR file in WEB-INF/lib -->
            <copy todir="${war.web}/lib">
                <fileset dir="${deploy}" includes="**/${project}.jar"/>
            </copy>
            <!-- Create the manifest -->
            <buildnumber />
            <manifest file="${manifest}/manifest.mf">
                <attribute name="Implementation-Title"      value="${project}" />
                <attribute name="Built-By"                  value="${user.name}"/>
                <attribute name="Build-Date"                value="${TODAY}" />
                <attribute name="Major-Version"             value="${major}" />
                <attribute name="Minor-Version"             value="${minor}" />
                <attribute name="Build-Number"              value="${build.number}" />
            </manifest>
            <!-- Create the WAR file -->
            <jar jarfile="${project}.war"
                 manifest="${manifest}/manifest.mf">
                <fileset dir="${war.root}"/>
                <metainf dir="${src.etc}" includes="context.xml"/>
            </jar>
        </target>
        <target name="create-tomcat-admin-tasks" depends="set-tomcat-classpath">
    <!--
            <pathconvert targetos="windows" refid="tomcat.class.path" property="converted.class.path" />
            <echo message="CLASSPATH: ${converted.class.path}" />
    -->       
            <taskdef name="install"     classname="org.apache.catalina.ant.InstallTask"     classpath="tomcat.class.path"/>
            <taskdef name="remove"      classname="org.apache.catalina.ant.RemoveTask"      classpath="tomcat.class.path"/>       
            <taskdef name="reload"      classname="org.apache.catalina.ant.ReloadTask"      classpath="tomcat.class.path"/>
            <taskdef name="deploy"      classname="org.apache.catalina.ant.DeployTask"      classpath="tomcat.class.path"/>       
            <taskdef name="undeploy"    classname="org.apache.catalina.ant.UndeployTask"    classpath="tomcat.class.path"/>       
            <taskdef name="start"       classname="org.apache.catalina.ant.StartTask"       classpath="tomcat.class.path"/>       
            <taskdef name="stop"        classname="org.apache.catalina.ant.StopTask"        classpath="tomcat.class.path"/>       
            <taskdef name="list"        classname="org.apache.catalina.ant.ListTask"        classpath="tomcat.class.path"/>       
            <taskdef name="resources"   classname="org.apache.catalina.ant.ResourcesTask"   classpath="tomcat.class.path"/>       
            <taskdef name="roles"       classname="org.apache.catalina.ant.RolesTask"       classpath="tomcat.class.path"/>
        </target>
        <target name="install" depends="create-tomcat-admin-tasks" description="install the war file on Tomcat">
            <install    url="${tomcat.manager.url}"
                        username="${tomcat.username}"
                        password="${tomcat.password}"
                        path="/${project}"
                        config="file:/${basedir}/${src.etc}/context.xml"
                        war="file:/${basedir}/${project}.war" />
        </target>
        <target name="remove" depends="create-tomcat-admin-tasks" description="remove the war file on Tomcat">
            <remove     url="${tomcat.manager.url}"
                        username="${tomcat.username}"
                        password="${tomcat.password}"
                        path="/${project}" />
        </target>
        <target name="reload" depends="create-tomcat-admin-tasks" description="reload the war file on Tomcat">
            <reload     url="${tomcat.manager.url}"
                        username="${tomcat.username}"
                        password="${tomcat.password}"
                        path="/${project}" />
        </target>
        <target name="deploy" depends="create-tomcat-admin-tasks" description="deploy the war file on Tomcat">
            <deploy    url="${tomcat.manager.url}"
                        username="${tomcat.username}"
                        password="${tomcat.password}"
                        path="/${project}"
                        config="file:/${basedir}/${src.etc}/context.xml"
                        war="file:/${basedir}/${project}.war" />
        </target>
        <target name="undeploy" depends="create-tomcat-admin-tasks" description="undeploy the war file on Tomcat">
            <undeploy   url="${tomcat.manager.url}"
                        username="${tomcat.username}"
                        password="${tomcat.password}"
                        path="/${project}" />
        </target>
        <target name="start" depends="create-tomcat-admin-tasks" description="start an application on Tomcat">
            <start      url="${tomcat.manager.url}"
                        username="${tomcat.username}"
                        password="${tomcat.password}"
                        path="/${project}"/>
        </target>
        <target name="stop" depends="create-tomcat-admin-tasks" description="stop an application on Tomcat">
            <stop       url="${tomcat.manager.url}"
                        username="${tomcat.username}"
                        password="${tomcat.password}"
                        path="/${project}" />
        </target>
        <target name="list" depends="create-tomcat-admin-tasks" description="list all applications running on Tomcat">
            <list       url="${tomcat.manager.url}"
                        username="${tomcat.username}"
                        password="${tomcat.password}"/>
        </target>
        <target name="resources" depends="create-tomcat-admin-tasks" description="list all resources on Tomcat">
            <resources  url="${tomcat.manager.url}"
                        username="${tomcat.username}"
                        password="${tomcat.password}"/>
        </target>
        <target name="data-sources" depends="create-tomcat-admin-tasks" description="list all data sources on Tomcat">
            <resources  url="${tomcat.manager.url}"
                        username="${tomcat.username}"
                        password="${tomcat.password}"
                        type="javax.sql.DataSource"/>
        </target>
        <target name="roles" depends="create-tomcat-admin-tasks" description="list all user roles on Tomcat">
            <roles      url="${tomcat.manager.url}"
                        username="${tomcat.username}"
                        password="${tomcat.password}"/>
        </target>
    </project>
    build.properties
    # Properties file for setting up an Ant build.xml
    # Project specific items that change each time
    project=api-prototype
    major=1
    minor=0
    version=${major}.${minor}
    jar.name=${project}
    versiondate=${TODAY}
    # Directory structure (these should never change)
    bin=bin
    deploy=deploy
    doc=doc
    manifest=META-INF
    xml=xml
    # Everything under src should come out of a repository
    src=src
    src.bin=${src}/bin
    src.config=${src}/config
    src.data=${src}/data
    src.dtd=${src}/dtd
    src.java=${src}/java
    src.lib=${src}/lib
    src.profile=${src}/profile
    src.properties=${src}/properties
    src.schema=${src}/schema
    src.sql=${src}/sql
    src.templates=${src}/templates
    src.testdata=${src}/testdata
    src.xml=${src}/xml
    src.xsl=${src}/xsl
    # These are created and deleted by Ant each time
    javadocs=javadocs
    reports=reports
    output=output
    output.classes=${output}/classes
    output.lib=${output}/lib
    # Required for proper use of XDoclet
    xdoclet.home = C:/Tools/xdoclet-1.2b3
    build-web.properties
    war.root=war-root
    war.pages=${war.root}/pages
    war.web=${war.root}/WEB-INF
    war.classes=${war.web}/classes
    war.css=${war.web}/css
    war.js=${war.web}/js
    war.lib=${war.web}/lib
    war.tld=${war.web}/tld
    # Properties needed by Tomcat tasks
    ant.home =
    tomcat.home         =
    tomcat.manager.url  = http://localhost:8080/manager
    tomcat.username     =
    tomcat.password     = MOD

Maybe you are looking for

  • Phantom image in PDF file

    I am working with Adobe Acrobat 9 Pro and MS Office 2007; my PC runs under Windows XP. I am experimenting with the MS Word "book fold" option and, so far, I got great results. Because this document must be printed overseas, I created it in A4 paper,

  • Purchase order of a service with account assignment to fixed asset

    We entry a service PO with asset accounting. When we select  PO in Ml81n, does not working. Anybody nows if there is something to configure to use in that way.? Thanks

  • Organization structure for real-estate project

    Hi I am required to work in a real-estate company project.  I am confused about the organization structure which should be created for the company. The company undertakes various projects like housing, shopping complexes, malls, wind-mills, etc.  and

  • Smart Playlist plays in what order?

    A couple of years ago I made a Smart Playlist that collects everything of the gendre "podcast." This lets me listed to the podcasts continuously, instead of stopping after each one. I realize that I have no idea what order it's playing the podcasts i

  • Premature end of script headers

    I am at my wits end with this Just as I think I have solved the problem then a new one props up. #$%^^ I am running apache 1.3.20 on NT4 sp5 Also running is 3 Tomcat's Mine seems to be the one crashing all the time causing memory violation errors. I