We are in the process of upgrading from BEA Weblogic and ALSB to Oracle Weblogic and OSB 10.3.4. One of the things that are failing is our ant task for compiling jsp pages for our WAR.
This is the part of the ant build file that is failing now:
<!-- Compile the JSP files -->
<path id="workshop.classpath">
<fileset dir="${env.WL_HOME}/workshop/lib">
<include name="*.jar"/>
</fileset>
<pathelement location="${env.ORACLE_HOME}/tools/eclipse_pkgs/1.1/pkgs/eclipse/plugins/com.bea.workshop.wls.ant_1.0.20.200802230117/workshop-wls-antlib.jar"/>
</path>
<taskdef
name="jspc"
classname="com.bea.workshop.wls.antlib.tasks.JspcTask" classpathref="workshop.classpath"/>
<path id="jspc.classpath">
<path refid="java.classpath"/>
<pathelement location="${env.ORACLE_HOME}/jdk150_11/lib/tools.jar" />
<pathelement location="${env.WL_HOME}/server/lib/weblogic.jar" />
</path>
<jspc source="#{war.staging.dir}" classpathref="jspc.classpath" failonerror="true" />
It cannot resolve the jar file with JspcTask since Workshop does not exist in 10.3.4. So the question is, how should this ant script be changed to work under 10.3.4?
The taskdef with the classname below works with WLS 10.3.3
<taskdef name="jspc"
classname="weblogic.ant.taskdefs.j2ee.Jspc" classpath="{ORACLE_MIDDLEWARE_HOME}\wlserver_10.3\server\lib\weblogic.jar">
</taskdef>
Check your weblogic.jar with winzip/winrar to see if the above classname exists in 10.3.4, and it should be fine.
Update:
You're getting the NullPointer because jspc does not allow a directory in the source attribute. It should be srcdir as per the docs, in fact I dont see a source attribute at all.
The jspc task is deprecated, so I think it's better you use the weblogic.appc like below
<target name="compileapp">
<java classname="weblogic.appc" fork="yes">
<arg line="-webapp ${src.gui}" />
<arg value="-compiler javac" />
<arg line="-classpath D:\Oracle\Middleware_Jdev11_1_1_4\wlserver_10.3\server\lib\weblogic.jar" />
<arg value="-depend" />
<arg value="-nowarn" />
</java>
</target>
Choose the attributes you want from this list, I havent tried this myself yet.
Related
I'm trying to create an ant script to run pitest to be able to automate my mutation testing. I am getting the error:
Could not find or load main class org.pitest.mutationtest.commandline.MutationCoverageReport
This is my MutationTest.xml ant script
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project basedir="." default="mutationCoverage" name="PhoneBook">
<property name="ECLIPSE_HOME" value="C:/Program Files/eclipse/"/>
<path id="JUnit 4.libraryclasspath">
<pathelement location="${ECLIPSE_HOME}plugins/org.junit_4.11.0.v201303080030/junit.jar"/>
<pathelement location="${ECLIPSE_HOME}plugins/org.hamcrest.core_1.3.0.v201303031735.jar"/>
</path>
<path id="PhoneBook.classpath">
<pathelement location="bin"/>
<path refid="JUnit 4.libraryclasspath"/>
</path>
<path id="pit.path">
<pathelement location="lib/pitest-1.1.4.jar" />
<pathelement location="lib/pitest-ant-1.1.4.jar" />
</path>
<taskdef name="pitest" classname="org.pitest.ant.PitestTask" classpathref="pit.path" />
<target name="mutationCoverage">
<pitest
pitClasspath="PhoneBook.path"
classPath="PhoneBook.path"
targetClasses="pbook.*"
targetTests="pbook.*"
reportDir="MutationReports"
sourceDir="src"/>
</target>
</project>
What is causing this error, and how can I fix it?
Edit: I changed pitClasspath="PhoneBook.path" to pitClasspath="pit.path" and now I have a new error:
[pitest] Exception in thread "main" org.pitest.util.PitError: Unable to load class content for org.pitest.boot.HotSwapAgent
[pitest] Please copy and paste the information and the complete stacktrace below when reporting an issue
[pitest] VM : Java HotSpot(TM) 64-Bit Server VM
[pitest] Vendor : Oracle Corporation
[pitest] Version : 25.25-b02
[pitest] Uptime : 370
[pitest] Input ->
[pitest] BootClassPathSupported : true
[pitest] at org.pitest.mutationtest.tooling.JarCreatingJarFinder.classBytes(JarCreatingJarFinder.java:124)
[pitest] at org.pitest.mutationtest.tooling.JarCreatingJarFinder.addClass(JarCreatingJarFinder.java:113)
[pitest] at org.pitest.mutationtest.tooling.JarCreatingJarFinder.createJarFromClassPathResources(JarCreatingJarFinder.java:98)
[pitest] at org.pitest.mutationtest.tooling.JarCreatingJarFinder.createJar(JarCreatingJarFinder.java:74)
[pitest] at org.pitest.mutationtest.tooling.JarCreatingJarFinder.getJarLocation(JarCreatingJarFinder.java:63)
[pitest] at org.pitest.mutationtest.tooling.EntryPoint.execute(EntryPoint.java:70)
[pitest] at org.pitest.mutationtest.tooling.EntryPoint.execute(EntryPoint.java:43)
[pitest] at org.pitest.mutationtest.commandline.MutationCoverageReport.runReport(MutationCoverageReport.java:72)
[pitest] at org.pitest.mutationtest.commandline.MutationCoverageReport.main(MutationCoverageReport.java:43)
I don't know if that is better or worse, but hopefully it will be helpful in finding the problem.
A working example of a pitest ant build is provided at
https://github.com/hcoles/pitest-ant-example
I suggest you start with this and edit it until you have a working build for your codebase.
One difference I can see is that you have not included junit on the pitest path.
Your build looks a little strange as it seems to be tied to eclipse. If you are running from the IDE why not use the eclipse plugin?
Also, if you are not tied to Ant, you might want to consider maven as an alternative.
I believe much of your problem is that you're trying to use the Eclipse generated build.xml file, which doesn't contain the mutation testing target, and the target which you've added to remedy this has some errors.
I would suggest starting with the project here and attempting to understand how it works, and then changing their build.xml file to fit your needs.
However if this doesn't work, judging from your other question, the following build.xml should work if:
You divide your files into two source directories "src" and "test"
Both src and test folders contain the package "pbook"
You change the name of your tests to end in "Test" rather than begin in it
<?xml version="1.0" encoding="UTF-8"?>
<project name="Phonebook">
<property name="classOutputDir" value="build" />
<!-- classpath for pitest and any plugins -->
<path id="pitest.path">
<!-- must currently include the test library on the tool classpath. this will be fixed in a future version-->
<pathelement location="lib/junit-4.9.jar" />
<pathelement location="lib/pitest-0.33.jar" />
<pathelement location="lib/pitest-ant-0.33.jar" />
</path>
<taskdef name="pitest" classname="org.pitest.ant.PitestTask" classpathref="pitest.path" />
<target name="clean">
<delete dir="${classOutputDir}" />
</target>
<target name="compile" depends="clean">
<mkdir dir="${classOutputDir}/classes" />
<!-- Essential that line numbers and filenames are included in order for PIT to work -->
<javac srcdir="src" includeantruntime="false" debug="true" debuglevel="source,lines" destdir="${classOutputDir}/classes" />
</target>
<!-- classpath for compiling and testing the code. Note it does not include pitest and it's dependencies -->
<path id="test.path">
<pathelement location="${classOutputDir}/classes" />
<pathelement location="${classOutputDir}/test-classes" />
<pathelement location="lib/junit-4.9.jar" />
</path>
<target name="test" depends="compile">
<mkdir dir="${classOutputDir}/test-result" />
<mkdir dir="${classOutputDir}/test-classes" />
<javac includeantruntime="false" srcdir="test" destdir="${classOutputDir}/test-classes">
<classpath refid="test.path" />
</javac>
<junit>
<classpath refid="test.path" />
<batchtest todir="${classOutputDir}/test-result">
<!-- set test classes -->
<fileset dir="test">
<include name="**/*Test.java" />
</fileset>
<formatter type="xml" />
</batchtest>
</junit>
<junitreport todir="${classOutputDir}/test-result">
<fileset dir="${classOutputDir}/test-result">
<include name="TEST-*.xml" />
</fileset>
<report format="frames" todir="${classOutputDir}/test-result/report" />
</junitreport>
</target>
<!-- run pitest. note that the filters for tests and classes refer to package/class names, not source file named -->
<target name="pit" depends="test">
<path id="mutation.path">
<path refid="pitest.path"/>
<path refid="test.path"/>
</path>
<pitest pitClasspath="pitest.path" threads="2" classPath="mutation.path" targetTests="pbook.*" targetClasses="pbook.*" reportDir="pitReports" sourceDir="src" />
</target>
</project>
I am trying to convert a web service from using the version of ant that comes with weblogic (OFM 11G Release 1 (10.3.6)) to a newer, standalone version of ant (1.8.4). During the build with 1.8.4 I am receiving the following warnings which I would like to eliminated if possible. The warning occurs with all exception classes in the project. Can anyone provide a suggestion? I am new to weblogic web services.
[jwsc] [WARNING] skipping exception constructor for ca.bc.gov.webade.WebADEException: could not find property corresponding to ctor param 'arg0' on public WebADEException(java.lang.String,java.lang.Exception)
Here is the JWSC portion of the build file. The task is defined using the same paths as part of the build classpath below. The weblogic paths correspond to to WLS_HOME and MODULES_DIR environment variables as set by weblogic.
<target name="jwsc" depends="compile">
<path id="JWSCclasspath">
<fileset dir="${lib.dir}">
<include name="*.jar"/>
</fileset>
<fileset dir="${webade.lib.dir}" includes="*.jar" />
<!-- Reference compiled classes rather than jar file due to issue deleting the jar file at the end of the build -->
<pathelement path="${build.bus.dir}"/>
<pathelement path="{weblogic.dir}"/>
<fileset dir="${weblogic.dir}" >
<include name="*.jar" />
</fileset>
<pathelement path="${weblogic.modules}" />
<fileset dir="${weblogic.modules}" >
<include name="*.jar"/>
</fileset>
</path>
<jwsc srcdir="${src.dir}" destdir="${deploy.dir}" classpathref="JWSCclasspath">
<jws file="${war.path}/MapViewerServicesPortTypeImpl.java" type="JAXRPC">
<WLHttpTransport contextPath="mapViewer" serviceUri="MapViewerWS" portName="MapViewerServicesPort"></WLHttpTransport>
</jws>
</jwsc>
</target>
I have an ant build script that has the following targets:
<target name="_initLiveProps">
<property file="buildscripts/live.properties"/>
</target>
<target name="buildLive" depends="_initLiveProps">
<property file="buildscripts/live.properties"/>
</target>
Within the build script i have several pathelements declared as shown below:
<path id="project.class.path">
<pathelement location="./../lib/log4j-1.2.16.jar" />
<pathelement location="${product-def.jar}"/>
</path>
The product-def.jar definition is defined in the buildscripts/live.properties file as
product-def.jar=./../lib/product-def/live/product-def.jar
When i build the project (using ant buildLive) i get compilation errors and mainly because it cannot find classes defined within product-def.jar.
I tried to print out the classpath as shown below
<property name="myclasspath" refid="project.class.path"/>
<echo message="${myclasspath}" />
And the output comes out as c:\product\lib\log4j-1.2.16.jar;c:\product\${product-def.jar}
The above suggests that the following definition is not correct
<pathelement location="${product-def.jar}"/>
What is the correct way of defining a path element that is defined in a properties file?
Edit
I think the issue is that the definition for project.class.path is initialised before the properties file is loaded in the buildLive target.
Is there a way to delay the initialisation of project.class.path until after buildLive target has completed?
Is there a way to delay the initialisation of project.class.path until after buildLive target has completed?
Put the <path> definition inside the <target>
<target name="_initLiveProps">
<property file="buildscripts/live.properties"/>
<path id="project.class.path">
<pathelement location="./../lib/log4j-1.2.16.jar" />
<pathelement location="${product-def.jar}"/>
</path>
</target>
The <path> will be visible to all targets that depend (directly or indirectly) on this one.
If you have several different targets that load different properties, e.g. _initLiveProps, _initDevProps, etc. then you could put the <path> definition into a common target as follows
<target name="classpath">
<path id="project.class.path">
<pathelement location="./../lib/log4j-1.2.16.jar" />
<pathelement location="${product-def.jar}"/>
</path>
</target>
<target name="_loadLiveProps">
<property file="buildscripts/live.properties"/>
</target>
<target name="_initLiveProps" depends="_loadLiveProps, classpath" />
<target name="_loadDevProps">
<property file="buildscripts/dev.properties"/>
</target>
<target name="_initDevProps" depends="_loadDevProps, classpath" />
I'd love to ask about my issue with ant script. I have two GWT projects and one depends on the other. I'm trying to compile them with ant script, but I'm failing due to:
[java] [ERROR] Errors in 'file:/$PATH/$CLASS_NAME.java'
[java] [ERROR] Line 29: No source code is available for type $INHERITED_INTERFACE; did you forget to inherit a required module?
while $INERITED_INTERFACE is from the library the compiled project depends on and $CLASS_NAME is a class that implements the interface.
I tried it simple, but it's not working:
<target name="gwtcomp" depends="javacomp" description="GWT to JS">
<echo message="Building GWT" />
<java failonerror="true" fork="true" classname="com.google.gwt.dev.Compiler">
<classpath>
<pathelement location="${basedir}/src" />
<path refid="project.class.path" />
</classpath>
<jvmarg value="-Xmx512M" />
<arg value="-strict" />
<arg value="${project.dep.gwt.config}" />
<arg value="${project.gwt.config}" />
</java>
</target>
but it can't go pass the errors. I've also inherited the GWT library with:
<module rename-to='project'>
...
<inherits name='my.lib.common.Common'/>
</module>
Not really sure what's wrong. Common.gwt.xml is there and it points client and shared as source packages. Could anyone help with that?
I guess you have to add the location for the sources of your my.lib.common.Common library to your classpath in your ant script.
Something like this:
<classpath>
<pathelement location="${basedir}/src" />
<path refid="project.class.path" />
<pathelement location="LOCATION_TO_MY.LIB.COMMON.COMMON"/>
</classpath>
I've got the following markup:
<?xml version="1.0" ?>
<project name="SampleBuild" default="compile" basedir=".">
<property name="SvnAntDir" value="C:/Program Files/Apache/svnant-1.2.1/doc" />
<property name="src" value="_src_" />
<property name="build" value="_build_"/>
<property name="dist" value="${build}/_jars_" />
<path id= "svnant.classpath" >
<fileset dir= "${SvnAntDir}" >
<include name= "*.jar" />
</fileset>
</path>
<target name="pre-cleanup">
<delete dir="${src}" />
<delete file="${dist}/Project.jar" />
<delete includeEmptyDirs="true" failonerror="false">
<fileset dir="${build}/_classes_/sevgok/" />
</delete>
<mkdir dir="${src}" />
<tstamp />
</target>
<target name="checkout" depends="pre-cleanup">
<typedef resource="org/tigris/subversion/svnant/svnantlib.xml" classpathref="svnant.classpath" />
<svn>
<checkout url="svn://p-subversion/Project/trunk" revision="HEAD" destPath="${src}" />
</svn>
</target>
<target name="compile" depends="checkout">
<javac srcdir="${src}" destdir="${build}/_classes_" debug="on" debuglevel="lines,vars,source">
<classpath>
<pathelement path="${classpath}" />
<fileset dir="./_libs_">
<include name="*.jar" />
<include name="*.zip" />
</fileset>
</classpath>
</javac>
</target>
</project>
Problem occurs when trying to make a build. The error message is next:
checkout: [svn] <Checkout> started ...
[svn] svn: svn://p-subversion/Project/trunk` doesn't exist
[svn] svn: svn://p-subversion/Project/trunk` doesn't exist
[svn] <Checkout> failed!
Build FAILED
C:\build.minimal.xml: (line of code which points to <svn> openning tag): Can't checkout.`
Simultaneously it is possible to make a checkout with Tortoise SVN client using the url.
Help!
EDIT
I tried using -v key when building and got the following:
Caused by: org.tigris.subversion.svnclientadapter.SVNClientException: org.tigris
.subversion.javahl.ClientException: svn: URL 'svn://p-subversion/Project/trunk
' doesn't exist
EDIT
Is there any alternative to SvnAnt? It would be great if it was also well documentated.
Thanks
EDIT
So code that works for me is:
<target name="checkout" depends="pre-cleanup">
<exec dir="${basedir}" executable="svn" failonerror="true">
<arg line="checkout -r ${revision} ${SvnUrl} ${src}" />
</exec>
</target>
where ${SvnUrl} is the same URL I used before.
If svnant does not work at all you could just execute svn from the command line:
<exec executable="svn" dir="DIRECTORY_WHERE_COMMAND_EXECUTES">
<arg line="checkout svn://p-subversion/Project/trunk $src"/>
</exec>
You would have to install a svn command line client. Make sure, that you add the bin-Directory of the client to the PATH.
But take care to install the same client version as your tortoise client. If they mismatch they will make the working copy unaccessible for the other.
What is p-subversion supposed to be? SVN URLs, just like HTTP URLs, begin with a hostname. If p-subversion isn't a hostname that will point to your computer, then the checkout will fail. Perhaps it should look more like this?
svn://localhost/p-subversion/Project/trunk
[edit]If it's a Windows share...
file://p-subversion/Project/trunk
the svn:// URL assumes a hostname, but in the case of a share some other part of the OS is already negotiating the TCP connection. Refer to it like you would any other folder.