Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / JavaBeans / July 2005

Tip: Looking for answers? Try searching our database.

jboss and xerces problems

Thread view: 
koslows@gmail.com - 28 Jun 2005 16:38 GMT
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:
Code:

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

Then to get the informations I use:

Code:

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:
Code:

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 :
Code:

               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
Marek Lange - 01 Jul 2005 07:58 GMT
> Dear All!
>
[quoted text clipped - 8 lines]
> problems comes from the fact that jboss uses xerces itself and it
> configures diferently the parser or something like this...

Problem is that JBoss seems to use another xerces version. This version
is loaded by the JBoss classloader. If you want to use your own, you
have to scope your deployment, this isolates your application from the
unified classloader. Look for "loader-repository" in the JBoss docs/wiki.

-marek


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.