-->
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.  [ 6 posts ] 
Author Message
 Post subject: XML Mapping of <key-property>
PostPosted: Sat Mar 25, 2006 6:02 am 
Newbie

Joined: Mon Mar 20, 2006 8:42 am
Posts: 11
I have mapped simple Composite id and am getting the following exception. Any idea whats wrong and where???

Hibernate version:
3.0

Mapping documents:
<composite-id>
<key-property node="customerId" name="customerId" column= "CustomerID" type="java.lang.String"/>
<key-property node="locationId" name="locationId" column="LocationID" type="java.lang.String"/>
</composite-id>

Full stack trace of any exception that occurs:

15:02:58,813 INFO [TilesRequestProcessor] Tiles definition factory found for request processor ''.
15:02:59,063 INFO [Environment] Hibernate 3.0
15:02:59,094 INFO [Environment] hibernate.properties not found
15:02:59,094 INFO [Environment] using CGLIB reflection optimizer
15:02:59,094 INFO [Environment] using JDK 1.4 java.sql.Timestamp handling
15:02:59,469 INFO [Configuration] configuring from resource: /hibernate.cfg.xml
15:02:59,469 INFO [Configuration] Configuration resource: /hibernate.cfg.xml
15:02:59,907 INFO [Configuration] Mapping resource: xmlCustomer.hbm.xml
15:03:00,219 INFO [HbmBinder] Mapping class: com.sbs.salesstrat.xml.info.XmlCustomerInfo -> Customer
15:03:00,407 INFO [Configuration] Mapping resource: xmlContact.hbm.xml
15:03:00,469 INFO [HbmBinder] Mapping class: com.sbs.salesstrat.xml.info.XmlContactInfo -> Contact
15:03:00,485 INFO [Configuration] Mapping resource: xmlDivPlant.hbm.xml
15:03:00,625 ERROR [XMLHelper] Error parsing XML: XML InputStream(9) Attribute "node" must be declared for element type "key-property".
15:03:00,641 ERROR [XMLHelper] Error parsing XML: XML InputStream(10) Attribute "node" must be declared for element type "key-property".
15:03:00,657 INFO [STDOUT] %%%% Error Creating SessionFactory %%%%
15:03:00,657 INFO [STDOUT] org.hibernate.MappingException: Error reading resource: xmlDivPlant.hbm.xml
at org.hibernate.cfg.Configuration.addResource(Configuration.java:448)
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1312)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1284)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1266)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1233)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1161)
at com.sbs.salesstrat.common.data.HibernateSessionFactory.currentSession(HibernateSessionFactory.java:32)
at com.sbs.salesstrat.common.data.AppuserDS.get(AppuserDS.java:19)
at com.sbs.salesstrat.common.business.AppuserBS.authenticate(AppuserBS.java:18)
at com.sbs.salesstrat.common.web.action.LoginAction.login(LoginAction.java:31)
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:324)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:274)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:194)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Thread.java:534)
Caused by: org.hibernate.MappingException: invalid mapping
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:395)
at org.hibernate.cfg.Configuration.addResource(Configuration.java:445)
... 40 more
Caused by: org.xml.sax.SAXParseException: Attribute "node" must be declared for element type "key-property".
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.addDTDDefaultAttrsAndValidate(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.emptyElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.dom4j.io.SAXReader.read(SAXReader.java:334)
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:394)
... 41 more
15:03:00,672 INFO [STDOUT] this is the main exception java.lang.Exception: AppuserBS.authenticate().null
15:03:00,672 INFO [STDOUT] in the exception function33


Name and version of the database you are using:
MySql 5.0

_________________
Aisha


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 26, 2006 9:03 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
Why, that would be
Exception trace wrote:
Caused by: org.xml.sax.SAXParseException: Attribute "node" must be declared for element type "key-property".

To paraphrase: key-property doesn't have a "node" attribute. Remove it.


Top
 Profile  
 
 Post subject: problem not solved
PostPosted: Tue Mar 28, 2006 4:33 am 
Newbie

Joined: Mon Mar 20, 2006 8:42 am
Posts: 11
Pardon...

key-property does have a "node" attribute. the same mapping works fine in one project and in the other it gives this error :(

_________________
Aisha


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 28, 2006 6:01 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
Not according to your exception, it doesn't. Is your mapping file referring to a 2.0 DTD instead of a 3.0 DTD? Your file can't be parsed because you're giving it the wrong instructions.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 29, 2006 1:09 am 
Newbie

Joined: Mon Mar 20, 2006 8:42 am
Posts: 11
Well unfortunately the mapping file is refering to the 3.0 DTD


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

<hibernate-mapping package="com.sbs.salesstrat.xml.info">

   <class name="XmlDivPlantInfo" table="CustomerLocation" node="XmlDivPlantInfo">

    <composite-id node="id">
       <key-property name="customerId" column="CustomerID" type="java.lang.String" />
       <key-property name="locationId" column="LocationID" type="java.lang.String" />
     </composite-id>

     ...
     ...

_________________
Aisha


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 29, 2006 1:29 am 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
Then all I can suggest is that you track down the DTD being used (it'll be in hibernate3.jar, org/hibernate/hibernate-mapping-3.0.dtd) and verify that ELEMENT key-property has a matching ATTLIST for node. If it doesn't, replace the jar with the correct one. If it does, all I can think of is that your classpath contains a different jar somewhere, and you're loading the wrong one.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 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.