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 View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3882993#3882993 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3882993 ------------------------------------------------------- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click _______________________________________________ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user