Forgot the attachment :P -----Mensagem original----- De: Tony Calleri França [mailto:[EMAIL PROTECTED] Enviada em: sexta-feira, 25 de junho de 2004 16:37 Para: [EMAIL PROTECTED] Assunto: RES: [Hibernate] Help! (ignore DTD consisntency check)
> Can't I don´t believe you :-) > and this is good I disagree :-) I'd rather use a browser (but this is me :) > Use Xerces (or any Entity resolver compliant parser), it will transparently look into hibernate2.jar for the dtd before looking the web. Thank you very much, but After spending all day trying to make jboss use the correct XML API (xerces) instead of trying to connect to sourceforge to read my config file, I decided not to validate it anyway. Here´s the code if anyone needs to do the same (attached) (So, Hibernate guys, on future version please dont make net.sf.hibernate.cfg.Configuration or any of its methods final ok? :-)) And I just had to replace the initialization code --------------------------- old -------------------------- public static void initialize (String configFileName) throws HibernateException { if (null == configFileName && sessionFactoryMap.size() > 0) return; else if (null != sessionFactoryMap.get(configFileName)) return; else { net.sf.hibernate.cfg.Configuration cfg = new Configuration(); if (null == configFileName) cfg.configure(); else cfg.configure(configFileName); setSessionFactory(configFileName, cfg.buildSessionFactory()); } } -------------------------- old ends ---------------------- By --------------------------- new -------------------------- public static void initialize (String configFileName) throws HibernateException { if (null == configFileName && sessionFactoryMap.size() > 0) return; else if (null != sessionFactoryMap.get(configFileName)) return; else { util.MyConfiguration cfg = new MyConfiguration(); if (null == configFileName) cfg.configure(); else cfg.configure(configFileName); setSessionFactory(configFileName, cfg.buildSessionFactory()); } } -------------------------- new ends ---------------------- > PS : use the user forum for such questions Yeah, sorry, it was in the FAQ, actually :} []´s Tony Lumpda -----Mensagem original----- De: Emmanuel Bernard [mailto:[EMAIL PROTECTED] Enviada em: sexta-feira, 25 de junho de 2004 03:43 Para: Tony Calleri França Cc: [EMAIL PROTECTED] Assunto: Re: [Hibernate] Help! (ignore DTD consisntency check) Can't and this is good (to prevent wrong mapping failing lately at runtime). Use Xerces (or any Entity resolver compliant parser), it will transparently look into hibernate2.jar for the dtd before looking the web. PS : use the user forum for such questions Tony Calleri França wrote: >Hi, I´m trying to make an EJB (session) use Hibernate to list some >entities from a database, but DTD validation is really annoying. I´m >using Jboss 3.2.3, and I´m deploying the EJB Module as a jar file. > >I tried 3 things and had a different error in each case. > xml #1: >========= hibernate.cfg.xml ============= ><?xml version='1.0' encoding='utf-8'?> ><!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate >Configuration DTD//EN" >"http://hibernate.sourceforge.net/hibernate-configuration.dtd"> ><hibernate-configuration> > <session-factory> > (...) >========================================== > Failure #1: >========================================== >org.dom4j.DocumentException: hibernate.sourceforge.net Nested >exception: hibernate.sourceforge.net > at org.dom4j.io.SAXReader.read(SAXReader.java:358) > (...) >Nested exception: >java.net.UnknownHostException: hibernate.sourceforge.net >========================================== > >So I thought that Depending on finding hibernate.sourceforge.net to >make my application run would be the last thing I wanted, so i tried > xml#2 >========= hibernate.cfg.xml ============= <hibernate-configuration> > <session-factory> > (...) >========================================== > Failure #2: >========================================== >net.sf.hibernate.MappingException: invalid configuration >Caused by: org.xml.sax.SAXParseException: Document root element >"hibernate-configuration", must match DOCTYPE root "null". >========================================== > >So I downloaded the DTD, placed on the jar file at the same level of >hibernate.cfg.xml and tried > xml #3 >========= hibernate.cfg.xml ============= ><?xml version='1.0' encoding='utf-8'?> ><!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate >Configuration DTD//EN" "hibernate-configuration.dtd"> ><hibernate-configuration> > <session-factory> > (...) >========================================== > Failure #3: >========================================== >org.dom4j.DocumentException: E:\jboss-3.2.3\bin\hibernate-configuration.dtd >Nested exception: E:\jboss-3.2.3\bin\hibernate-configuration.dtd >Nested exception: >java.io.FileNotFoundException: >E:\jboss-3.2.3\bin\hibernate-configuration.dtd >========================================== > >And I *really* wouldn´t like to have to place a dtd file in >E:\jboss-3.2.3\bin. What can I do to make DOM ignore DTD consistency >check when parsing hibernate.cfg.xml? > >Tanx in advance >Tony Lumpda > > > ------------------------------------------------------- This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com _______________________________________________ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel
MyXMLHelper.java
Description: Binary data
MyConfiguration.java
Description: Binary data