-->
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: hibernate.cfg.xml parsing using weblogic
PostPosted: Tue Jul 26, 2005 1:55 pm 
Newbie

Joined: Fri Jul 15, 2005 9:30 am
Posts: 13
I am trying the example on Hibernate in Action and am getting parsing errors when I let Weblogic 8.1 access it thru a startup class. I cannot find solutions on google or forums.

Hibernate version: 3.0

The Error is:
13:15:13,800 INFO Configuration:1081 - Configuration resource: /hibernate.cfg.x
ml
13:15:13,847 DEBUG DTDEntityResolver:42 - trying to locate http://hibernate.sour
ceforge.net/hibernate-configuration-3.0.dtd in classpath under org/hibernate/
13:15:13,847 DEBUG DTDEntityResolver:53 - found http://hibernate.sourceforge.net
/hibernate-configuration-3.0.dtd in classpath
13:15:13,894 ERROR XMLHelper:59 - Error parsing XML: /hibernate.cfg.xml(22) The
content of element type "hibernate-configuration" must match "(session-factory,s
ecurity?)".
13:15:13,894 ERROR Configuration:1172 - problem parsing configuration/hibernate.
cfg.xml
org.hibernate.MappingException: invalid configuration
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1169)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1112)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1098)
at com.util.common.WLSStartup.doBind(WLSStartup.java:53)
at com.util.common.WLSStartup.startup(WLSStartup.java:27)
at weblogic.t3.srvr.StartupClassService.invokeStartup(StartupClassServic
e.java:177)
at weblogic.t3.srvr.StartupClassService.invokeClass(StartupClassService.
java:158)
at weblogic.t3.srvr.StartupClassService.access$000(StartupClassService.j
ava:36)
at weblogic.t3.srvr.StartupClassService$1.run(StartupClassService.java:1
21)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
121)
at weblogic.t3.srvr.StartupClassService.invokeStartupClass(StartupClassS
ervice.java:116)
at weblogic.t3.srvr.StartupClassService.addDeployment(StartupClassServic
e.java:88)
at weblogic.management.mbeans.custom.DeploymentTarget.addDeployment(Depl
oymentTarget.java:337)
at weblogic.management.mbeans.custom.DeploymentTarget.addDeployments(Dep
loymentTarget.java:597)
at weblogic.management.mbeans.custom.DeploymentTarget.updateServerDeploy
ments(DeploymentTarget.java:575)
at weblogic.management.mbeans.custom.DeploymentTarget.updateDeployments(
DeploymentTarget.java:241)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at weblogic.management.internal.DynamicMBeanImpl.invokeLocally(DynamicMB
eanImpl.java:754)
at weblogic.management.internal.DynamicMBeanImpl.invoke(DynamicMBeanImpl
.java:733)
at weblogic.management.internal.ConfigurationMBeanImpl.invoke(Configurat
ionMBeanImpl.java:509)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
60)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
28)
at weblogic.management.internal.RemoteMBeanServerImpl.private_invoke(Rem
oteMBeanServerImpl.java:988)
at weblogic.management.internal.RemoteMBeanServerImpl.invoke(RemoteMBean
ServerImpl.java:946)
at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:954)
at weblogic.management.internal.MBeanProxy.invokeForCachingStub(MBeanPro
xy.java:481)
at weblogic.management.configuration.ServerMBean_Stub.updateDeployments(
ServerMBean_Stub.java:7691)
at weblogic.management.deploy.slave.SlaveDeployer.updateServerDeployment
s(SlaveDeployer.java:1304)
at weblogic.management.deploy.slave.SlaveDeployer.resume(SlaveDeployer.j
ava:347)
at weblogic.management.deploy.DeploymentManagerServerLifeCycleImpl.resum
e(DeploymentManagerServerLifeCycleImpl.java:229)
at weblogic.t3.srvr.SubsystemManager.resume(SubsystemManager.java:131)
at weblogic.t3.srvr.T3Srvr.resume(T3Srvr.java:966)
at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:361)
at weblogic.Server.main(Server.java:32)
Caused by: org.xml.sax.SAXParseException: The content of element type "hibernate
-configuration" must match "(session-factory,security?)".
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Un
known 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.handleEndElement(Unknown S
ource)
at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(Unknown Source)

