I develop an application on MobileFirst V7. It calls HTTP adapter and returns data. It can run in preview on my Eclipse. I deploy it to MobileFirst server (using WAS Liberty Profile) and run it in preview, When I call adapter it raises an error that its log in messages.log is:
[4/28/15 23:34:16:681 EDT] 00000213 org.apache.wink.server.internal.RequestProcessor
I got the following error that occurred during the invocation of the handlers chain:
WebApplicationException (404 - Not Found) with message 'null' while processing POST request sent to http://127.0.0.1:9080/TestApp/authorization/v1/clients/preview
This is my server.xml
<server description="new server">
<featureManager>
<feature>jsp-2.2</feature>
<feature>ssl-1.0</feature>
<feature>servlet-3.0</feature>
<feature>jdbc-4.0</feature>
<feature>appSecurity-1.0</feature>
<feature>jndi-1.0</feature>
<feature>ssl-1.0</feature>
<feature>servlet-3.0</feature>
<feature>jdbc-4.0</feature>
<feature>jndi-1.0</feature>
<feature>restConnector-1.0</feature>
<feature>appSecurity-1.0</feature>
<feature>ssl-1.0</feature>
<feature>servlet-3.0</feature>
<feature>jdbc-4.0</feature>
<feature>jndi-1.0</feature>
</featureManager>
<httpEndpoint id="defaultHttpEndpoint"
host="*"
httpPort="9080"
httpsPort="9443" >
<tcpOptions soReuseAddr="true"/>
</httpEndpoint>
<basicRegistry>
<user name="WorklightRESTUser" password="Bc7CGrb9DCuF"/>
<user name="admin" password="admin"/>
<user name="demo" password="demo"/>
<user name="appcenteradmin" password="admin"/>
<group name="appcentergroup">
<member name="demo"/>
<member name="appcenteradmin"/>
</group>
</basicRegistry>
<application id="appcenterconsole" name="appcenterconsole" location="appcenterconsole.war" type="war">
<application-bnd>
<security-role name="appcenteradmin">
<group name="appcentergroup"/>
</security-role>
</application-bnd>
</application>
<application id="applicationcenter" name="applicationcenter" location="applicationcenter.war" type="war">
<application-bnd>
<security-role name="appcenteradmin">
<group name="appcentergroup"/>
</security-role>
</application-bnd>
<classloader delegation="parentLast">
<commonLibrary>
<fileset dir="${wlp.install.dir}/lib" includes="com.ibm.ws.crypto.passwordutil_1.0.1.jar"/>
</commonLibrary>
</classloader>
</application>
<jndiEntry jndiName="android.aapt.dir" value='"/opt/IBM/MobileFirst_Platform_Server/ApplicationCenter/tools/android-sdk"'/>
<library id="DB2Lib">
<fileset dir="${shared.resource.dir}/db2" includes="*.jar"/>
</library>
<dataSource jndiName="jdbc/AppCenterDS" transactional="false">
<jdbcDriver libraryRef="DB2Lib"/>
<properties.db2.jcc databaseName="APPCNTR" serverName="127.0.0.1" portNumber="50001" user="db2inst1" password="{xor}Lz4sLChvLTs="/>
</dataSource>
<keyStore id="defaultKeyStore" password="worklight"/>
<administrator-role>
<user>WorklightRESTUser</user>
</administrator-role>
<jndiEntry jndiName="ibm.worklight.admin.jmx.host" value="localhost"/>
<jndiEntry jndiName="ibm.worklight.admin.jmx.port" value="9443"/>
<jndiEntry jndiName="ibm.worklight.admin.jmx.user" value="WorklightRESTUser"/>
<jndiEntry jndiName="ibm.worklight.admin.jmx.pwd" value="Bc7CGrb9DCuF"/>
<jndiEntry jndiName="ibm.worklight.topology.platform" value="Liberty"/>
<jndiEntry jndiName="ibm.worklight.topology.clustermode" value="Standalone"/>
<webContainer invokeFlushAfterService="false" deferServletLoad="false"/>
<executor id="default" name="LargeThreadPool"
coreThreads="200" maxThreads="400" keepAlive="60s"
stealPolicy="STRICT" rejectedWorkPolicy="CALLER_RUNS"/>
<application id="worklightadmin" name="worklightadmin" location="worklightadmin.war" type="war">
<application-bnd>
<security-role name="worklightadmin">
<user name="admin"/>
</security-role>
<security-role name="worklightdeployer">
</security-role>
<security-role name="worklightmonitor">
</security-role>
<security-role name="worklightoperator">
</security-role>
</application-bnd>
<classloader delegation="parentLast">
<commonLibrary id="worklightlib_worklightadmin">
<fileset dir="${wlp.install.dir}/lib" includes="com.ibm.ws.crypto.passwordutil_1.0.1.jar"/>
</commonLibrary>
</classloader>
</application>
<library id="worklightadmin/DB2Lib">
<fileset dir="${shared.resource.dir}/worklightadmin/db2" includes="db2jcc4.jar,db2jcc_license_cu.jar"/>
</library>
<dataSource jndiName="worklightadmin/jdbc/WorklightAdminDS" transactional="false">
<jdbcDriver libraryRef="worklightadmin/DB2Lib"/>
<properties.db2.jcc databaseName="WLADMIN" serverName="127.0.0.1" portNumber="50001" user="db2inst1" password="{xor}Lz4sLChvLTs=" currentSchema="WLADMSC"/>
</dataSource>
<application id="worklightconsole" name="worklightconsole" location="worklightconsole.war" type="war">
<application-bnd>
<security-role name="worklightadmin">
<user name="admin"/>
</security-role>
<security-role name="worklightdeployer">
</security-role>
<security-role name="worklightmonitor">
</security-role>
<security-role name="worklightoperator">
</security-role>
</application-bnd>
</application>
<jndiEntry jndiName="worklightconsole/ibm.worklight.admin.endpoint" value='"*://*:*/worklightadmin"'/>
<application id="TestApp" name="TestApp" location="TestApp.war" type="war">
<classloader delegation="parentLast">
<privateLibrary id="worklightlib_TestApp">
<fileset dir="${shared.resource.dir}/TestApp/lib" includes="worklight-jee-library.jar"/>
<fileset dir="${wlp.install.dir}/lib" includes="com.ibm.ws.crypto.passwordutil_1.0.1.jar"/>
</privateLibrary>
</classloader>
</application>
<jndiEntry jndiName="TestApp/publicWorkLightProtocol" value='"http"'/>
<jndiEntry jndiName="TestApp/publicWorkLightPort" value='"9080"'/>
<library id="TestApp/DB2Lib">
<fileset dir="${shared.resource.dir}/TestApp/db2" includes="*.jar"/>
</library>
<dataSource jndiName="TestApp/jdbc/WorklightDS" transactional="false">
<jdbcDriver libraryRef="TestApp/DB2Lib"/>
<properties.db2.jcc databaseName="WRKLGHT" serverName="127.0.0.1" portNumber="50001" user="db2inst1" password="{xor}Lz4sLChvLTs=" currentSchema="WRKSCHM"/>
</dataSource>
<dataSource jndiName="TestApp/jdbc/WorklightReportsDS" transactional="false">
<jdbcDriver libraryRef="TestApp/DB2Lib"/>
<properties.db2.jcc databaseName="WLREPORT" serverName="127.0.0.1" portNumber="50001" user="db2inst1" password="{xor}Lz4sLChvLTs=" currentSchema="WLRESCHM"/>
</dataSource>
</server>
Preview is not meant to work in a production environment, however the preview button was still there in the GM release of MFPF 7.0.
I think you might have hit APAR PI37266:
MFP OPERATIONS CONSOLE: PREVIEW OF COMMON RESOURCES BUTTON MUST BE
HIDDEN IN PRODUCTION ENVIRONMENT.
So, you should update your installation to the latest available 7.0 iFix, where the preview button is no longer available. To get the latest iFix, you need to login to the IBM Fix Central website and search for "mobilefirst platform" to get the latest.
If you still see the preview button after upgrading to the latest iFix, try to force-clear your browser's cache. You can also verify this by inspecting the Network view > Preview tab in Chrome's DevTools. it should show a list of properties for the request/response, one of them being "developmentMode:true/false"). It should be set to false.
Related
Please help, errors occur when I run build with ant, and I'm new to apache ant.
My project composes of two modules, this build.xml is my main project build file, and dependency module is set within the path label.
My build.xml:
<?xml version="1.0" encoding="utf-8"?>
<project name="GameServer" basedir=".">
<property name="build.dir" value="bin" />
<property name="lib.dir" value="lib" />
<property name="dist.dir" value="dist" />
<property name="source.dir" value="src" />
<property name="web.dir" value="WebContent" />
<property name="TODAY" value="2019-09-10"/>
<path id="classpath">
<fileset dir="${lib.dir}">
<include name="**/*.jar" />
</fileset>
<path location="D:\backend\worldAndBattle\trunk\worldAndBattle" />
</path>
<!-- 初始化 -->
<target name="init" description="Prepare for build">
<mkdir dir="${dist.dir}" />
<mkdir dir="${build.dir}" />
</target>
<!-- 清理 -->
<target name="clean" description="Clean all build products">
<delete dir="${dist.dir}" quiet="true"/>
<delete dir="${build.dir}" quiet="true"/>
</target>
<!-- 编译代码 -->
<target name="compile" description="Compile application" depends="clean, init">
<javac srcdir="${source.dir}"
destdir="${build.dir}"
includes="**/*.java"
debug="on"
deprecation="on"
source="1.7"
includeAntRuntime="false">
<classpath refid="classpath" />
</javac>
</target>
<!-- 打包sql -->
<target name="sql">
<jar destfile="${build.dir}/sql.jar">
<fileset dir="${source.dir}"
includes="**/sql.xml,
**/*.properties"
/>
<manifest>
<attribute name="Author" value="${user.name}" />
<attribute name="Implementation-Date" value="${TODAY}" />
</manifest>
</jar>
</target>
<!-- 打包game -->
<target name="game" depends="compile, sql" >
<jar destfile="${dist.dir}/game.jar">
<fileset dir="${build.dir}"
includes="**/*"
excludes="com/bianfeng/game/hotswap/*,
**/*Test.class,
**/Foo.class,
**/applicationContext.xml, **/*.js, log4j.properties, logback.xml, conf.xml,
**/sql.xml"
/>
<fileset dir="${source.dir}"
includes="**/*.properties"
/>
<manifest>
<attribute name="Author" value="${user.name}" />
<attribute name="Implementation-Date" value="${TODAY}" />
<attribute name="Main-Class" value="com.bianfeng.game.Main" />
</manifest>
</jar>
</target>
<!-- 打包game -->
<target name="game-with-application" depends="compile, sql" >
<jar destfile="${dist.dir}/game.jar">
<fileset dir="${build.dir}"
includes="**/*"
excludes="com/bianfeng/game/hotswap/*,
**/*Test.class,
**/Foo.class,
**/*.js, log4j.properties, logback.xml, conf.xml,
**/sql.xml"
/>
<manifest>
<attribute name="Author" value="${user.name}" />
<attribute name="Implementation-Date" value="${TODAY}" />
</manifest>
</jar>
</target>
<target name="game-cross" depends="compile, sql" >
<jar destfile="${dist.dir}/game-cross.jar">
<fileset dir="${build.dir}"
includes="**/*"
excludes="**/*Test.class,
**/Foo.class,
**/*.js, log4j.properties, logback.xml, conf.xml,
**/sql.xml,
**/*Action.class,
**/*Dao.class
"
/>
<manifest>
<attribute name="Author" value="${user.name}" />
<attribute name="Implementation-Date" value="${TODAY}" />
</manifest>
</jar>
</target>
</project>
and, I am attaching an image with my errors.
When I run compile, I get errors. And I don't know what should I do?
I am trying to test SOA through Ant Scripts in Jenkins. I am able to run the test of ant script in my PC but when I try to create the same in Jenkins job it fails.
The same command runs fine when I directly run in PC with Ant scripts.
Ant command for deploy works well but the ant test is giving me challenge.
Command below
ant -f ant-sca-test.xml -Dscatest.input=TestSOAAdd -Djndi.properties.input=D:/12c_Ant/ant_soa/jndi.properties
Below is the error message.
No changes for http://code.sunpowercorp.com/middleware-repo/fmw_12c/code/trunk/TestSOAAdd since the previous build
[ant_soa] $ cmd.exe /C "D:\Jdev1221\Middleware\Oracle_Home\oracle_common\modules\org.apache.ant_1.9.2\bin\ant.bat -file ant-sca-test.xml -DCompositeName=TestSOAAdd -DSVNCodePath=TestSOAAdd -Dtargetenv=proj ant-sca-test.xml -Dscatest.input=TestSOAAdd -Djndi.properties.input=D:\12c_Ant\ant_soa\jndi.properties && exit %%ERRORLEVEL%%"
Buildfile: D:\12c_Ant\ant_soa\ant-sca-test.xml
[echo] Running scatest using oracle.home = D:\Jdev1221\Middleware\Oracle_Home
BUILD FAILED
Target "ant-sca-test.xml" does not exist in the project "ant-scactest".
Ant Test file below:
<?xml version="1.0" encoding="iso-8859-1" ?>
<project name="ant-scactest" default="test">
<!-- must have these properties available
-->
<!-- oracle.home -->
<condition property="oracle.home" value="D:\Oracle\Middleware\Oracle_Home">
<not><isset property="oracle.home"/></not>
</condition>
<fail message="oracle.home is not available. Please provide this property.">
<condition>
<not>
<isset property="oracle.home"/>
</not>
</condition>
</fail>
<import file="ant-soa-common.xml"/>
<property environment="env"/>
<fail message="JAVA_HOME is not available. Please provide this property.">
<condition>
<and>
<not>
<isset property="env.JAVA_HOME"/>
</not>
<not>
<isset property="java.passed.home"/>
</not>
</and>
</condition>
</fail>
<condition property="java.passed.home" value="${env.JAVA_HOME}">
<isset property="env.JAVA_HOME"/>
</condition>
<condition property="scatest.format" value="native">
<not>
<isset property="scatest.format"/>
</not>
</condition>
<condition property="scatest.result" value="${java.io.tmpdir}/out">
<not>
<isset property="scatest.result"/>
</not>
</condition>
<condition property="scatest.timeout" value="300">
<not>
<isset property="scatest.timeout"/>
</not>
</condition>
<property name="scatest.partition" value="default"/>
<!-- if wl_home is not provided use the default -->
<condition property="wl_home" value="${mw.home}/wlserver">
<not>
<isset property="wl_home"/>
</not>
</condition>
<!-- jars needed to run scatest ant task -->
<path id="scatest.tasks.class.path">
<fileset dir="${mw.home}/soa/soa/modules/oracle.soa.fabric_11.1.1">
<include name="fabric-runtime.jar"/>
<include name="fabric-ext.jar"/> <include name="oracle-soa-client-api.jar"/>
</fileset>
<fileset dir="${oracle.soa.mgmt.home}/soa/modules/oracle.soa.mgmt_11.1.1">
<include name="soa-infra-mgmt.jar"/>
</fileset>
<fileset dir="${mw.home}/soa/soa/modules/oracle.soa.bpel_11.1.1">
<include name="orabpel.jar"/>
<include name="orabpel-common.jar"/>
</fileset>
<pathelement location="${wl_home}/server/lib/weblogic.jar" />
<pathelement location="${wl_home}/server/lib/wlclient.jar" />
<fileset dir="${common.components.home}/modules">
<include name="oracle.jps/jps-api.jar"/>
<include name="oracle.jps/jps-internal.jar"/>
<include name="oracle.jps/jps-common.jar"/>
<include name="oracle.jrf/jrf-api.jar"/>
</fileset>
<!-- was specific files -->
<pathelement location="${oracle.soa.mgmt.home}/soa/modules/oracle.soa.mgmt_11.1.1/soa-client-stubs-was.jar"/>
<pathelement location="${was.home}/runtimes/com.ibm.ws.ejb.thinclient_8.0.0.jar"/>
<pathelement location="${was.home}/runtimes/com.ibm.ws.orb_8.0.0.jar"/>
<pathelement location="${was.home}/plugins/com.ibm.ws.runtime.jar"/>
<pathelement location="${was.home}/runtimes/com.ibm.ws.admin.client_8.0.0.jar"/>
<!--
<pathelement location="${was.home}/runtimes/com.ibm.ws.webservices.thinclient_8.0.0.jar"/>
-->
<!-- end was specific files -->
</path>
<property name="scatest.tasks.class.path" refid="scatest.tasks.class.path"/>
<echo message="Running scatest using oracle.home = ${oracle.home} "></echo>
<taskdef name="scatest"
classname="oracle.integration.platform.testfwk.ant.ScaTestTask">
<classpath>
<pathelement path="${scatest.tasks.class.path}"/>
</classpath>
</taskdef>
<target name="test" description="Run a composite test">
<echo message="Classpth = ${scatest.tasks.class.path}"/>
<echo message="Running scatest using oracle.home = ${oracle.home} ${scatest.input}"></echo>
<echo message="Using context = build.properties"></echo>
<echo message="Using path = ${scatest.tasks.class.path}"></echo>
<input message="Please enter composite name to test:"
addproperty="scatest.input"/>
<input message="Please enter the path to the jndi properties:"
addproperty="jndi.properties.input"/>
<scatest compositedn="${scatest.partition}/${scatest.input}" timeout="${scatest.timeout}"
xsl="${scatest.format}" runname="antRun-TestFwk"
resultsdir="${scatest.result}"
context="${jndi.properties.input}">
<!-- provide , separated list of suite names, defaults to all suites
<suite name="${scatestsuite.input}"/>
-->
</scatest>
</target>
<target name="report" description="Generate junit report for a composite test" >
<echo message="Generate report to ${scatest.result}"/>
<junitreport todir="${scatest.result}/xml">
<fileset dir="${scatest.result}">
<include name="BPEL-*.xml" />
</fileset>
<report format="frames" todir="${scatest.result}/html" />
</junitreport>
</target>
</project>
What am I doing wrong here?
Edit: I have changed the command to 'test' instead of and-sca-test.xml and it worked
test -Dscatest.input=TestSOAAdd -Djndi.properties.input=D:/12c_Ant/ant_soa/jndi.properties
I am facing issue with invoking the junit to generate a report.
Whatever input I give for "Test report XMLs" it fails with no matches error.
I have already installed & configured following items :
Installed IBM WebSphere Application Server Liberty Core (Version 8.5.5)
Installed IBM MobileFirst Platform Server (Verison 7.1)
While uploading wlapp file to mobilefirst console, If it takes longer than 60 seconds, then it throws an error :
Connection failure. Check server log for details.
Here is my server.xml :
<server description="new server">
<featureManager>
<feature>jsp-2.2</feature>
<feature>jndi-1.0</feature>
<feature>jdbc-4.0</feature>
<feature>servlet-3.0</feature>
<feature>ssl-1.0</feature>
<feature>localConnector-1.0</feature>
<feature>restConnector-1.0</feature>
<feature>appSecurity-1.0</feature>
</featureManager>
<httpSession cloneId="server1" />
<httpEndpoint id="defaultHttpEndpoint"
host="*"
httpPort="9080"
httpsPort="9443" >
<tcpOptions inactivityTimeout="10m" soReuseAddr="true"/>
<httpOptions readTimeout="10m" writeTimeout="10m" removeServerHeader="true" />
</httpEndpoint>
<administrator-role>
<user>WorklightRESTUser</user>
</administrator-role>
<basicRegistry>
<user name="WorklightRESTUser" password="yfcXTcXUEcTV"/>
<user name="admin" password="admin"/>
</basicRegistry>
<webContainer invokeFlushAfterService="false" deferServletLoad="false"/>
<jndiEntry jndiName="ibm.worklight.admin.endpoint" value="http://IP:PORT/wladmin" />
<jndiEntry jndiName="ibm.worklight.admin.proxy.protocol" value="http" />
<jndiEntry jndiName="ibm.worklight.admin.proxy.host" value="<IP>" />
<jndiEntry jndiName="ibm.worklight.admin.proxy.port" value="<PORT>"/>
<application id="HelloWorld" name="HelloWorld" location="HelloWorld.war" type="war">
<classloader delegation="parentLast">
<privateLibrary id="worklightlib_HelloWorld">
<fileset dir="${shared.resource.dir}/HelloWorld/lib" includes="worklight-jee-library.jar"/>
<fileset dir="${wlp.install.dir}/lib" includes="com.ibm.ws.crypto.passwordutil_*.jar"/>
</privateLibrary>
</classloader>
</application>
<jndiEntry jndiName="HelloWorld/publicWorkLightProtocol" value='"http"'/>
<jndiEntry jndiName="HelloWorld/publicWorkLightPort" value='"9080"'/>
<jndiEntry jndiName="HelloWorld/reports.exportRawData" value='"false"'/>
<library id="HelloWorld/DB2Lib">
<fileset dir="${shared.resource.dir}/HelloWorld/db2" includes="db2jcc4.jar"/>
</library>
<dataSource jndiName="HelloWorld/jdbc/WorklightDS" transactional="false">
<jdbcDriver libraryRef="HelloWorld/DB2Lib"/>
<properties.db2.jcc databaseName="MF_HELLO" serverName="<IP>" portNumber="<PORT>" user="<USER>" password="<PWD>" currentSchema="WRKLGHT"/>
</dataSource>
<keyStore id="defaultKeyStore" password="worklight"/>
<jndiEntry jndiName="ibm.worklight.admin.jmx.host" value='"localhost"'/>
<jndiEntry jndiName="ibm.worklight.admin.jmx.port" value='"9443"'/>
<jndiEntry jndiName="ibm.worklight.admin.jmx.user" value='"WorklightRESTUser"'/>
<jndiEntry jndiName="ibm.worklight.admin.jmx.pwd" value='"yfcXTcXUEcTV"'/>
<jndiEntry jndiName="ibm.worklight.topology.platform" value='"Liberty"'/>
<jndiEntry jndiName="ibm.worklight.topology.clustermode" value='"Standalone"'/>
<executor id="default" name="LargeThreadPool"
coreThreads="200" maxThreads="400" keepAlive="60s"
stealPolicy="STRICT" rejectedWorkPolicy="CALLER_RUNS"/>
<application id="wladmin" name="wladmin" location="worklightadmin.war" type="war">
<application-bnd>
<security-role name="worklightadmin">
<user name="admin"/>
</security-role>
<security-role name="worklightdeployer">
</security-role>
<security-role name="worklightmonitor">
</security-role>
<security-role name="worklightoperator">
</security-role>
</application-bnd>
<classloader delegation="parentLast">
<commonLibrary id="worklightlib_wladmin">
<fileset dir="${wlp.install.dir}/lib" includes="com.ibm.ws.crypto.passwordutil_*.jar"/>
</commonLibrary>
</classloader>
</application>
<library id="wladmin/DB2Lib">
<fileset dir="${shared.resource.dir}/wladmin/db2" includes="db2jcc4.jar"/>
</library>
<dataSource jndiName="wladmin/jdbc/WorklightAdminDS" transactional="false">
<jdbcDriver libraryRef="wladmin/DB2Lib"/>
<properties.db2.jcc databaseName="WRKLGHT" serverName="IP" portNumber="PORT" user="USER" password="PWD" currentSchema="WLADMIN"/>
</dataSource>
<application id="worklightconsole" name="worklightconsole" location="worklightconsole.war" type="war">
<application-bnd>
<security-role name="worklightadmin">
<user name="admin"/>
</security-role>
<security-role name="worklightdeployer">
</security-role>
<security-role name="worklightmonitor">
</security-role>
<security-role name="worklightoperator">
</security-role>
</application-bnd>
<classloader delegation="parentLast"/>
</application>
<jndiEntry jndiName="worklightconsole/ibm.worklight.admin.endpoint" value='"*://*:*/wladmin"'/>
</server>
In messages.log of server, I am getting this error :
com.ibm.worklight.management.ui.servlet.ServiceProxy
Throwable Connection closed: Read failed. Possible end of stream
encountered. while redirecting request to
http://localhost:9080/wladmin/management-apis/1.0/runtimes/HelloWorld/applications?async=true
Any help would be highly appreciated.
Fixes published later than 2016-03-23 should fix the problem.
http://www-01.ibm.com/support/docview.wss?uid=swg1PI59605
Your Liberty Profile version is 8.5.5.0. This version is not supported. Minimal version is 8.5.5.3 (see http://www-969.ibm.com/software/reports/compatibility/clarity-reports/report/html/prereqsForProduct?deliverableId=46183B706BEA11E48038141DE954FC88, tab Supported Software). It can explain this kind of problem because this Liberty version has defects concerning jndi management, REST connection..
We are having a problem when running unit tests using CPsuite and JMockit.
The tests run fine when executed in Eclipse, but if we use our Ant script to run all the tests (see script at the end of this question), we get the following exception:
Testcase: initializationError took 0 sec
Caused an ERROR
(class: mockit/internal/startup/JDK6AgentLoader, method: getVirtualMachineImplementationFromEmbeddedOnes signature: ()Lcom/sun/tools/attach/VirtualMachine;) Wrong return type in function
java.lang.VerifyError: (class: mockit/internal/startup/JDK6AgentLoader, method: getVirtualMachineImplementationFromEmbeddedOnes signature: ()Lcom/sun/tools/attach/VirtualMachine;) Wrong return type in function
at mockit.internal.startup.AgentInitialization.initializeAccordingToJDKVersion(AgentInitialization.java:21)
at mockit.internal.startup.Startup.verifyInitialization(Startup.java:86)
at mockit.Invocations.<clinit>(Invocations.java:22)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
This only happens on Ant, and only if there is a class that uses JMockit in the CPSuite set.
Anyone know why are we getting this error?
The Ant Script:
<project name="chughtai.junit" default="run" basedir=".">
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
<!-- https://junit-anttask.dev.java.net/ -->
<!--
<taskdef name="junit2" classname="com.sun.ant.junit.JUnitTask">
<classpath>
<pathelement path="lib/junit-anttask.jar" />
<pathelement path="lib/junit-4.4.jar" />
</classpath>
</taskdef>
-->
<property environment="env"/>
<property file="junit.build.properties"/>
<filelist id="third-party_jars" dir="lib">
<file name="${ext.classpath}/bin/lib/j2ee.jar"/>
</filelist>
<path id="project.path">
<pathelement path="${env.JAVA_HOME}/lib/tools.jar"/>
<pathelement location="classes/"/>
<fileset dir="lib">
<include name="**/*.jar"/>
<include name="**/*.properties"/>
</fileset>
<dirset dir="${build.dir}">
<include name="apps/**/classes"/>
<exclude name="apps/**/*Test*"/>
</dirset>
<pathelement location="${basedir}/junittestcases"/>
<filelist refid="third-party_jars"/>
<pathelement path="${ext.classpath}"/>
<pathelement location="${ext.classpath}/WEB-INF/classes"/>
</path>
<target name="init">
<mkdir dir="${prd.junit.test.report.dir}" />
<mkdir dir="${prd.junit.test.report.dir}/html" />
</target>
<!-- default target -->
<target name="run" depends="init">
<property name="myclasspath" refid="project.path"/>
<property name="java.class.path" refid="project.path"/>
<echo message="***Junit Controller Application***"/>
<echo message="basedir is ${basedir}"/>
<!--<echo message="${myclasspath}" />-->
<junit dir="${basedir}/junittestcases/" printsummary="yes" haltonfailure="no" fork="no" forkmode="once" reloading="false" maxmemory="1024m">
<jvmarg value="-Xms768M"/>
<jvmarg value="-Xmx1024M"/>
<jvmarg value="-XX:MaxPermSize=256M"/>
<sysproperty key="tests" value="${tests}"/>
<sysproperty key="java.class.path" value="${myclasspath}"/>
<formatter type="plain" usefile="true" extension=".txt" />
<formatter type="xml" />
<classpath refid="project.path"/>
<test name="${use.testcase}" haltonfailure="no" fork="false" todir="${prd.junit.test.report.dir}" if="use.testcase">
<formatter type="xml" />
</test>
</junit>
<!-- Generate the Unit Test reports -->
<junitreport todir="${prd.junit.test.report.dir}">
<fileset dir="${prd.junit.test.report.dir}">
<include name="*.xml" />
</fileset>
<report todir="${prd.junit.test.report.dir}/html" styledir="${xsl.templates}" format="frames">
<param name="build.number" expression="${app.build}" />
<param name="application.name" expression="${app.name}" />
</report>
</junitreport>
</target>
<target name="emma.report" depends ="" description="Creates 3 EMMA report formats based on the coverage data gathered.">
<if>
<available file="coverage.ec" />
<then>
<move file="coverage.ec" tofile="${coverage.dir}/junits.ec" overwrite="true"/>
</then>
</if>
<emma>
<report sourcepath="src" sort="+block,+name,+method,+class" metrics="method:70,block:80,line:80,class:100">
<!-- collect all EMMA data dumps (metadata and runtime)
[this can be done via nested <fileset> fileset elements
or <file> elements pointing to a single file]:
-->
<fileset dir="${coverage.dir}">
<include name="*.em" />
<include name="*.ec" />
</fileset>
<!-- for every type of report desired, configure a nested
element; various report parameters
can be inherited from the parent <report>
and individually overridden for each report type:
-->
<txt outfile="${coverage.dir}/coverage.txt" depth="package" columns="class,method,block,line,name" />
<xml outfile="${coverage.dir}/coverage.xml" depth="package" />
<html outfile="${coverage.dir}/coverage.html" depth="method" columns="name,class,method,block,line" />
</report>
</emma>
</target>
<target name="clean">
<delete file="${coverage.dir}/coverage.*" />
</target>
</project>
I am using Junit 4.10 with ANT 1.8.3 and Teamcity 7.0.2. I have set printsummary=withOutAndErr in my build.xml
When I run the build manually from ANT, the generated JUnit HTML report shows System.out statements, however; When I run the same build from Teamcity the System-out statements do not show up. What am I doing wrong?
Build.xml to reproduce the scenario:
Sample JUnit Tests
<property name="project_name" value="junitSamples"/>
<property name="src" location="src"/>
<property name="build" location="bin"/>
<property name="dist" location="dist"/>
<property name="lib" location="lib"/>
<property name="res" location="res"/>
<property name="reports" location="reports"/>
<!-- the names of various distributable files -->
<property name="jar_name" value="${project_name}.jar"/>
<property name="war_name" value="${project_name}.war"/>
<!-- top level targets -->
<target name="compile" depends="init" description="compile the source code " >
<javac srcdir="${src}" destdir="${build}">
<classpath>
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
</classpath>
</javac>
</target>
<target name="dist" depends="compile" description="generate the distributable files " >
<!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
<jar jarfile="${dist}/${jar_name}" basedir="${build}"/>
</target>
<target name="clean" description="clean up" >
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}"/>
<delete dir="${dist}"/>
<delete dir="${reports}"/>
</target>
<target name="run-tests" depends="compile" description="run your test suite" >
<junit printsummary="true" haltonfailure="no" showoutput="yes" >
<classpath>
<pathelement path="${build}"/>
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
</classpath>
<batchtest fork="yes" todir="${reports}/raw/">
<formatter type="xml"/>
<fileset dir="${src}">
<include name="**/*Test*.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name ="test" depends="run-tests">
<junitreport todir="${reports}">
<fileset dir="${reports}/raw/">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${reports}\html\"/>
</junitreport>
</target>
<target name ="run" depends="" description="if this project can be run, run it" >
</target>
<!-- supporting targets -->
<target name="init" description="initialize the build environment" >
<!-- Create the time stamp -->
<tstamp/>
<!-- Create directory structures -->
<delete dir="${build}"/>
<delete dir="${dist}"/>
<delete dir="${reports}"/>
<mkdir dir="${build}"/>
<mkdir dir="${dist}/lib"/>
<mkdir dir="${reports}"/>
<mkdir dir="${reports}/raw/"/>
<mkdir dir="${reports}/html/"/>
</target>
<target name="all" depends="clean, test">
</target>