MobileFirst Server - Application Center Configure Ant Task (configure-appcenter-liberty-mysql.xml) Error - ant

I'm trying to install & configure the application center for MobileFirst Server using the ant task to install. Prior to the install task I was able to use the database task to create necessary tables in the app center database.
I get the error mentioned in the logs below when running
ant -f configure-appcenter-liberty-mysql.xml install
Ref
https://www.ibm.com/support/knowledgecenter/SSHS8R_7.1.0/com.ibm.worklight.installconfig.doc/appcenter/t_ac_deploy_cons_serv_ant_tasks.html?lang=en
Ant Script Output
root#ubuntu:/opt/IBM/MobileFirst_Platform_Server/ApplicationCenter/configuration-samples# sudo ant -v -f configure-appcenter-liberty-mysql-edited.xml install
Apache Ant(TM) version 1.9.3 compiled on April 8 2014
Buildfile: /opt/IBM/MobileFirst_Platform_Server/ApplicationCenter/configuration-samples/configure-appcenter-liberty-mysql-edited.xml
Detected Java version: 1.7 in: /usr/lib/jvm/java-7-openjdk-amd64/jre
Detected OS: Linux
parsing buildfile /opt/IBM/MobileFirst_Platform_Server/ApplicationCenter/configuration-samples/configure-appcenter-liberty-mysql-edited.xml with URI = file:/opt/IBM/MobileFirst_Platform_Server/ApplicationCenter/configuration-samples/configure-appcenter-liberty-mysql-edited.xml
Project base dir set to: /opt/IBM/MobileFirst_Platform_Server/ApplicationCenter/configuration-samples
parsing buildfile jar:file:/usr/share/ant/lib/ant.jar!/org/apache/tools/ant/antlib.xml with URI = jar:file:/usr/share/ant/lib/ant.jar!/org/apache/tools/ant/antlib.xml from a zip file
Build sequence for target(s) `install' is [install]
Complete build sequence is [install, help, minimal-update, databases, uninstall, ]
install:
[installApplicationCenter] Logging output of task <installApplicationCenter> to file /root/.mobilefirst_platform_server/configuration-logs/installApplicationCenter_2016_04_20_22_42_09.log
[installApplicationCenter] Copying /opt/IBM/MobileFirst_Platform_Server/tools/mysql-connector-java-5.1.38/mysql-connector-java-5.1.38-bin.jar to /opt/IBM/WebSphere/Liberty/usr/shared/resources/mysql/mysql-connector-java-5.1.38-bin.jar
[installApplicationCenter] Copying /opt/IBM/MobileFirst_Platform_Server/tools/mysql-connector-java-5.1.38/mysql-connector-java-5.1.38-bin.jar to /opt/IBM/WebSphere/Liberty/usr/shared/resources/mysql/mysql-connector-java-5.1.38-bin.jar
[installApplicationCenter] Copying /opt/IBM/WebSphere/Liberty/usr/servers/simpleServer/server.xml to /opt/IBM/WebSphere/Liberty/usr/servers/simpleServer/server.xml.bak2
[installApplicationCenter] Modifying /opt/IBM/WebSphere/Liberty/usr/servers/simpleServer/server.xml
[installApplicationCenter] Deleting /opt/IBM/WebSphere/Liberty/usr/servers/simpleServer/server.xml.bak2
BUILD FAILED
/opt/IBM/MobileFirst_Platform_Server/ApplicationCenter/configuration-samples/configure-appcenter-liberty-mysql-edited.xml:74: An error occured while reading file /opt/IBM/WebSphere/Liberty/usr/servers/simpleServer/server.xml. Error: null.
at com.ibm.worklight.config.ant.appserver.AppCenterAppServerTask.wasLibertyAugmentConfigFiles(AppCenterAppServerTask.java:654)
at com.ibm.worklight.config.ant.appserver.AppServerTask.configureAppServer(AppServerTask.java:4423)
at com.ibm.worklight.config.ant.appserver.AppServerTask.installItems(AppServerTask.java:4165)
at com.ibm.worklight.config.ant.appserver.AppCenterAppServerTask.installItems(AppCenterAppServerTask.java:1143)
at com.ibm.worklight.config.ant.appserver.AppServerTask.processItems(AppServerTask.java:4114)
at com.ibm.worklight.config.ant.appserver.AppCenterAppServerTask.buildAndProcessItems(AppCenterAppServerTask.java:1088)
at com.ibm.worklight.config.ant.appserver.AppServerTask.setupBuildAndProcessItems(AppServerTask.java:3064)
at com.ibm.worklight.config.ant.appserver.AppServerTask.doExecute(AppServerTask.java:307)
at com.ibm.worklight.config.ant.appserver.InstallApplicationCenterTask.execute(InstallApplicationCenterTask.java:28)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.Main.runBuild(Main.java:851)
at org.apache.tools.ant.Main.startAnt(Main.java:235)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: java.lang.NullPointerException
at com.ibm.worklight.config.helper.appserver.WASLibertyAugmentServerXML.addAppCenterApplicationAndDataSourceElements(WASLibertyAugmentServerXML.java:1921)
at com.ibm.worklight.config.helper.appserver.WASLibertyAugmentServerXML.mainInstallApplicationCenter(WASLibertyAugmentServerXML.java:143)
at com.ibm.worklight.config.ant.appserver.AppCenterAppServerTask.wasLibertyAugmentConfigFiles(AppCenterAppServerTask.java:642)
... 25 more
Total time: 7 seconds

Just based on the name of the Ant file you're using, and the pathnames displayed in in the message output you included, it looks like you started from the wrong sample Ant file - in other words, it appears that you are using Liberty Profile as your application server, but you started from the sample Ant file for use with WebSphere Application Server.
Assuming that is in fact the case, you should start with the sample configuration file "configure-appcenter-liberty-mysql.xml" instead.
Also, just as a hint - it appears that even with the file you are using, you modified the sample Ant file provided with MobileFirst Platform Foundation 7.1 "in place" and wrote it back to it's original filename and used it? As mentioned in the documentation link you have in your question, it's actually recommended to make a copy of this file and work with the copy, rather than modifying the one we provide - that way, you'll always have the unmodified samples we provide, in case you want to refer to them, or use them as templates for a different server and/or different configuration.

I think you use Liberty Profile 8.5.5.9. There were some changes concerning the password decoding mechanism in this version that is no more compatible with MobileFirst.
Either you ask the IBM support for the APAR http://www-01.ibm.com/support/docview.wss?crawler=1&uid=swg1PI61386, either you use Liberty 8.5.5.8.

Related

Error Launching CloudDataFlow Java App using Cloud Composer

Am a GCP Newbie and facing an error when trying to run a cloud data flow app for the BeamTutorial using GCP Cloud Composers DataflowJavaOperator. Airflow picks up the pipeline but fails with the below error.
gcp_dataflow_hook.py:115} INFO - Running command: java -cp /tmp/dataflow13ec2a50-BeamTutorial-0.0.1-SNAPSHOT.jar org.apache.beam.examples.tutorial.game.solution.Exercise2 --runner=DataflowRunner --project=..... --region=us-central1 --labels={"airflow-version":"v1-9-0-composer"} --jobName=run-beam-data-flow-java-1449a1da --outputPrefix=gs://..../ex2-spark/out
gcp_dataflow_hook.py:127} WARNING - Error: A JNI error has occurred, please check your installation and try again
[2018-10-18 09:35:00,316] {base_task_runner.py:98} INFO - Subtask: Exception in thread "main" java.lang.NoClassDefFoundError:org/apache/beam/sdk/options/PipelineOptions
This BeamTutorial-0.0.1-SNAPSHOT.jar is not a fat jar and runs the job successfully in Dataflow when submitted manually from gcp cloud shell manually as below
mvn compile exec:java -Dexec.mainClass="org.apache.beam.examples.tutorial.game.solution.Exercise2" -Dexec.args="--runner=dataflow --project=<project-name> --outputPrefix=gs://..../beam-tutorial/ex2-spark/out" -Pdataflow-runner
Appreciate any help in fixing this error. thank you.
When using the DataFlowJavaOperator you need to follow instructions here on how to create your ".jar" file:
Add the dependency and plugin from link
Run mvn package to create your ".jar" file
Once you do that I'd advise to make sure that the ".jar" file is actually running correctly before trying to run it inside Composer. So in this case following the tutorial, running:
java -jar target/BeamTutorial-0.0.1-SNAPSHOT.jar --runner=DataflowRunner --p
roject=<my-project> --tempLocation=<my-bucket>
I also get:
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/beam/sdk/options/PipelineOptions
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: org.apache.beam.sdk.options.PipelineOptions
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 7 more
So the issue looks more Java-related and how the pom is configured that is not creating a valid .jar file, or it is expecting some additional parameters. In any case you should troubleshoot the ".jar"/pom before going further.
For some other pipelines I have I ran them successfully using the DataflowJavaOperator and a valid ".jar" file.

The rule 'OCLint:ivar assignment outside accessors or init' does not exist

I am trying to integrate SonarQube to generate report on my iOS project,
I am using Objective-C Sonar plugin
When i run ./run-sonar.sh
OCLint generates a compile_commands.json file in my root directory.
and after that getting following error
11:24:39.782 INFO - Processing OCLint report /Users/.......app/./sonar-reports/oclint.xml
11:24:39.899 ERROR - Reporting 1073 violations.
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 16.240s
Final Memory: 6M/86M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
org.sonar.runner.impl.RunnerException: Unable to execute Sonar
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
at java.security.AccessController.doPrivileged(Native Method)
at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
at org.sonar.runner.api.Runner.execute(Runner.java:100)
at org.sonar.runner.Main.executeTask(Main.java:70)
at org.sonar.runner.Main.execute(Main.java:59)
at org.sonar.runner.Main.main(Main.java:53)
Caused by: The rule 'OCLint:ivar assignment outside accessors or init' does not exist.
Can any one help me on this issue?
Thanks
AMR
Thnaks
I had a similar error. My sonar server had two objective-c code analyser plugin. The Sonar Plugin for Objective C (free) and SonarSource Objective-C plugin (commercial)
When I removed (uninstalled) one of the plugin from sonar server the error stopped to occur
I had a similar error too with the last version of this plugin which is a fork of the one you used.
I downgrade my OCLint version from 0.11 to 0.10.1 and everything work perfectly.
It seems that the OCLint rules defined in the plugin was different of the OCLint version installed on my server.
I am not sure what version of the objective-c-sonar plugin that you were using.
I solved similar issue before.
Goto ${SONAR_INSTALLATION_FOLDER}/extensions/plugins/, copy the sonar-objective-c-plugin-${version}.jar to somewhere else.
unzip the jar file, and edit below file
org/sonar/plugins/objectivec/profile-oclint.xml
Add the rule you are missing following the layout of the xml file,
may be look similar below
<rule>
<repositoryKey>OCLint</repositoryKey>
<key>ivar assignment outside accessors or init</key>
</rule>
And edit another file org/sonar/plugins/objectivec/rules-oclint.xml
<rule>
<key>ivar assignment outside accessors or init</key>
<name>ivar assignment outside accessors or init</name>
<priority>MAJOR</priority>
<description>ivar assignment outside accessors or init</description>
</rule>
And then using zip to package the files unpacked as the new jar file.
Override the original plugin jar file in ${SONAR_INSTALLATION_FOLDER}/extensions/plugins/, restart the sonar, issue could be gone.
Repeat the step for all similar issues you encountered.

Jenkins "Pipe is already closed" when copy artifacts to slave

I am trying co setup an Linux slave for Jenkins and it seems that copyartifacts plugin fails to copy artifacts from master (Linux) to slave. It copies some of the files but always fails at last one with exception:
ERROR: Failed to copy artifacts from metabuilds-build with filter: **
java.io.IOException: Pipe is already closed
at hudson.remoting.PipeWindow.checkDeath(PipeWindow.java:83)
at hudson.remoting.PipeWindow$Real.get(PipeWindow.java:165)
at hudson.remoting.ProxyOutputStream._write(ProxyOutputStream.java:118)
at hudson.remoting.ProxyOutputStream.write(ProxyOutputStream.java:103)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
at java.io.BufferedOutputStream.write(BufferedOutputStream.java:109)
at java.util.zip.DeflaterOutputStream.deflate(DeflaterOutputStream.java:161)
at java.util.zip.DeflaterOutputStream.write(DeflaterOutputStream.java:118)
at java.util.zip.GZIPOutputStream.write(GZIPOutputStream.java:72)
at java.io.BufferedOutputStream.write(BufferedOutputStream.java:105)
at org.apache.tools.tar.TarBuffer.writeBlock(TarBuffer.java:410)
at org.apache.tools.tar.TarBuffer.writeRecord(TarBuffer.java:351)
at hudson.org.apache.tools.tar.TarOutputStream.writeEOFRecord(TarOutputStream.java:356)
at hudson.org.apache.tools.tar.TarOutputStream.finish(TarOutputStream.java:137)
at hudson.org.apache.tools.tar.TarOutputStream.close(TarOutputStream.java:149)
at hudson.util.io.TarArchiver.close(TarArchiver.java:119)
at hudson.FilePath.writeToTar(FilePath.java:1619)
at hudson.FilePath.copyRecursiveTo(FilePath.java:1544)
at hudson.FilePath.copyRecursiveTo(FilePath.java:1473)
at hudson.plugins.copyartifact.FilePathCopyMethod.copyAll(FilePathCopyMethod.java:51)
at hudson.plugins.copyartifact.CopyArtifact.perform(CopyArtifact.java:225)
at hudson.plugins.copyartifact.CopyArtifact.perform(CopyArtifact.java:199)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:662)
at hudson.model.Build$RunnerImpl.build(Build.java:177)
at hudson.model.Build$RunnerImpl.doRun(Build.java:139)
at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:429)
at hudson.model.Run.run(Run.java:1374)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:145)
Caused by: java.io.IOException: Pipe is already closed
at hudson.remoting.FastPipedOutputStream.write(FastPipedOutputStream.java:147)
at hudson.remoting.FastPipedOutputStream.write(FastPipedOutputStream.java:131)
at hudson.remoting.ProxyOutputStream$Chunk$1.run(ProxyOutputStream.java:185)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: hudson.remoting.FastPipedInputStream$ClosedBy: The pipe was closed at...
at hudson.remoting.FastPipedInputStream.close(FastPipedInputStream.java:112)
at hudson.FilePath$32.invoke(FilePath.java:1540)
at hudson.FilePath$32.invoke(FilePath.java:1534)
at hudson.FilePath$FileCallableWrapper.call(FilePath.java:1979)
at hudson.remoting.UserRequest.perform(UserRequest.java:118)
at hudson.remoting.UserRequest.perform(UserRequest.java:48)
at hudson.remoting.Request$2.run(Request.java:270)
... 6 more
Any ideas? We have Jenkins 1.413 and copyartifacts plugin of version 1.17.
It turned out that I had inapriopriate permissions in the slave directory. In case of anyone needed I will write exactly what I have done:
At the first time of copy artifacts invocation the error inspired by JENKINS-9540 I updated the copyartifacts plugin to version 1.17 - did not helped.
After that I tried to pass the build further so I disabled the copyartifacts step and manually uploaded the content to the slave (as root! that introduced bad file permissions for jenkins user)
When the build succeeded I returned to the main error and updated the plugin to version 1.20. This did not helped, but decided th check if the permissions are OK and noticed that the files I was trying to replace was owned by root.
After a little chown and chgrp the problem was fixed.
SUMMARY: Check the actual file/directory permissions when such problem occurs first and after that try newer version of the plugin.
Seems like an issue with the plugin. You need to upgrade to a newer version or to the latest version depending on whether the latest plugin version is compatible with the Jenkins version you have. Please check the last two latest comment in the link: https://issues.jenkins-ci.org/browse/JENKINS-9540

"Exception in thread "main" java.lang.ClassNotFoundException: org.codehaus.groovy.tools.GroovyStarter" error while running a simple GEB program

I have:
java version "1.6.0_37"
Java(TM) SE Runtime Environment (build 1.6.0_37-b06-434-10M3909)
Java HotSpot(TM) 64-Bit Server VM (build 20.12-b01-434, mixed mode)
Grails 2.2.0
Groovy 2.0
GEB core 0.7.2
and all the required jars.
I am trying to run a simple GEB program:
#Grapes([
#Grab("org.codehaus.geb:geb-core:0.7.2"),
#Grab("org.seleniumhq.selenium:selenium-firefox-driver:2.28.0"),
#Grab("org.seleniumhq.selenium:selenium-support:2.15.0")
])
import geb.Browser
Browser.drive {
go "http://googel.com/"
assert title == "Google"
}
and as I run this I am seeing the above mentioned exception:
Exception in thread "main" java.lang.ClassNotFoundException: org.codehaus.groovy.tools.GroovyStarter
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:113)
Basically your GROOVY_HOME is either pointing to wrong location or not accessible. Just correct it and job done.
I faced this when I was trying to execute a groovy script as part of some migration activity.
The problem was simple. In my case it was not able to see the path of groovy installation.
When I used full path of $GROOVY_HOME/bin/groovy <script>
It worked.
It has nothing to do with Geb -- your environment is misconfigured.
Have a look at this groovy user mailing list thread.
Another thing is that as far as I know Geb 0.7.2 is compiled with Groovy 1.8.6 and I don't know if it's compatible with Groovy 2.0.
Download Groovy Binary From http://groovy.codehaus.org/Download
Download zip: Binary Release
Extract Local Disk say D;\GROOVY\ groovy-2.3.9
It contains the Folder Structure D:. ├───bin ├───conf ├───embeddable ├───indy ├───lib └───META-INF
Go to Control Panel\User Accounts\User Accounts  Change My Environment Variables
Set/new GROOVY_HOME = D:\GROOVY\groovy-2.3.9 (don’t put : semicolon)
Set PATH = C:\Program Files\Java\jdk1.8.0_25\bin;%GROOVY_HOME%\bin;
Add groovy-all.jar to CLASSPATH
D:\ GROOVY\ \groovy-2.3.9\embeddable\groovy-all-2.3.9.jar;.
Close and Open Command and Say –groovy
For console -groovyConsole

Saxon stops working after installing batik-rasterizer

Could someone please help me with the following problem?
Yesterday I was trying to add a process to my ANT script (Windows XP, ANT version 1.8.2, mostly XSLT 2.0, Saxon 9 simply added to my ant/lib) whereby it converts a directory of SVGs to PDFs using Batik's rasterizertask. Initially I had a lot of trouble getting ANT to recognize the rasterizertask but after reinstalling Batik from source and with the help of the following link I was able to get it to work.
https://mail-archives.apache.org/mod_mbox/xmlgraphics-batik-users/200605.mbox/%3C445B43B9.4010403#harcotechnology.com%3E
Though these instructions did not state to do so, I found I needed to recompile/rebuild the rasterizertask.jar.
As a side note, I had also already added the path to the batik-rasterizer.jar and rasterizertask classes to my CLASSPATH as recommended on the official Batik site.
And voila, I had the rasterizer task working. Alas, all my XSLT 2.0 tasks that followed the rasterizertask in my ANT script stopped working. From what I could tell, something I had done caused the default XSLT processor to be changed to Xalan-j. And Xalan does not support much of my XSLT.
For example, this is the error I get from Xalan (I know why I am getting this error, which is why I use Saxon):
[xslt] Processing D:\workDirs\PLMXML2HeirarchalXML\source\plmxml.xml to D:\workDirs\PLMXML2HeirarchalXML\target\step1.xml
[xslt] Loading stylesheet D:\workDirs\PLMXML2HeirarchalXML\stylesheets\step1.xsl
[xslt] D:\workDirs\PLMXML2HeirarchalXML\stylesheets\step1.xsl:10:16: Warning! Created using: Apache Software Foundation, http://xml.apache.org/xalan-j
[xslt] D:\workDirs\PLMXML2HeirarchalXML\stylesheets\step1.xsl:10:16: Warning! Created using: Apache Software Foundation, http://xml.apache.org/xalan-j
[xslt] Processing D:\workDirs\PLMXML2HeirarchalXML\target\step1.xml to D:\workDirs\PLMXML2HeirarchalXML\target\step2.xml
[xslt] Loading stylesheet D:\workDirs\PLMXML2HeirarchalXML\stylesheets\step2.xsl
[xslt] D:\workDirs\PLMXML2HeirarchalXML\stylesheets\step2.xsl:134:53: Fatal Error! java.lang.ClassCastException: org.apache.xpath.objects.XRTreeFrag cannot be cast to org.apache.xpath.objects.XNodeSet Cause: java.lang.ClassCastException: org.apache.xpath.objects.XRTreeFrag cannot be cast to org.apache.xpath.objects.XNodeSet
[xslt] Failed to process D:\workDirs\PLMXML2HeirarchalXML\target\step1.xml
BUILD FAILED
D:\workDirs\PLMXML2HeirarchalXML\build.xml:5: Fatal error during transformation
And all methods I have found and tried to force ANT to use Saxon (ie. adding Saxon to CLASSPATH, xslt/factory) seem to result in Saxon being called rather than Xalan but now I get the following error:
java.lang.NullPointerException
at org.apache.xerces.parsers.AbstractSAXParser.setContentHandler(Unknown Source)
at net.sf.saxon.Configuration.reuseStyleParser(Configuration.java:2346)
at net.sf.saxon.PreparedStylesheet.loadStylesheetModule(PreparedStylesheet.java:261)
at net.sf.saxon.PreparedStylesheet.prepare(PreparedStylesheet.java:185)
at net.sf.saxon.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:132)
at org.apache.tools.ant.taskdefs.optional.TraXLiaison.readTemplates(TraXLiaison.java:300)
at org.apache.tools.ant.taskdefs.optional.TraXLiaison.createTransformer(TraXLiaison.java:317)
at org.apache.tools.ant.taskdefs.optional.TraXLiaison.transform(TraXLiaison.java:178)
at org.apache.tools.ant.taskdefs.XSLTProcess.process(XSLTProcess.java:853)
at org.apache.tools.ant.taskdefs.XSLTProcess.execute(XSLTProcess.java:389)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:392)
at org.apache.tools.ant.Target.performTasks(Target.java:413)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:811)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
So if I let Xalan do the processing, the rasterizer task still works, but my previously working XSLT does not, and if I use Saxon nothing works. I tried installing ANT 1.8.4, but I get the same results.
I have exhausted all of the resources I have found, including similar posts on this site, but all solutions seem to point to things I have already tried.
Hopefully this is enough information for someone to give me some advice or assistance.
Thanks,
Keith
There's a long history here of different problems in different Ant releases. (As a result, I for one have a lot of legacy Ant code using to call Saxon via the command line interface.) But I believe that with recent Ant releases, the trax factory mechanism works properly. Are you using
<xslt...>
<factory name="net.sf.saxon.TransformerFactoryImpl"/>
</xslt>
?
Trying to control which XSLT processor is used via the classpath is intrinsically failure-prone. That applies to any application, not just to Ant. And I think there are still bugs in the way Ant manipulates the classpath - or at any rate, to be more polite, behaviours that are not apparent from the documentation.

Resources