at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknow
n Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContent
Dispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Un
known 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:465)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1168)
... 37 more
startup -- Exception while binding Hibernate Object to Weblogic JNDI
org.hibernate.HibernateException: problem parsing configuration/hibernate.cfg.xm
l
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1173)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1112)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1098)
at com.util.common.WLSStartup.doBind(WLSStartup.java:53)
at com.util.common.WLSStartup.startup(WLSStartup.java:27)
at weblogic.t3.srvr.StartupClassService.invokeStartup(StartupClassServic
e.java:177)
at weblogic.t3.srvr.StartupClassService.invokeClass(StartupClassService.
java:158)
at weblogic.t3.srvr.StartupClassService.access$000(StartupClassService.j
ava:36)
at weblogic.t3.srvr.StartupClassService$1.run(StartupClassService.java:1
21)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
121)
at weblogic.t3.srvr.StartupClassService.invokeStartupClass(StartupClassS
ervice.java:116)
at weblogic.t3.srvr.StartupClassService.addDeployment(StartupClassServic
e.java:88)
at weblogic.management.mbeans.custom.DeploymentTarget.addDeployment(Depl
oymentTarget.java:337)
at weblogic.management.mbeans.custom.DeploymentTarget.addDeployments(Dep
loymentTarget.java:597)
at weblogic.management.mbeans.custom.DeploymentTarget.updateServerDeploy
ments(DeploymentTarget.java:575)
at weblogic.management.mbeans.custom.DeploymentTarget.updateDeployments(
DeploymentTarget.java:241)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at weblogic.management.internal.DynamicMBeanImpl.invokeLocally(DynamicMB
eanImpl.java:754)
at weblogic.management.internal.DynamicMBeanImpl.invoke(DynamicMBeanImpl
.java:733)
at weblogic.management.internal.ConfigurationMBeanImpl.invoke(Configurat
ionMBeanImpl.java:509)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
60)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
28)
at weblogic.management.internal.RemoteMBeanServerImpl.private_invoke(Rem
oteMBeanServerImpl.java:988)
at weblogic.management.internal.RemoteMBeanServerImpl.invoke(RemoteMBean
ServerImpl.java:946)
at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:954)
at weblogic.management.internal.MBeanProxy.invokeForCachingStub(MBeanPro
xy.java:481)
at weblogic.management.configuration.ServerMBean_Stub.updateDeployments(
ServerMBean_Stub.java:7691)
at weblogic.management.deploy.slave.SlaveDeployer.updateServerDeployment
s(SlaveDeployer.java:1304)
at weblogic.management.deploy.slave.SlaveDeployer.resume(SlaveDeployer.j
ava:347)
at weblogic.management.deploy.DeploymentManagerServerLifeCycleImpl.resum
e(DeploymentManagerServerLifeCycleImpl.java:229)
at weblogic.t3.srvr.SubsystemManager.resume(SubsystemManager.java:131)
at weblogic.t3.srvr.T3Srvr.resume(T3Srvr.java:966)
at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:361)
at weblogic.Server.main(Server.java:32)
Caused by: org.hibernate.MappingException: invalid configuration
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1169)
... 37 more
Caused by: org.xml.sax.SAXParseException: The content of element type "hibernate
-configuration" must match "(session-factory,security?)".
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Un
known 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.handleEndElement(Unknown S
ource)
at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(Unknown Source)

at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknow
n Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContent
Dispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Un
known 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:465)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1168)
... 37 more
initialContextFactory==>weblogic.jndi.WLInitialContextFactory
providerURL==>t3://localhost

hibernate.cfg.xml
-----------------------
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
<session-factory>

<!-- Don't forget to copy your JDBC driver to the lib/ directory! -->
<!-- Settings for a remote Oracle9/10g database.-->
<property name="dialect">org.hibernate.dialect.Oracle9Dialect</property>
<property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="connection.url">jdbc:oracle:thin:@localhost:1521:mitsh</property>
<property name="connection.username">mitsh</property>
<property name="connection.password">mitsh</property>


<!-- Print SQL to stdout. -->
<property name="show_sql">true</property>

<mapping resource="ll/sh/monitor/EmpLogin.hbm.xml"/>

</session-factory>

</hibernate-configuration>


Startup class logic is:
----------------------------
org.hibernate.SessionFactory ssn = new Configuration().configure().buildSessionFactory();


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 26, 2005 2:06 pm 
Regular
Regular

Joined: Thu May 26, 2005 2:08 pm
Posts: 99
My guess is that the copy of hibernate.cfg.xml that you're looking at isn't the same as the one that exists on your classpath. Open up your EAR/WAR file and make sure that the file is correct in there.


Top
 Profile  
 
 Post subject: hibernate.cfg.xml parsing using weblogic
PostPosted: Tue Jul 26, 2005 2:18 pm 
Newbie

Joined: Fri Jul 15, 2005 9:30 am
Posts: 13
You are so awesome....You were correct
Thanks!!!!


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.