tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthew Broadhead <matthew.broadh...@nbmlaw.co.uk.INVALID>
Subject Re: java.lang.ClassCastException: org.apache.xml.dtm.ref.DTMManagerDefault cannot be cast to org.apache.xml.dtm.DTMManager
Date Sat, 21 Jul 2018 17:50:01 GMT
i have created a reproducer at
https://github.com/chongma/xsltProblem

there are 2 directories
xslt704excluded
xslt704included

if you run from each
mvn clean package tomee:run

then navigate to
http://localhost:8080/rest/open/test1
http://localhost:8080/rest/open/test2

you can see in the output when it fails like
file:/home/matthew/git/xsltProblem/xslt704excluded/target/apache-tomee/webapps/ROOT/WEB-INF/classes/xslt/test2.xsl;

Line #7; Column #66; java.util.MissingResourceException: Can't find 
bundle for base name test.messages, locale en_GB

it only fails when excluding xalan and xml-apis

On 21/07/18 11:52, Matthew Broadhead wrote:
> hmmm...actually i have realised what the problem is now.
>
> before excluding xalan and xml-apis in XSLT i can load a bundle from 
> the classpath without problem.  for example
> <xsl:variable name="resources"
> select="java:util.ResourceBundle.getBundle('uk.me.kissy.document.messages')" 
> />
> <xsl:value-of select="java:getString($resources,'documentBuilder2')" />
>
> after excluding them from the classpath i get these errors
> file:/home/matthew/eclipse-workspaces/case-management/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/document/WEB-INF/classes/documentXslt/documentBuilder.xsl;

> Line #6; Column #82; java.util.MissingResourceException: Can't find 
> bundle for base name uk.me.kissy.document.messages, locale en_GB
> file:/home/matthew/eclipse-workspaces/case-management/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/document/WEB-INF/classes/documentXslt/documentBuilder.xsl;

> Line #122; Column #61; Unknown error in XPath.
> file:/home/matthew/eclipse-workspaces/case-management/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/document/WEB-INF/classes/documentXslt/documentBuilder.xsl;

> Line #54; Column #54; java.lang.NullPointerException
>
> i have tried manually setting the classLoader without any success
> TransformerFactory transformerfactory = TransformerFactory.newInstance(
> "org.apache.xalan.processor.TransformerFactoryImpl",
>                         this.getClass().getClassLoader());
>
> On 19/07/18 13:47, Jean-Louis Monteiro wrote:
>> Great!
>> Thanks for the follow up
>>
>> -- 
>> Jean-Louis Monteiro
>> http://twitter.com/jlouismonteiro
>> http://www.tomitribe.com
>>
>> On Wed, Jul 18, 2018 at 1:44 PM, Matthew Broadhead <
>> matthew.broadhead@nbmlaw.co.uk.invalid> wrote:
>>
>>> ok i fixed that.  it was just a null attribute causing the problem. so
>>> everything looks ok for now.  thanks for your help
>>>
>>>
>>> On 18/07/18 11:49, Matthew Broadhead wrote:
>>>
>>>> i have the problem now.  this is the exception i get if i exclude 
>>>> xalan
>>>> from fop.  i have no idea what might cause this
>>>>
>>>> javax.xml.transform.TransformerException: 
>>>> java.lang.ArrayIndexOutOfBoundsException:
>>>> 0 >= 0
>>>>      at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl
>>>> .transform(TransformerImpl.java:737)
>>>>      at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl
>>>> .transform(TransformerImpl.java:343)
>>>>      at uk.me.kissy.external.entityBeans.UtilityDao.getXMLParse(
>>>> UtilityDao.java:191)
>>>>      at uk.me.kissy.external.entityBeans.UtilityDao$$OwbNormalScopeP
>>>> roxy0.getXMLParse(uk/me/kissy/external/entityBeans/UtilityDao.java)
>>>>      at uk.me.kissy.document.dao.DocumentElementDao.getBodyPDF(Docum
>>>> entElementDao.java:395)
>>>>
>>>> On 17/07/18 19:35, Matthew Broadhead wrote:
>>>>
>>>>> i have upgraded from fop 2.2 to 2.3 and excluded xalan and xml-apis
>>>>> again.  it seems to be working ok at the moment on my development 
>>>>> machine.
>>>>> i will try again on production
>>>>>
>>>>> <dependency>
>>>>> <groupId>org.apache.xmlgraphics</groupId>
>>>>>              <artifactId>fop</artifactId>
>>>>>              <version>${fop.version}</version>
>>>>>              <exclusions>
>>>>>                  <exclusion>
>>>>>                      <groupId>xalan</groupId>
>>>>> <artifactId>xalan</artifactId>
>>>>>                  </exclusion>
>>>>>                  <exclusion>
>>>>> <groupId>xml-apis</groupId>
>>>>> <artifactId>xml-apis-ext</artifactId>
>>>>>                  </exclusion>
>>>>>                  <exclusion>
>>>>> <groupId>xml-apis</groupId>
>>>>> <artifactId>xml-apis</artifactId>
>>>>>                  </exclusion>
>>>>>              </exclusions>
>>>>>          </dependency>
>>>>> <dependency>
>>>>>              <groupId>org.docx4j</groupId>
>>>>>              <artifactId>docx4j</artifactId>
>>>>> <version>${docx4j.version}</version>
>>>>>              <exclusions>
>>>>>                  <exclusion>
>>>>>                      <groupId>xalan</groupId>
>>>>> <artifactId>xalan</artifactId>
>>>>>                  </exclusion>
>>>>>              </exclusions>
>>>>>          </dependency>
>>>>>
>>>>> On 17/07/18 12:46, Jean-Louis Monteiro wrote:
>>>>>
>>>>>> This usually indicates you have the same class loaded into 2 
>>>>>> different
>>>>>> classloaders which makes them different.
>>>>>> In this scenario, I would check if you don't have duplicate xalan

