Author |
Message
|
Urizen |
Posted: Thu Jul 11, 2013 1:00 pm Post subject: Xalan Extension Functions |
|
|
Novice
Joined: 11 Jul 2013 Posts: 22
|
Hi all, before the question I want to apologize for my poor english...
I am developing a flow in message broker 7.0.0.5 and it uses the XSLT Transform Node. Everything works fine and I can call xalan extensions functions for java processing, provided the classes I use exists in the jdk.
Now I want to call a custom xalan extension function, so I defined a simple java class with a static method that only returns a default String. When I test the template in the Broker Toolkit it works fine, but when I deploy it on the Broker the execution fails with the error "Could not compile stylesheet".
I know that Xalan and the extensions functions are not the problem, and I've already tried to put the jar containing the class in the deployable bar and the "shared-classes" folder... what could be the problem?, have anybody tried to do something like this?.
Here are the template and the function, just in case:
Code: |
package net.test;
public class XSLTExtension {
public static String getString() {
return "Hello World!!!";
}
}
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:test="xalan://net.test.XSLTExtension"
xmlns:math="xalan://java.lang.Math"
extension-element-prefixes="test math">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<xalanExtensionFunctionsTest>
<customFunctionValue>
<xsl:value-of select="test:getString()"/>
</customFunctionValue>
<defaultJdkFunctionValue>
<xsl:value-of select="math:sin(3.1415292 * 10 div 180.0)"/>
</defaultJdkFunctionValue>
</xalanExtensionFunctionsTest>
</xsl:template>
</xsl:stylesheet> |
Thanks in advance!. |
|
Back to top |
|
 |
mqjeff |
Posted: Fri Jul 12, 2013 5:42 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
XSLT is not a first-class transformation interface in Broker. It's available to use, and it's fine to use, but the other transformation interfaces may be much simpler. XSLT also only lets you work with source data that is already XML formatted, whereas the other transformation interfaces let you work with any data that can be parsed into a logical message tree.
If you put the jar file in the BAR file and deployed, it should be available to the XSLT engine...
can you show the full error message you get from Broker when you try and use this?
It will be helpful to run a usertrace as well, this may provide additional information. |
|
Back to top |
|
 |
