-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: NoSuchMethodError: org.dom4j.io.SAXReader.setMergeAdjacen...
PostPosted: Thu Nov 27, 2003 5:40 pm 
Newbie

Joined: Thu Nov 27, 2003 5:27 pm
Posts: 10
I have pulled the last of my hair out. Something stupid and simple is preventing me from doing the most fundamental of things with Hibernate. I am using Eclipse, Tomcat, Hibernate 2.0.3, Struts, and Velocity. I keep failing, though, at Configuration.addClass()! I'm sure I'm doing something painfully stupid, but I can't see what it is. I suspect it has something to do with my hbm.xml file.

Here's the files:

User.hbm.xml:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
   "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
   "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>
    <class name="com.greymatter.experiment.User" table="user">
        <property name="email"/>
        <property name="fname"/>
        <id name="id">
            <generator class="identity"/>
        </id>

        <property name="lname"/>
        <property name="parentid"/>
        <property name="password"/>
    </class>

</hibernate-mapping>


User.java:
Code:
package com.greymatter.experiment;

import java.sql.Date;

public class User {

   private int id;
   private String email;
   private String fname;
   private String lname;
   private String username;
   private String password;
   private Date registered;
   private int parentid;
   
   public User() {}
   
   public String getEmail() {
      return email;
   }

   public String getFname() {
      return fname;
   }

   public int getId() {
      return id;
   }

   public String getLname() {
      return lname;
   }

   public int getParentid() {
      return parentid;
   }

   public String getPassword() {
      return password;
   }

   public Date getRegistered() {
      return registered;
   }

   public String getUsername() {
      return username;
   }

   public void setEmail(String string) {
      email = string;
   }

   public void setFname(String string) {
      fname = string;
   }

   public void setId(int i) {
      id = i;
   }

   public void setLname(String string) {
      lname = string;
   }

   public void setParentid(int i) {
      parentid = i;
   }

   public void setPassword(String string) {
      password = string;
   }

   public void setRegistered(Date date) {
      registered = date;
   }

   public void setUsername(String string) {
      username = string;
   }

}


Snippet from Struts action:
Code:
    // Hibernate session factory
   SessionFactory sessionFactory = null;
   
   
    public GreetingAction() {
       try {
         Configuration cfg = new Configuration();
         cfg.addClass(com.greymatter.experiment.User.class);
         sessionFactory = cfg.buildSessionFactory();
       } catch( Exception e ) {
          // :TODO:
       }
    }


Finally, here is the schema for this trival database:
Code:
CREATE TABLE `user` (
  `id` int(11) NOT NULL auto_increment,
  `email` varchar(60) NOT NULL default '',
  `firstName` varchar(15) default NULL,
  `lastName` varchar(20) default NULL,
  `username` varchar(15) NOT NULL default '',
  `password` varchar(15) NOT NULL default 'abcd1234',
  `registered` timestamp(14) NOT NULL,
  `parent` bigint(20) NOT NULL default '0',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `email` (`email`),
  UNIQUE KEY `username` (`username`),
  KEY `parent` (`parent`)
) TYPE=MyISAM


Even though it all seems so simple and straightforward, the call to cfg.addClass always causes the following stack trace:
Code:
HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Servlet execution threw an exception
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
   at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
   at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
   at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
   at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
   at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
   at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
   at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
   at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
   at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
   at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
   at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
   at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
   at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
   at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
   at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
   at java.lang.Thread.run(Thread.java:536)


root cause

java.lang.NoSuchMethodError: org.dom4j.io.SAXReader.setMergeAdjacentText(Z)V
   at net.sf.hibernate.util.XMLHelper.createSAXReader(XMLHelper.java:18)
   at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:252)
   at net.sf.hibernate.cfg.Configuration.addClass(Configuration.java:286)
   at sample.GreetingAction.(Unknown Source)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
   at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
   at java.lang.Class.newInstance0(Class.java:306)
   at java.lang.Class.newInstance(Class.java:259)
   at org.apache.struts.util.RequestUtils.applicationInstance(RequestUtils.java:231)
   at org.apache.struts.action.RequestProcessor.processActionCreate(RequestProcessor.java:326)
   at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:268)
   at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
   at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
   at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
   at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
   at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
   at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
   at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
   at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
   at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
   at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
   at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
   at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
   at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
   at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
   at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
   at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
   at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
   at java.lang.Thread.run(Thread.java:536)



--------------------------------------------------------------------------------

Apache Tomcat/4.1.24


I am guessing it has to do with column types or XML syntax. Can anybody end my suffering???

Thanks (and Happy Thanksgiving!),
Lee

_________________
http://www.URLinOne.com
http://www.AuctionRelay.com
http://www.OptionInsight.com


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 27, 2003 9:00 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
looks like you have an incompatible version of dom4j in your cp.


Top
 Profile  
 
 Post subject: Thank you!
PostPosted: Fri Nov 28, 2003 4:41 pm 
Newbie

Joined: Thu Nov 27, 2003 5:27 pm
Posts: 10
That was it! Yet another thing for me to be thankful for. :-)

Best wishes,
Lee

_________________
http://www.URLinOne.com
http://www.AuctionRelay.com
http://www.OptionInsight.com


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.