facebook

jboss and xerces problems [Closed]

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #231815 Reply

    kosl
    Member

    Dear All!

    I’m writing a business method of an entity bean which is supposed to read some informations from an XML file. I use the following code:

    To get the parser and the document:

    
    
                DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
                DocumentBuilder builder = factory.newDocumentBuilder();
                Document doc = builder.parse( xmlFile );
        
    

    Then to get the informations I use:

    
    
    NodeList nl =  doc.getElementsByTagName( tagName );
                int elemCount = nl.getLength();
                for( int i = 0; i < elemCount; i++ )
                {
                    Element element = ( Element )nl.item( i );
                    String test = element.getTextContent();
                   (...)
                }
    
        
    

    And I get the folowing exception:

    
    
    org.jboss.tm.JBossTransactionRolledbackException: Unexpected Error
    java.lang.NoSuchMethodError: org.w3c.dom.Node.getTextContent()Ljava/lang/String;
        at levia.messages.ejb.MessageTypeBean.requiredInformations(MessageTypeBean.java:345)
        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:585)
        
    
    

    The problem is that outside Jboss this works perfectly. So I guess the problems comes from the fact that jboss uses xerces itself and it configures diferently the parser or something like this…

    When I write :

    
    
                    Text tester = (Text) elem.getFirstChild();
                   String blalba = tester.getNodeValue();
        
    

    everything works well…. but still I would like to understand what is the couse of problems with the other solution.

    kind regards

    Karol

    PS: I use jboss 4.0 and xerces 2.6.2

    #231826 Reply

    Riyad Kalla
    Member

    Karol,
    Have you tried included your xerces JAR in your WEB-INF/lib directory of your project? JBoss’s classloader should pickup that version of Xer for you instead of using it’s own (maybe an older version like 2.5 that didn’t have that method).

    #231851 Reply

    ANuke
    Member

    I had a very similiar problem – but with Tomcat and not JBoss. I had to change the java that my project was pointing to. If you point to the new java version 1.5 then it works fine our project is using an older version of java – I had to create a new method that did the same thing as getTextContent does that returns the nodeValue which is the same as the textContent.

    #231951 Reply

    kosl
    Member

    Thanks,

    unfortunatelly none of your advices worked.

    Changing the jboss’es xerces jar’s to 2.7.0 has solved the problem.

    kind regards

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: jboss and xerces problems [Closed]

You must be logged in to post in the forum log in