>>>>>> jars
>>>>>> in
>>>>>> tomee/lib and in the WEB-INF/lib of your application.
>>>>>>
>>>>>> Hope it helps
>>>>>>
>>>>>> -- 
>>>>>> Jean-Louis Monteiro
>>>>>> http://twitter.com/jlouismonteiro
>>>>>> http://www.tomitribe.com
>>>>>>
>>>>>> On Tue, Jul 17, 2018 at 2:06 AM, Matthew Broadhead <
>>>>>> matthew.broadhead@nbmlaw.co.uk.invalid> wrote:
>>>>>>
>>>>>> i have a couple of problems...
>>>>>>> i have not been able to upgrade from TomEE 7.0.3 to 7.0.4 or

>>>>>>> 7.0.5 due
>>>>>>> to
>>>>>>> the error (it works fine in 7.0.3)
>>>>>>> java.lang.ClassCastException: 
>>>>>>> org.apache.xml.dtm.ref.DTMManagerDefault
>>>>>>> cannot be cast to org.apache.xml.dtm.DTMManager
>>>>>>>
>>>>>>> which occurs when i run the following code for Apache FOP
>>>>>>> ClassLoader classLoader = Thread.currentThread().getCont
>>>>>>> extClassLoader();
>>>>>>> URL filepath = classLoader.getResource(xslPath);
>>>>>>> Reader xsl = new InputStreamReader(filepath.openStream());
>>>>>>> TransformerFactory transformerfactory = 
>>>>>>> TransformerFactory.newInstance
>>>>>>> ();
>>>>>>> StreamSource ssXsl = new StreamSource(xsl);
>>>>>>> Templates templates = transformerfactory.newTemplates(ssXsl);
>>>>>>> Transformer transformer = templates.newTransformer();
>>>>>>> StringReader reader = new StringReader(xml);
>>>>>>> StringWriter writer = new StringWriter();
>>>>>>> transformer.transform(new StreamSource(reader), new
>>>>>>> StreamResult(writer));
>>>>>>> out = writer.toString();
>>>>>>> writer.close();
>>>>>>> reader.close();
>>>>>>>
>>>>>>> My new problem is that I am using 7.0.5 in development and this

>>>>>>> code
>>>>>>> (using a CXF webClient) works perfectly.
>>>>>>> Collection<? extends Integer> leadids = 
>>>>>>> webClient.accept(MediaType.APP
>>>>>>> LICATION_JSON).getCollection(Integer.class);
>>>>>>> List<Integer> leadids_ = new ArrayList<>(leadids);
>>>>>>>
>>>>>>> But when I deployed it to 7.0.3 it does not work.  Is there
any 
>>>>>>> way to
>>>>>>> slurp some JSON formatted like this
>>>>>>> [1,2,3,4]
>>>>>>>
>>>>>>> I tried creating a wrapper like below but it didn't match
>>>>>>> public class listWrapper {
>>>>>>>       private List<Integer> list;
>>>>>>>       // ...
>>>>>>> }
>>>>>>>
>>>>>>>
>


Mime
View raw message