How do I resolve "Packages is not defined" in WSO2 Carbon 4.0.3 with Application Server Features? - rhino

I am attempting to upgrade from WSO2 Carbon 3.0.0 to Carbon 4.0.3. Using Carbon 3.0.0, after installing the necessary features, I'm able to write JavaScript Mashup services that can call external Java libraries--and since WSO2 carbon uses Rhino, I'm able to use importPackage. I have not been able to get the same functionality working on Carbon 4.0.3.
The procedure I've followed is:
Download and unzip WSO2 Carbon 4.0.3
Start Carbon
Navigate to the "Feature Management" page
Add the 4.0.3 Carbon p2 repository (http://dist.wso2.org/p2/carbon/releases/4.0.3/)
Search for and install the "Application Server" feature
Restart Carbon
Deploy my test Mashup service
Execute the echo operation of my test Mashup service using the "tryit" tool.
My test Mashup service (TestMashup.js):
this.serviceName = "TestMashup";
echo.inputTypes = "#raw";
echo.outputType = "#raw";
function echo(parameter) {
var javaDate = new Packages.java.util.Date();
var response = "<echo><value>" + parameter.toXMLString() + "</value><timestamp>" + javaDate.getTime() + "</timestamp></echo>";
return new XML(response);
}
I've installed this Mashup service to CARBON_HOME/repository/deployment/server/jsservices/admin/
When I run this operation on Carbon 3.0.0, I get the following response:
<echo>
<value>
<r>test</r>
</value>
<timestamp>1360699125311</timestamp>
</echo>
When I attempt to run this operation on Carbon 4.0.3, I get the following stack-trace:
[2013-02-12 14:46:32,511] ERROR {org.jaggeryjs.scriptengine.engine.RhinoEngine} - org.mozilla.javascript.EcmaError: ReferenceError: "Packages" is not defined.(//C:\WSO2CA~1\WSO2CA~1.3\bin\..\repository\deployment\server\jsservices\admin\TestMashup.js#6)
[2013-02-12 14:46:32,512] ERROR {org.jaggeryjs.scriptengine.engine.RhinoEngine} - org.jaggeryjs.scriptengine.exceptions.ScriptException: org.mozilla.javascript.EcmaError: ReferenceError: "Packages" is not defined. (//C:\WSO2CA~1\WSO2CA~1.3\bin\..\repository\deployment\server\jsservices\admin\TestMashup.js#6)
[2013-02-12 14:46:32,512] ERROR {org.apache.axis2.receivers.AbstractMessageReceiver} - org.jaggeryjs.scriptengine.exceptions.ScriptException: org.mozilla.javascript.EcmaError: ReferenceError: "Packages" is not defined. (//C:\WSO2CA~1\WSO2CA~1.3\bin\..\repository\deployment\server\jsservices\admin\TestMashup.js#6)
org.apache.axis2.AxisFault: org.jaggeryjs.scriptengine.exceptions.ScriptException: org.mozilla.javascript.EcmaError: ReferenceError: "Packages" is not defined.(//C:\WSO2CA~1\WSO2CA~1.3\bin\..\repository\deployment\server\jsservices\admin\TestMashup.js#6)
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at org.wso2.carbon.mashup.javascript.messagereceiver.JavaScriptEngine.call(JavaScriptEngine.java:176)
at org.wso2.carbon.mashup.javascript.messagereceiver.JavaScriptEngine.call(JavaScriptEngine.java:208)
at org.wso2.carbon.mashup.javascript.messagereceiver.JavaScriptReceiver.invokeBusinessLogic(JavaScriptReceiver.java:185)
at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:110)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:146)
at org.wso2.carbon.core.transports.CarbonServlet.doPost(CarbonServlet.java:231)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.eclipse.equinox.http.helper.FilterServletAdaptor$FilterChainImpl.doFilter(FilterServletAdaptor.java:56)
at org.wso2.carbon.mashup.jsservices.custom.ui.CustomUIServletFilter.doFilter(CustomUIServletFilter.java:233)
at org.eclipse.equinox.http.helper.FilterServletAdaptor.service(FilterServletAdaptor.java:37)
at org.eclipse.equinox.http.servlet.internal.ServletRegistration.handleRequest(ServletRegistration.java:90)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:111)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:67)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.service(DelegationServlet.java:68)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.wso2.carbon.tomcat.ext.filter.CharacterSetFilter.doFilter(CharacterSetFilter.java:61)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:172)
at org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:156)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:52)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1653)
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: org.jaggeryjs.scriptengine.exceptions.ScriptException: org.jaggeryjs.scriptengine.exceptions.ScriptException: org.mozilla.javascript.EcmaError: ReferenceError: "Packages" is not defined. (//C:\WSO2CA~1\WSO2CA~1.3\bin\..\repository\deployment\server\jsservices\admin\TestMashup.js#6)
at org.jaggeryjs.scriptengine.engine.RhinoEngine.execFunc(RhinoEngine.java:383)
at org.jaggeryjs.scriptengine.engine.RhinoEngine.call(RhinoEngine.java:251)
at org.wso2.carbon.mashup.javascript.messagereceiver.JavaScriptEngine.call(JavaScriptEngine.java:169)
... 40 more
Caused by: org.jaggeryjs.scriptengine.exceptions.ScriptException: org.mozilla.javascript.EcmaError: ReferenceError: "Packages" is not defined. (//C:\WSO2CA~1\WSO2CA~1.3\bin\..\repository\deployment\server\jsservices\admin\TestMashup.js#6)
at org.jaggeryjs.scriptengine.engine.RhinoEngine.execFunc(RhinoEngine.java:401)
at org.jaggeryjs.scriptengine.engine.RhinoEngine.execFunc(RhinoEngine.java:380)
... 42 more
Caused by: org.mozilla.javascript.EcmaError: ReferenceError: "Packages" is not defined. (//C:\WSO2CA~1\WSO2CA~1.3\bin\..\repository\deployment\server\jsservices\admin\TestMashup.js#6)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3557)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3535)
at org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3620)
at org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1652)
at org.jaggeryjs.rhino.c0._c1(//C:\WSO2CA~1\WSO2CA~1.3\bin\..\repository\deployment\server\jsservices\admin\TestMashup.js:6)
at org.jaggeryjs.rhino.c0.call(//C:\WSO2CA~1\WSO2CA~1.3\bin\..\repository\deployment\server\jsservices\admin\TestMashup.js)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:401)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3003)
at org.jaggeryjs.rhino.c0.call(//C:\WSO2CA~1\WSO2CA~1.3\bin\..\repository\deployment\server\jsservices\admin\TestMashup.js)
at org.jaggeryjs.scriptengine.engine.RhinoEngine.execFunc(RhinoEngine.java:398)
... 43 more
How do I fix this so that I can continue using Java libraries from my JavaScript Mashup services?

The code that allowed this feature to work has been disabled.
I spent some time looking through the carbon SVN repository and discovered that the message-receiver mashup component was modified in such a way that prevents JavaScript Mashup services from being created with an ImporterTopLevel context. This is directly visible in org.wso2.carbon.mashup.javascript.messagereceiver.JavaScriptEngine, where previous versions extend ImporterTopLevel but newer versions do not. For future reference, this change was committed against revision 129254.
I've been able to merge the ImporterTopLevel code from 3.2.2 into the 4.0.3 version of messagereceiver to work around the problem.

When you install required features to Carbon server, see whether there are any errors printed in the console. There may be some dependency issues. And after you install the features, start the WSO2 AS with command ./wso2server.sh -DosgiConsole and using ss command and comp command see whether there are any unresolved OSGi dependencies. If there are any, try putting the required bundles into repository/components/dropins and restarting the server.
And also I am not sure whether only installing the Application Server feature will enable your Mashup requirements. Therefore in that repository see whether there are any Mashup Server related features available. If so install them as well. It seems in your server, host object "Packages", has some problem.
When you fail to install some features due to dependency issues you can try putting required bundles in dropins directory. And if that also fails you may have to checkout the code relevant to that component and backport it to your server version.

Related

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.

IncompatibleClassChangeError with grails rendering plugin 0.44

I have grails 2.0.4 application with rendering plugin 0.44. It works fine in dev environment, however, fails in production with IncompatibleClassChangeError.
Looked into the jars to see if there are any duplicates or incompatibilities, couldn't trace anything suspicious.
Tried with clean war (grails clean, war) but didn't help.
Both production and development test are running similar setup except java minor versions - java 1.6.0_65 (dev test/mac os) and java 1.6.0_30 (production/cent os).
Any help much appreciated, thanks!
Here is my BuildConfig.groovy:
plugins{
------
compile ":qrcode:0.3"
compile ":rendering:0.4.4"
}
Here is the stack trace:
org.codehaus.groovy.grails.web.servlet.mvc.exceptions.ControllerExecutionException: Executing action [our function] of controller [com.x.ourcontroller] caused exception: Runtime error executing action
at org.grails.jaxrs.web.JaxrsFilter.doFilterInternal(JaxrsFilter.java:46)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:769)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:698)
at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:891)
at java.lang.Thread.run(Thread.java:701)
Caused by: org.codehaus.groovy.grails.web.servlet.mvc.exceptions.ControllerExecutionException: Runtime error executing action
... 7 more
Caused by: java.lang.reflect.InvocationTargetException
... 7 more
Caused by: java.lang.IncompatibleClassChangeError
at grails.plugin.rendering.document.RenderEnvironment.init(RenderEnvironment.groovy:37)
at grails.plugin.rendering.document.RenderEnvironment.with(RenderEnvironment.groovy:75)
at grails.plugin.rendering.document.RenderEnvironment.with(RenderEnvironment.groovy:67)
at grails.plugin.rendering.document.XhtmlDocumentService.generateXhtml(XhtmlDocumentService.groovy:64)
at grails.plugin.rendering.document.XhtmlDocumentService.createDocument(XhtmlDocumentService.groovy:34)
at grails.plugin.rendering.RenderingService.render(RenderingService.groovy:36)
at grails.plugin.rendering.RenderingService.render(RenderingService.groovy:35)
at grails.plugin.rendering.RenderingService.render(RenderingService.groovy:65)
at RenderingGrailsPlugin$_closure3.doCall(RenderingGrailsPlugin.groovy:59)
at com.xx.yy..
... 7 more
2014-03-19 20:55:52,025 [TP-Processor16] ERROR servlet.GrailsDispatcherServlet - HandlerInterceptor.afterCompletion threw exception
java.lang.IncompatibleClassChangeError
at org.grails.jaxrs.web.JaxrsFilter.doFilterInternal(JaxrsFilter.java:46)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:769)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:698)
at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:891)
at java.lang.Thread.run(Thread.java:701)
2014-03-19 20:55:52,026 [TP-Processor16] ERROR servlet.GrailsDispatcherServlet - HandlerInterceptor.afterCompletion threw exception
java.lang.IncompatibleClassChangeError
at org.grails.jaxrs.web.JaxrsFilter.doFilterInternal(JaxrsFilter.java:46)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:769)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:698)
at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:891) at java.lang.Thread.run(Thread.java:701)
java.lang.IncompatibleClassChangeError was happening due to a conflict between classes across different plugins with respect to MockHttpServletRequest and MockHttpServletResponse classes coming for jax-rs plugin. Tried the latest jax-rs plugin (0.9 for 2.0.x grails) which mentions in release notes that these are removed. However, this version of plugin didn't fix the problem. Manually removed the mock directory under jax-rs plugin from the war and repackaging it as a workaround for now. Removing the mock/* files fixed the problem.