Urizen |
Posted: Mon Jul 15, 2013 3:55 am Post subject: |
|
|
Novice
Joined: 11 Jul 2013 Posts: 22
|
Thanks for the reply.
I know that XSLT is not the first selection when choosing between tranformation technologies in broker, but in this case I have to use it.
The following error is returned by the flow:
Quote: |
Exception. BIP2230E: Se ha detectado un error mientras se procesaba un mensaje en el nodo 'xslt.XSLTTranslationFlow.XSL Transform'. : F:\build\S700_P\src\DataFlowEngine\PluginInterface\ImbJniNode.cpp: 1178: ImbJniNode::evaluate: ComIbmXslMqsiNode: xslt/XSLTTranslationFlow#FCMComposite_1_3
BIP4447E: El nodo XSLT ''XSL Transform'' ha encontrado un problema durante la transformación. El mensaje de error es ''Transformation failure when processing Stylesheet deployed:./xslt/XalanFunctionsTemplateTest.xsl: XMLTransformNode.java: 984: transformData.
|
And here it's the detail user trace from the execution:
Quote: |
Timestamps are formatted in local time, 180 minutes before GMT.
Trace written by version 7004; formatter version 7004 (build S700-FP04)
2013-07-15 08:45:30.129958 7440 UserTrace BIP4040I: The Execution Group ''EG_TRANSLATION_TEST'' has processed a configuration message successfully.
A configuration message has been processed successfully. Any configuration changes have been made and stored persistently.
No user action required.
2013-07-15 08:45:30.130498 7440 UserTrace BIP2638I: The MQ output node '.outputNode' attempted to write a message to queue ''SYSTEM.BROKER.EXECUTIONGROUP.REPLY'' connected to queue manager ''QMQATECH1''. The MQCC was '0' and the MQRC was '0'.
2013-07-15 08:45:30.130522 7440 UserTrace BIP2622I: Message successfully output by output node '.outputNode' to queue ''SYSTEM.BROKER.EXECUTIONGROUP.REPLY'' on queue manager ''QMQATECH1''.
2013-07-15 08:46:16.084719 7344 UserTrace BIP3122I: Message received and propagated to ''out'' terminal of HTTP input node ''xslt.XSLTTranslationFlow.HTTP Input''.
2013-07-15 08:46:16.085054 7344 UserTrace BIP3904I: Invoking the evaluate() method of node (class='ComIbmXslMqsiNode', name='xslt/XSLTTranslationFlow#FCMComposite_1_3').
About to pass a message to the evaluate() method of the specified node.
No user action required.
2013-07-15 08:46:16.107994 7344 UserTrace BIP6060I: Parser type ''Properties'' created on behalf of node 'xslt.XSLTTranslationFlow.HTTP Input' to handle portion of incoming message of length 364 bytes beginning at offset '0'.
2013-07-15 08:46:16.108528 7344 UserTrace BIP6061I: Parser type ''HTTPInputHeader'' created on behalf of node 'xslt.XSLTTranslationFlow.HTTP Input' to handle portion of incoming message of length '385' bytes beginning at offset '364'. Parser type selected based on value ''WSINPHDR'' from previous parser.
2013-07-15 08:46:16.108603 7344 UserTrace BIP6061I: Parser type ''XMLNSC'' created on behalf of node 'xslt.XSLTTranslationFlow.HTTP Input' to handle portion of incoming message of length '158' bytes beginning at offset '749'. Parser type selected based on value ''XMLNSC'' from previous parser.
2013-07-15 08:46:16.112452 7344 UserTrace BIP4451I: Style sheet Name specification '''' from LocalEnvironment (priority '2') was found.
The XSLTransform node tried to read the style sheet Name specification from LocalEnvironment, and received ''''. The specified priority for selecting LocalEnvironment style sheet Name is '2'.
No user action is required.
2013-07-15 08:46:16.112827 7344 UserTrace BIP4452I: Style sheet Name specification ''xslt/XalanFunctionsTemplateTest.xsl'' from Node Attribute (priority '3') was found.
The XSLTransform node tried to read the style sheet Name specification from Node Attribute, and received ''xslt/XalanFunctionsTemplateTest.xsl''. The specified priority for selecting Node Attribute style sheet Name is '3'.
No user action is required.
2013-07-15 08:46:16.113314 7344 UserTrace BIP4448I: Output CharSet specification '''' from Local Environment (priority '1') was found.
The XSLT node tried to read the Output CharSet specification from Local Environment and received ''''. The specified priority for selecting Local Environment Output CharSet is '1'.
No user action is required.
2013-07-15 08:46:16.113579 7344 UserTrace BIP4449I: Output CharSet specification '''' from Node Attribute (priority '2') was found.
The XSLT node tried to read Output CharSet specification from Node Attribute and received ''''. The specified priority for selecting Node Attribute Output CharSet is '2'.
No user action is required.
2013-07-15 08:46:16.113802 7344 UserTrace BIP4450I: No Output CharSet specification was found. Default Output CharSet ''1208'' will be used.
The XSLT node could not find any Output CharSet specification. Therefore the default Output CharSet ''1208'' will be used.
No user action is required.
2013-07-15 08:46:16.114885 7344 UserTrace BIP4440I: An XSLT transformation was requested. The XSLT node has invoked the eXMLT engine to perform a transformation of XML data. The supplied stylesheet name is ''xslt/XalanFunctionsTemplateTest.xsl''. The input data is ''<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Header/>
<soap:Body/>
</soap:Envelope>''.
No user action is required.
2013-07-15 08:46:16.116138 7344 UserTrace BIP4445I: The XSLT information message ''An embedded stylesheet was found:'' was reported by XSLT node ''XSL Transform''.
No user action is required.
2013-07-15 08:46:16.116734 7344 UserTrace BIP4445I: The XSLT information message ''The stylesheet derived from Node Attribute/Local Environment specification was found in the deployed storage: ./xslt/XalanFunctionsTemplateTest.xsl.'' was reported by XSLT node ''XSL Transform''.
No user action is required.
2013-07-15 08:46:16.119879 7344 UserTrace BIP4445I: The XSLT information message ''Creating XSL transformer using factory:org.apache.xalan.xsltc.trax.TransformerFactoryImpl@4d804d80'' was reported by XSLT node ''XSL Transform''.
No user action is required.
2013-07-15 08:46:16.127235 7344 UserTrace BIP4442E: An XSLT error ''XHNDLR_INTRNL_XSL_ERROR'' was reported by XSLT node ''XSL Transform''.
Inspect the error text to determine an appropriate action.
2013-07-15 08:46:16.127575 7344 UserTrace BIP4442E: An XSLT error ''XHNDLR_INTRNL_XSL_FATAL_ERROR'' was reported by XSLT node ''XSL Transform''.
Inspect the error text to determine an appropriate action.
2013-07-15 08:46:16.127892 7344 UserTrace BIP4442E: An XSLT error ''XHNDLR_INTRNL_XSL_EXC'' was reported by XSLT node ''XSL Transform''.
Inspect the error text to determine an appropriate action.
2013-07-15 08:46:16.128386 7344 UserTrace BIP4442E: An XSLT error '''' was reported by XSLT node ''Thread-12''.
Inspect the error text to determine an appropriate action.
2013-07-15 08:46:16.140690 7344 UserTrace BIP4442E: An XSLT error ''Error - Propagate to Failure Terminal'' was reported by XSLT node ''XSL Transform''.
Inspect the error text to determine an appropriate action.
2013-07-15 08:46:16.142294 7344 Error BIP3120E: Exception condition detected on input node 'xslt.XSLTTranslationFlow.HTTP Input'.
The input node 'xslt.XSLTTranslationFlow.HTTP Input' detected an error whilst processing a message. The message flow has been rolled-back and a fault message returned to the requesting client. Following messages will indicate the cause of this exception.
Check the error messages which follow to determine why the exception was generated, and take action as described by those messages.
2013-07-15 08:46:16.142305 7344 RecoverableException BIP2230E: Error detected whilst processing a message in node 'xslt.XSLTTranslationFlow.XSL Transform'.
The message broker detected an error whilst processing a message in node 'xslt.XSLTTranslationFlow.XSL Transform'. An exception has been thrown to cut short the processing of the message.
See the following messages for details of the error.
2013-07-15 08:46:16.142317 7344 RecoverableException BIP4447E: The XSLT node ''XSL Transform'' encountered a problem during the transformation. The error message is ''Transformation failure when processing Stylesheet deployed:./xslt/XalanFunctionsTemplateTest.xsl
javax.xml.transform.TransformerConfigurationException: No se ha podido compilar la hoja de estilos
at org.apache.xalan.xsltc.trax.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:866)
at com.ibm.xsl.exmlt.StylesheetCache.preprocessStylesheet(StylesheetCache.java:740)
at com.ibm.xsl.exmlt.StylesheetCache.getPreprocessedStylesheet(StylesheetCache.java:644)
at com.ibm.xsl.exmlt.StylesheetSelector.getTransformer(StylesheetSelector.java:372)
at com.ibm.xsl.exmlt.StylesheetSelector.performSelection(StylesheetSelector.java:677)
at com.ibm.xsl.exmlt.EnhancedXMLTransform.transformDocument(EnhancedXMLTransform.java:615)
at com.ibm.xsl.mqsi.XMLTransformData.transformData(XMLTransformData.java:547)
at com.ibm.xsl.mqsi.XMLTransformNode.evaluate(XMLTransformNode.java:958)
at com.ibm.broker.plugin.MbNode.evaluate(MbNode.java:1469)
''.
The transformation could not be completed.
Check the error message to identify the cause and correct the error.
Threads encountered in this trace:
7344 7440
|
Thanks in advance! |
|
Back to top |
|
 |
Urizen |
Posted: Wed Jul 17, 2013 9:55 am Post subject: |
|
|
Novice
Joined: 11 Jul 2013 Posts: 22
|
Hi again,
Does anybody knows how can I solve this issue?, any workaround?.
Is a bug in the Message Broker or am i doing something wrong?.
If someone is interested, I can upload the whole project inside a zip file.
Thanks. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Wed Jul 17, 2013 10:18 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
|
Back to top |
|
 |
Urizen |
Posted: Wed Jul 17, 2013 10:30 am Post subject: |
|
|
Novice
Joined: 11 Jul 2013 Posts: 22
|
Ok, Xalan it's not included in the supported standards list, but that doesn't solve my problem yet .
If I can use java native methods through Xalan extension functions in Broker, I also expect to use custom Java methods provided they are in the ExecutionGroup's classpath, am i wrong?.
Is there any standard or something that I can use to achieve this functionality using the XSLT Transform Node?.
Does anybody tried to do something like this?. |
|
Back to top |
|
 |
Urizen |
Posted: Wed Jul 24, 2013 6:14 am Post subject: |
|
|
Novice
Joined: 11 Jul 2013 Posts: 22
|
Greetings,
After a lot of try and error, I've found a solution to the problem.
Even Xalan is not included in the list of standars in the documentation, the same documentation says that the underlaying implementation of XSLT is done trough Xalan, so a user expects that it works correctly...
I think that, in the end, the problem is a bug or error (call it as you want) on Broker, it seems that putting the jar with the class in the bar is not enough to add it to the classpath of the execution, at least not when using the XSLT Transform Node.
If someone is interested in the solution, email me and I will send it to you. |
|
Back to top |
|
 |
Michael Dag |
Posted: Wed Jul 24, 2013 6:44 am Post subject: |
|
|
 Jedi Knight
Joined: 13 Jun 2002 Posts: 2607 Location: The Netherlands (Amsterdam)
|
why not simply post it here, so everyone can see it, now and in the future! _________________ Michael
MQSystems Facebook page |
|
Back to top |
|
 |
bhupinder |
Posted: Tue May 26, 2015 5:44 am Post subject: |
|
|
Novice
Joined: 25 Mar 2015 Posts: 19
|
Urizen wrote: |
If someone is interested in the solution, email me and I will send it to you. |
What is your email id? Also it will be better if you can post the solution here for the community. THANKS |
|
Back to top |
|
 |
mqjeff |
Posted: Tue May 26, 2015 5:54 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
bhupinder wrote: |
Urizen wrote: |
If someone is interested in the solution, email me and I will send it to you. |
What is your email id? Also it will be better if you can post the solution here for the community. THANKS |
Perhaps there will not be much of a response from a thread in 2013. |
|
Back to top |
|
 |
bhupinder |
Posted: Tue May 26, 2015 12:41 pm Post subject: |
|
|
Novice
Joined: 25 Mar 2015 Posts: 19
|
|
Back to top |
|
 |
richbct |
Posted: Tue Jul 05, 2016 7:24 pm Post subject: XALAN classpath under Websphere Message Broker |
|
|
Newbie
Joined: 05 Jul 2016 Posts: 1
|
Urizen wrote: |
Greetings,
After a lot of try and error, I've found a solution to the problem.
Even Xalan is not included in the list of standars in the documentation, the same documentation says that the underlaying implementation of XSLT is done trough Xalan, so a user expects that it works correctly...
I think that, in the end, the problem is a bug or error (call it as you want) on Broker, it seems that putting the jar with the class in the bar is not enough to add it to the classpath of the execution, at least not when using the XSLT Transform Node.
If someone is interested in the solution, email me and I will send it to you. |
Hi,
I am also having trouble calling my Java class from XSLT running under WMB. I'm not able to PM you as the post has been marked for PM as not allowed.
Would you be able to share your solution with me ?
Much appreciated
Richard |
|
Back to top |
|
 |
|