"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.

How to run a local plugin in grails 1.3.5

I'm using Grails and I have a local-plugin (that I wrote) that I'm using in conjunction with my project. The local plugin location is configured in BuildConfig.groovy using the grails.plugin.location config parameter.
In Grails 1.3.3, the plugin worked fine, however since upgrading to Grails 1.3.5 I get the following error when I attempt to run one of the plugin's scripts:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pluginManager': Invocation of init method failed; nested exception is java.io.FileNotFoundException: web-app\WEB-INF\grails.xml (The system cannot find the file specified)
at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:391)
at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415)
at gant.Gant$_dispatch_closure7.doCall(Gant.groovy)
at gant.Gant.withBuildListeners(Gant.groovy:427)
at gant.Gant.this$2$withBuildListeners(Gant.groovy)
at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
at gant.Gant.dispatch(Gant.groovy:415)
at gant.Gant.this$2$dispatch(Gant.groovy)
at gant.Gant.invokeMethod(Gant.groovy)
at gant.Gant.executeTargets(Gant.groovy:590)
at gant.Gant.executeTargets(Gant.groovy:589)
I believe that the grails.xml file (which it claims is missing) is generated automatically - and the problem may be related to issue GRAILS-6601 (however, this was fixed in 1.3.5).
In any case, my problem seems to have occurred due to a change in the _GrailsBootstrap.groovy script between Grails 1.3.3 and 1.3.5. Comparing these scripts between 1.3.3 and 1.3.5, I note that a new pluginManager part of the script reads:
// There is a pluginManager variable in the binding
delegate."pluginManager"(GrailsPluginManagerFactoryBean) {
application = grailsApplication
grailsDescriptor = new FileSystemResource("web-app/WEB-INF/grails.xml")
}
This is not present in the equivalent script in Grails 1.3.3 and seems to be causing my problem. I've looked at the release notes and other information, and haven't been able to find if there's something new I need to configure to make local plugins work.
Any ideas how I can avoid this error? Is it a configuration issue, and if so, what am I missing?
The following approach used to work for us since 1.1.1 till now, 1.3.6. In BuildConfig.groovy, write:
grails.plugin.location.'my-plugin-name' = "local-plugins/my-plugin-name-0.1"

Resources