Problem parsing configuration/hibernate.cfg.xml

I am trying to integrate struts with hibernate. I have created a plug-in for that and copied all the necessary jars & xmls to the classpath. I am providing the full stack trace, can any one say what could be the problem
net.sf.hibernate.HibernateException: problem parsing configuration/hibernate.cfg
.xml
at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:963
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:902)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:888)
at com.plugin.HibernatePlugIn.initHibernate(HibernatePlugIn.java:72)
at com.plugin.HibernatePlugIn.init(HibernatePlugIn.java:54)
at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServle
t.java:869)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:336)
at javax.servlet.GenericServlet.init(GenericServlet.java:211)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.
java:1029)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:86
2)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContex
t.java:4013)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4
357)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
.java:823)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:80
7)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)
at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDep
loyer.java:277)
at org.apache.catalina.core.StandardHost.install(StandardHost.java:832)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:625
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:431
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:983)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java
:349)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1091)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:789)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478
at org.apache.catalina.core.StandardService.start(StandardService.java:4
80)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:231
3)
at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
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 org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425)
Caused by: org.dom4j.DocumentException: hibernate.sourceforge.net Nested excepti
on: hibernate.sourceforge.net
at org.dom4j.io.SAXReader.read(SAXReader.java:358)
at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:958
)

Looks like a problem with Hibernate itself parsing the config file?
Here's a posting from the Hibernate forum that sounds similar:
http://forums.hibernate.org/viewtopic.php?p=2256871&highlight=&sid=e1090f717891db4535310102c61bec25
-steve-

Similar Messages

  • Problem in placing hibernate.cfg.xml

    Hi,
      I have written one ejb project with hibernate in my net weaver.Now i have a problem in placing hibernate.cfg.xml.so tell me where to place it .Give some examples related to that and some related links.

    Hi,
    you can place it into the root of the EJB project as your EJBs probably access Hibernate as persistence layer. In this case make sure that you pass the string "hibernate.cfg.xml" within the method invocation when retrieving a SessionFactory as follows:
    try
    Configuration cfg = new Configuration();
    sessionFactory = cfg.configure 
         ("hibernate.cfg.xml").buildSessionFactory();
    catch (Throwable ex)
    Otherwise the Configuration file may not be found by the application class loader due to different path syntax.
    For further information you can refer to this https://www.sdn.sap.com/irj/sdn/developerareas/java?rid=/webcontent/uuid/e081a4b6-0801-0010-7fa4-c3c7a0454815#hibernate [original link is broken] [original link is broken], although the hibernate.cfg.xml file is placed in the Web-Project in this example.
    Hope this helps,
    Best regards,
    Robin

  • Web Dynpro: Where put hibernate hibernate.cfg.xml?

    I have seen several people asking about the place to put the config file of Hibernate, but not any conclusive answer until now...
       I created a external library in WAS (I verified using Visual Admin that the lib was correctly deployed). In my Web Dynpro References -> Library Reference I add the library in the format Provider Name/Library Name: "sap.com/hiblibs"
    <b>  Where can I store the hibernate.cfg.xml?</b> I have tried put it in all web dynpro folders!
    Thanks,
    Ivan Garcia
    From Brazil
    <b>  This is my source code:</b> 
      Configuration cfg = new Configuration();
      cfg.configure("hibernate.conf.xml");
    <b>  The error:</b>
      org.hibernate.HibernateException: hibernate.conf.xml not found
        at org.hibernate.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:147)
        at org.hibernate.cfg.Configuration.getConfigurationInputStream(Configuration.java:1402)
        at org.hibernate.cfg.Configuration.configure(Configuration.java:1424)
    I have read all  forum topics about this, including:
    Where to put config files in webdynpro ?
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/bf0d57db-0c01-0010-6fa3-83503981eed4
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/2ae0614a-0601-0010-a491-a9a635f06613
    Problem in placing hibernate.cfg.xml
    /people/bala.krishnan2/blog/2006/09/25/bid-adieu-to-bots--using-captchas
    /people/valery.silaev/blog/2005/09/14/a-bit-of-impractical-scripting-for-web-dynpro
    How to add external jar in web dynpro without going for DC
    Web Dynpro References
    Using External Library in Web Dynpro - Error
    Deploy external jar to WAS 6.40

    Hi Ivan,
    you need to make sure you place the configuration file where the application server's class loader will find it. If you are running Web Dynpros (or any other web application), you may put it under WEB-INF/classes of your web module.
    You may have J2EE applications without any web components - for example if you intend to only provide business logic for web services or rich clients. In this case you may not have any web modules, but will probably have some kind of EJB jars or such. The Hibernate POJOs are a more natural part of such jars rather then WARs (web modules). In this case you can put them under the root of this JAR. The class loader of the SAP J2EE Engine will load any property file placed in the class path of the class loader - whether it's a flat text file or an xml file. WEB-INF/classes or WEB-INF/lib is always in the class path of the (application) class loader.
    There is one thing you have to be aware of though. I do not know which version of Hibernate you are working with, but if you look at the source code of hibernate (the binaries are in the hibernate.jar) you will see that, the method Configuration.configure() without any argument will try to load the hibernate.cfg.xml from the current path - which means, the hibernate.jar and the hibernate.cfg.xml will have to reside under the same folder. But you do not seem to do this, so it is OK. This applies to versions of the NetWeaver 6.40 or 6.40s. Most likely this also applies to the new JEE 5 preview version of the NetWeaver application server also available for download on SDN, since to my knowledge the class loadign concepts have not been changed. But I have not tested this yet.
    Beyond the How-To-Guide about running Hibernate on NetWeaver (or SAP J2EE Engine) 6.40 we have also provided a sample application and its source code as IDE projects. Take a look at them and you will find the hibernate.cfg.xml file in the deployable EAR.
    I hope this answers your question and my comment has been helpful to you.
    Cheers, Goran

  • Hibernate.cfg.xml configuration

    Hi
      I have written hibernate.cfg.xml ,for connecting to the
    data base i am using data sources concept.
      I have one property in hibernate.cfg.xml
      <property name="connection.datasource">.......</property>
      Can any tell how to give the datasource name in the property tag.
      My Data source is residing in another system
    I am using MAXDB as backend
    thanks and regards
    Satyam

    Hi Satyam,
    Check <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/bf0d57db-0c01-0010-6fa3-83503981eed4">Run Hibernate on the SAP J2EE Platform</a>
    Best regards, Maksim Rashchynski.

  • Guys why is Coherence asking for hibernate.cfg.xml file ???

    Wondering why Coherence could not read/interpret from our hibernate mapping file and ask for hibernate.cfg.xml.
    Wondering if Coherence has been configured to require hibernate.cfg.xml.
    Here is the error i get while running JUnit test
    2009-11-10 11:01:31.302/42.589 Oracle Coherence GE 3.5.1/461p2 <Error> (thread=DistributedCache, member=1): BackingMapManager com.tangosol.net.DefaultConfigurableCacheFactory$Manager: failed to instantiate a cache: com.comcast.customer.contract.contract.hibernate.Contract
    2009-11-10 11:01:31.302/42.589 Oracle Coherence GE 3.5.1/461p2 <Error> (thread=DistributedCache, member=1):
    (Wrapped: Failed to instantiate class "com.tangosol.coherence.hibernate.HibernateCacheStore" using sun.misc.Launcher$AppClassLoader@1ab634
    <class-scheme>
      <class-name>com.tangosol.coherence.hibernate.HibernateCacheStore</class-name>
      <init-params>
        <init-param>
          <param-type>java.lang.String</param-type>
          <param-value>com.comcast.customer.contract.contract.hibernate.Contract</param-value>
        </init-param>
      </init-params>
    </class-scheme>) java.lang.reflect.InvocationTargetException
         at com.tangosol.util.Base.ensureRuntimeException(Base.java:293)
         at com.tangosol.run.xml.XmlHelper.createInstance(XmlHelper.java:2307)
         at com.tangosol.net.DefaultConfigurableCacheFactory.instantiateAny(DefaultConfigurableCacheFactory.java:2959)
         at com.tangosol.net.DefaultConfigurableCacheFactory.instantiateCacheStore(DefaultConfigurableCacheFactory.java:2822)
         at com.tangosol.net.DefaultConfigurableCacheFactory.instantiateReadWriteBackingMap(DefaultConfigurableCacheFactory.java:1458)
         at com.tangosol.net.DefaultConfigurableCacheFactory.configureBackingMap(DefaultConfigurableCacheFactory.java:1223)
         at com.tangosol.net.DefaultConfigurableCacheFactory$Manager.instantiateBackingMap(DefaultConfigurableCacheFactory.java:3457)
         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache$Storage.instantiateResourceMap(DistributedCache.CDB:22)
         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache$Storage.setCacheName(DistributedCache.CDB:27)
         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache$ConfigListener.entryInserted(DistributedCache.CDB:15)
         at com.tangosol.util.MapEvent.dispatch(MapEvent.java:206)
         at com.tangosol.util.MapEvent.dispatch(MapEvent.java:166)
         at com.tangosol.util.MapListenerSupport.fireEvent(MapListenerSupport.java:556)
         at com.tangosol.util.ObservableHashMap.dispatchEvent(ObservableHashMap.java:229)
         at com.tangosol.util.ObservableHashMap$Entry.onAdd(ObservableHashMap.java:270)
         at com.tangosol.util.SafeHashMap.put(SafeHashMap.java:244)
         at com.tangosol.coherence.component.util.collections.WrapperMap.put(WrapperMap.CDB:1)
         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid$ServiceConfigMap.put(Grid.CDB:31)
         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache$StorageIdRequest.onReceived(DistributedCache.CDB:45)
         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.onMessage(Grid.CDB:9)
         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.onNotify(Grid.CDB:136)
         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache.onNotify(DistributedCache.CDB:3)
         at com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:42)
         at java.lang.Thread.run(Thread.java:595)
    Caused by: java.lang.reflect.InvocationTargetException
         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:494)
         at com.tangosol.util.ClassHelper.newInstance(ClassHelper.java:662)
         at com.tangosol.run.xml.XmlHelper.createInstance(XmlHelper.java:2297)
         ... 22 more
    Caused by: org.hibernate.HibernateException: /hibernate.cfg.xml not found
         at org.hibernate.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:147)
         at org.hibernate.cfg.Configuration.getConfigurationInputStream(Configuration.java:1405)
         at org.hibernate.cfg.Configuration.configure(Configuration.java:1427)
         at org.hibernate.cfg.Configuration.configure(Configuration.java:1414)
         at com.tangosol.coherence.hibernate.HibernateCacheLoader.<init>(HibernateCacheLoader.java:72)
         at com.tangosol.coherence.hibernate.HibernateCacheStore.<init>(HibernateCacheStore.java:48)
         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:494)
         at com.tangosol.util.ClassHelper.newInstance(ClassHelper.java:662)
         at com.tangosol.run.xml.XmlHelper.createInstance(XmlHelper.java:2297)
         at com.tangosol.net.DefaultConfigurableCacheFactory.instantiateAny(DefaultConfigurableCacheFactory.java:2959)
         at com.tangosol.net.DefaultConfigurableCacheFactory.instantiateCacheStore(DefaultConfigurableCacheFactory.java:2822)
         at com.tangosol.net.DefaultConfigurableCacheFactory.instantiateReadWriteBackingMap(DefaultConfigurableCacheFactory.java:1458)
         at com.tangosol.net.DefaultConfigurableCacheFactory.configureBackingMap(DefaultConfigurableCacheFactory.java:1223)
         at com.tangosol.net.DefaultConfigurableCacheFactory$Manager.instantiateBackingMap(DefaultConfigurableCacheFactory.java:3457)
         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache$Storage.instantiateResourceMap(DistributedCache.CDB:22)
         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache$Storage.setCacheName(DistributedCache.CDB:27)
         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache$ConfigListener.entryInserted(DistributedCache.CDB:15)
         at com.tangosol.util.MapEvent.dispatch(MapEvent.java:206)
         at com.tangosol.util.MapEvent.dispatch(MapEvent.java:166)
         at com.tangosol.util.MapListenerSupport.fireEvent(MapListenerSupport.java:556)
         at com.tangosol.util.ObservableHashMap.dispatchEvent(ObservableHashMap.java:229)
         at com.tangosol.util.ObservableHashMap$Entry.onAdd(ObservableHashMap.java:270)
         at com.tangosol.util.SafeHashMap.put(SafeHashMap.java:244)
         at com.tangosol.coherence.component.util.collections.WrapperMap.put(WrapperMap.CDB:1)
         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid$ServiceConfigMap.put(Grid.CDB:31)
         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache$StorageIdRequest.onReceived(DistributedCache.CDB:45)
         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.onMessage(Grid.CDB:9)

    Hi Tom/Rob,
    Thanks for quick response. As suggested i have added another <init-param> so that HibernateCacheStore picks up my configuration file instead of hibernate.cfg.xml
    Here is the exception
    - Error parsing XML: application-context.xml(6) Document is invalid: no grammar found.
    - Error parsing XML: application-context.xml(6) Document root element "beans", must match DOCTYPE root "null".
    - configuring from resource: application-context.xml
    - Configuration resource: application-context.xml
    - Error parsing XML: application-context.xml(6) Document is invalid: no grammar found.
    - Error parsing XML: application-context.xml(6) Document root element "beans", must match DOCTYPE root "null".
    2009-11-10 13:38:39.254/45.068 Oracle Coherence GE 3.5.1/461p2 <Error> (thread=DistributedCache, member=1): BackingMapManager com.tangosol.net.DefaultConfigurableCacheFactory$Manager: failed to instantiate a cache: com.comcast.customer.contract.contract.hibernate.Contract
    2009-11-10 13:38:39.254/45.068 Oracle Coherence GE 3.5.1/461p2 <Error> (thread=DistributedCache, member=1):
    (Wrapped: Failed to instantiate class "com.tangosol.coherence.hibernate.HibernateCacheStore" using sun.misc.Launcher$AppClassLoader@18b634
    <class-scheme>
      <class-name>com.tangosol.coherence.hibernate.HibernateCacheStore</class-name>
      <init-params>
        <init-param>
          <param-type>java.lang.String</param-type>
          <param-value>com.comcast.customer.contract.contract.hibernate.Contract</param-value>
        </init-param>
        <init-param>
          <param-type>java.lang.String</param-type>
          <param-value>application-context.xml</param-value>
        </init-param>
      </init-params>
    </class-scheme>) java.lang.reflect.InvocationTargetException
         at com.tangosol.util.Base.ensureRuntimeException(Base.java:293)
         at com.tangosol.run.xml.XmlHelper.createInstance(XmlHelper.java:2307)
         at com.tangosol.net.DefaultConfigurableCacheFactory.instantiateAny(DefaultConfigurableCacheFactory.java:2959)
         at com.tangosol.net.DefaultConfigurableCacheFactory.instantiateCacheStore(DefaultConfigurableCacheFactory.java:2822)
         at com.tangosol.net.DefaultConfigurableCacheFactory.instantiateReadWriteBackingMap(DefaultConfigurableCacheFactory.java:1458)
         at com.tangosol.net.DefaultConfigurableCacheFactory.configureBackingMap(DefaultConfigurableCacheFactory.java:1223)
         at com.tangosol.net.DefaultConfigurableCacheFactory$Manager.instantiateBackingMap(DefaultConfigurableCacheFactory.java:3457)
         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache$Storage.instantiateResourceMap(DistributedCache.CDB:22)
         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache$Storage.setCacheName(DistributedCache.CDB:27)
         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache$ConfigListener.entryInserted(DistributedCache.CDB:15)
         at com.tangosol.util.MapEvent.dispatch(MapEvent.java:206)
         at com.tangosol.util.MapEvent.dispatch(MapEvent.java:166)
         at com.tangosol.util.MapListenerSupport.fireEvent(MapListenerSupport.java:556)
         at com.tangosol.util.ObservableHashMap.dispatchEvent(ObservableHashMap.java:229)
         at com.tangosol.util.ObservableHashMap$Entry.onAdd(ObservableHashMap.java:270)
         at com.tangosol.util.SafeHashMap.put(SafeHashMap.java:244)
         at com.tangosol.coherence.component.util.collections.WrapperMap.put(WrapperMap.CDB:1)
         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid$ServiceConfigMap.put(Grid.CDB:31)
         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache$StorageIdRequest.onReceived(DistributedCache.CDB:45)
         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.onMessage(Grid.CDB:9)
         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.onNotify(Grid.CDB:136)
         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache.onNotify(DistributedCache.CDB:3)
         at com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:42)
         at java.lang.Thread.run(Thread.java:595)
    Caused by: java.lang.reflect.InvocationTargetException
         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:494)
         at com.tangosol.util.ClassHelper.newInstance(ClassHelper.java:662)
         at com.tangosol.run.xml.XmlHelper.createInstance(XmlHelper.java:2297)
         ... 22 more
    Caused by: org.hibernate.MappingException: invalid configuration
         at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1487)
         at org.hibernate.cfg.Configuration.configure(Configuration.java:1428)
         at com.tangosol.coherence.hibernate.HibernateCacheLoader.<init>(HibernateCacheLoader.java:94)
         at com.tangosol.coherence.hibernate.HibernateCacheStore.<init>(HibernateCacheStore.java:62)
         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:494)
         at com.tangosol.util.ClassHelper.newInstance(ClassHelper.java:662)
         at com.tangosol.run.xml.XmlHelper.createInstance(XmlHelper.java:2297)Please note the addition of
    <init-param>
          <param-type>java.lang.String</param-type>
          <param-value>application-context.xml</param-value>
        </init-param>application-context.xml - is for Spring application context
    META-INF/spring.xml - is for root hibernate configuration File .
    So in the above code snippet i tried replacing"application-context.xml " with "spring.xml" or "META-INF/spring.xml " or "classspath*:META-INF/spring.xml " anything results in the above exception

  • Hibernate+10gAS: hibernate.cfg.xml not found in classpath

    Hi
    We are using Hibernate. It requieres a configuration file (hibernate.cfg.xml) to be present
    somewhere in the classpath. That works when running the application in the IDE (JDeveloper
    10g), keeping the file in the WEBINF directory. However, when we deploy the application in 10g
    App Server, the file is not found. We have tried storing it everywhere in the class path, but
    no mather were we put it, it is not found.
    Any clues?
    TIA,
    Brian

    try asking this on the OC4J forum:
    OC4J

  • Why Coherence mandates to name the file as hibernate.cfg.xml ???

    Wondering Why Coherence mandates to name the file as hibernate.cfg.xml , otherwise it wouldn't work
    We use Spring 2.5, Hibernate 3.2, Coherence 3.5
    •     Currently we have created hibernate.cfg.xml to make coherence work whereas we would like to leverage existing spring configuration file
    •     We wrote separate DAO’s i.e. xxxCoherenceDAO in addition to exsisting DAO’s. We would like to inject NamedCache into **CoherenceDAO
    • How to leverage Spring to start the CacheFactory i.e. we would like to avoid the following code in our XXXCoherenceDAO's
    NameCache customerCache = CacheFactory.getCache(com.xx.Customer.class.getName());

    Take a look at the [JavaDoc for HibernateCacheLoader|http://download.oracle.com/otn_hosted_doc/coherence/352/com/tangosol/coherence/hibernate/HibernateCacheLoader.html]. It has several constructors that allow you to either provide the name of the Hibernate configuration or provide a SessionFactory created externally.
    Thanks,
    Patrick

  • Where to place hibernate.cfg.xml in case of a Ear Project

    Hi
    i am trying to use Hibernate inside EJB 3.0 Bean
    When trying to access , EJB from my servlet , i am getting this Exception :
    javax.ejb.EJBException: EJB Exception: ; nested exception is:
    *     java.lang.NoClassDefFoundError: org/hibernate/Session; nested exception is: java.rmi.RemoteException: EJB Exception: ; nested exception is:*
    *     java.lang.NoClassDefFoundError: org/hibernate/Session*
    By reading previous forums i made some modifications , but still it is not working .
    Please tell me where exactly i should place hibernate.cfg.xml ??
    Whether inside the EJB Module or inside the Ear ??

    the hibernate.cfg.xml needs to be in the root of the classpath. This means that if it ends up in the root of your EJB jar, it should be found.

  • Trouble configuring hibernate assembler

    good day,
         I'm trying to configure a hibernate assembler using the lcds 4.5 beta, When I start lcds I get the following error message:
    Caused by: org.hibernate.MappingException: An AnnotationConfiguration instance is required to use <mapping class="my.model.db.TestClass"...
    the recomendation from googling the error message,  is that I need to set the session factory to use the annotationConfiguration where do I do this within wth lcds context?
    I'm using an annotated class created from fml using the server side generator.
    here is my hibernate.cfg.xml
    <?xml version='1.0' encoding='utf-8'?>
    <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
    <hibernate-configuration>
            <session-factory>
                    <!-- Database connection settings. -->
                    <property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
                    <property name="connection.url">
                            jdbc:oracle:thin:@dbhost:1521:castlewr
    </property>
                    <property name="connection.username">
                    aUser
    </property>
                    <property name="connection.password">
                    ultrasecret
    </property>
                    <!-- JDBC connection pool (use the built-in). -->
                    <property name="connection.pool_size">
                            1
    </property>
                    <!-- SQL dialect. -->
                    <property name="dialect">org.hibernate.dialect.Oracle10gDialect</property>
                    <!-- Enable the Hibernate automatic session context management. -->
                    <property name="current_session_context_class">thread</property>
                    <!-- Disable the second-level cache. -->
                    <property name="cache.provider_class">
                            org.hibernate.cache.NoCacheProvider
    </property>
                    <property name="show_sql">true</property>
    <mapping class="my.model.db.TestClass" />
                    <!-- Echo all executed SQL to stdout. -->
            </session-factory>
    </hibernate-configuration>

    Hi,
    How are you declaring your DMS destination? I believe you should be using the HibernateAnnotationsAssembler as your assembler. You might want to refer to the LCDS 3.1 documentation for using it.
    Rohit

  • Web Service java.lang.NoClassDefFoundError: org/hibernate/cfg/Configuration

    I have built a EAR file (using ANT build.xml from eclipse) and deploy it to WebLogic server, when I test the web service with a Test Client, I will receive the exception:
    java.lang.NoClassDefFoundError: org/hibernate/cfg/Configuration
    Anything wrong with my build.xml file below? Why I get this exception?
    <?xml version="1.0" encoding="UTF-8"?>
    <project name="MyWebServices" default="all">  
         <!-- set global properties for this build -->   
         <property name="wls.username" value="weblogic" />   
         <property name="wls.password" value="abcd1234" />   
         <property name="wls.hostname" value="localhost" />   
         <property name="wls.port" value="7001" />   
         <property name="wls.server.name" value="AdminServer" />   
         <property name="ear.deployed.name" value="MyWebServicesEar" />
         <property name="example-output" value="output" />   
         <property name="ear-dir" value="${example-output}/MyWebServicesEar" />   
         <property name="clientclass-dir" value="${example-output}/clientclasses" />   
         <path id="client.class.path">       
              <pathelement path="${clientclass-dir}" />       
              <pathelement path="${java.class.path}" />   
         </path>
         <taskdef name="jwsc" classname="weblogic.wsee.tools.anttasks.JwscTask" />   
         <taskdef name="clientgen" classname="weblogic.wsee.tools.anttasks.ClientGenTask" />   
         <taskdef name="wldeploy" classname="weblogic.ant.taskdefs.management.WLDeploy" />
         <target name="build-service">       
              <jwsc srcdir="src" destdir="${ear-dir}">
                   <classpath>      
                        <pathelement path="${java.class.path}" />
                        <pathelement path="WebContent/WEB-INF/lib"/>
                   </classpath>
                   <module contextPath="MyWebServices" name="MyWebServicesModule">
                        <jws file="/hk/com/my/webservices/servicefacade/CustomerWS.java" type="JAXWS" />                 
                        <jws file="/hk/com/my/webservices/servicefacade/LoginWS.java" type="JAXWS" />               
                        <jws file="/hk/com/my/webservices/servicefacade/PaymentWS.java" type="JAXWS" />
                        <!-- <jws file="/hk/com/my/webservices/servicefacade/RedemptionWS.java" type="JAXWS" /> -->
                   </module>
              </jwsc>
         </target>   
         <target name="deploy">
              <wldeploy action="deploy" name="${ear.deployed.name}" source="${ear-dir}" user="${wls.username}" password="${wls.password}" verbose="true" adminurl="t3://${wls.hostname}:${wls.port}" targets="${wls.server.name}" />   
         </target>   
         <target name="undeploy">       
              <wldeploy action="undeploy" name="${ear.deployed.name}" failonerror="false" user="${wls.username}" password="${wls.password}" verbose="true" adminurl="t3://${wls.hostname}:${wls.port}" targets="${wls.server.name}" />   
         </target>         
         <target name="all" depends="clean,build-service,deploy" />
         <target name="clean" depends="undeploy">       
              <delete dir="${example-output}" />   
         </target> 
         <target name="run">       
              <java classname="hk.com.my.webservices.servicefacade.client.Main" fork="true" failonerror="true">
                   <classpath refid="client.class.path" />                           
                   <arg line="http://${wls.hostname}:${wls.port}/MyServices" />
              </java>   
         </target>
    </project>

    The problem was because I did not include my web-inf into the ear in my build.xml, i added it using the zipfileset tag and it worked like a charm:
    <target name="build-service">          
              <jwsc srcdir="src" destdir="${ear-dir}" debug="on">
                   <!-- "contextPath" is like a folder to contain the Web Services, "name" is the name of the WAR file -->
                   <module contextPath="MyWebServices" name="MyWebServicesModule">
                        <jws file="/my/webservices/servicefacade/CustomerWS.java" type="JAXWS" />          
                        <jws file="/my/webservices/servicefacade/LoginWS.java" type="JAXWS" />                                                                 
                        <!-- include and copy the required files to the ear directory -->
                        <zipfileset dir="WebContent/WEB-INF/lib" prefix="WEB-INF/lib">
                             <include name="*.jar"/>
                        </zipfileset>                              
                   </module>
              </jwsc>
    </target>

  • Can't parse configuration  jsf-ri-runtime.xml

    When I try to do the Example about JSF in (How To Use JSF with JDeveloper 10g) and run it I found this problem
    SEVERE: Can't parse configuration file:classloader:/com/sun/faces/jsf-ri-runtime.xml
    and I have jDeveloper ver 9.0.5.2
    and java ver 1.4.2.04
    Plz Help
    Alaa

    I installed the 9.052 build of JDeveloper and it solved the problem. Per forum thread: Re: JSF Configuration error in JDeveloper10g

  • Problem parsing XML with schema when extracted from a jar file

    I am having a problem parsing XML with a schema, both of which are extracted from a jar file. I am using using ZipFile to get InputStream objects for the appropriate ZipEntry objects in the jar file. My XML is encrypted so I decrypt it to a temporary file. I am then attempting to parse the temporary file with the schema using DocumentBuilder.parse.
    I get the following exception:
    org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element '<root element name>'
    This was all working OK before I jarred everything (i.e. when I was using standalone files, rather than InputStreams retrieved from a jar).
    I have output the retrieved XML to a file and compared it with my original source and they are identical.
    I am baffled because the nature of the exception suggests that the schema has been read and parsed correctly but the XML file is not parsing against the schema.
    Any suggestions?
    The code is as follows:
      public void open(File input) throws IOException, CSLXMLException {
        InputStream schema = ZipFileHandler.getResourceAsStream("<jar file name>", "<schema resource name>");
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        DocumentBuilder builder = null;
        try {
          factory.setNamespaceAware(true);
          factory.setValidating(true);
          factory.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
          factory.setAttribute(JAXP_SCHEMA_SOURCE, schema);
          builder = factory.newDocumentBuilder();
          builder.setErrorHandler(new CSLXMLParseHandler());
        } catch (Exception builderException) {
          throw new CSLXMLException("Error setting up SAX: " + builderException.toString());
        Document document = null;
        try {
          document = builder.parse(input);
        } catch (SAXException parseException) {
          throw new CSLXMLException(parseException.toString());
        }

    I was originally using getSystemResource, which worked fine until I jarred the application. The problem appears to be that resources returned from a jar file cannot be used in the same way as resources returned directly from the file system. You have to use the ZipFile class (or its JarFile subclass) to locate the ZipEntry in the jar file and then use ZipFile.getInputStream(ZipEntry) to convert this to an InputStream. I have seen example code where an InputStream is used for the JAXP_SCHEMA_SOURCE attribute but, for some reason, this did not work with the InputStream returned by ZipFile.getInputStream. Like you, I have also seen examples that use a URL but they appear to be URL's that point to a file not URL's that point to an entry in a jar file.
    Maybe there is another way around this but writing to a file works and I set use File.deleteOnExit() to ensure things are tidied afterwards.

  • Problem parsing a xml using Jdom

    Hi all,
    I am reposting it as I was told to format the code and send it again.
    I am trying to parse a xml file using a jdom java code.This code works fine if I remove xmlns attribute in the root element. (I get the expected result) .If the "xmlns" attribute is put in the xml as it should be then the parsing and retrieving returns null. Please tell me how to fix this issue.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Xml
    <process name="CreateKBEntryService" targetNamespace="http://serena.com/CreateKBEntryService" suppressJoinFailure="yes" xmlns:tns="http://serena.com/CreateKBEntryService" xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/" xmlns:bpelx="http://schemas.oracle.com/bpel/extension" xmlns:ora="http://schemas.oracle.com/xpath/extension" xmlns:nsxml0="http://localhost:8080/axis/services/CreateKBEntryService" xmlns:nsxml1="http://DefaultNamespace" xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/">
    <partnerLinks>
    <partnerLink name="client" partnerLinkType="tns:CreateKBEntryService" myRole="CreateKBEntryServiceProvider"/>
    <partnerLink name="CreateKBEntryPartnerLink" partnerLinkType="nsxml0:CreateKBEntryLink" partnerRole="CreateKBEntryProvider"/>
    </partnerLinks>
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
    Java:
    import java.io.*;
    import java.util.*;
    import org.jdom.Document;
    import org.jdom.Element;
    import org.jdom.input.SAXBuilder;
    public class sample1 {
    public static void main(String[] args) throws Exception {
    // create a XML parser and read the XML file
    SAXBuilder oBuilder = new SAXBuilder();
    Document oDoc = oBuilder.build(new File("**xml file location**"));
    Element root = oDoc.getRootElement();
    System.out.println(root.getName());
    String tgtns= root.getAttributeValue("targetNamespace");
    System.out.println("tgt ns "+ tgtns);
    List list= root.getChildren("partnerLinks");
    Iterator it1= list.iterator();
    System.out.println("Iterator 1 - "+list.size());
    while(it1.hasNext()){
    Element partnerlinks = (Element)it1.next();
    List list2= partnerlinks.getChildren("partnerLink");
    System.out.println("iterator 2 - "+list2.size());
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Result:
    Without Xmlns in xml file(Expected and correct output)
    process
    tgt ns http://serena.com/CreateKBEntryService
    Iterator 1 - 1//expected and correct result that comes when I remove xmlns attribute from xml
    iterator 2 - 2
    Result with xmlns:
    process
    tgt ns http://serena.com/CreateKBEntryService
    Iterator 1 - 0 //instead of 0 should return 1

    One suggestion to try:
    Change your code to the following
    Element root = oDoc.getRootElement();
    System.out.println(root.getName());
    String tgtns= root.getAttributeValue("targetNamespace");
    System.out.println("tgt ns "+ tgtns);
    Namespace ns = Namespace.getNamespace(
      "http://schemas.xmlsoap.org/ws/2003/03/business-process/" );
    List list= root.getChildren("partnerLinks", ns );
    Iterator it1= list.iterator();
    System.out.println("Iterator 1 - "+list.size());The JavaDoc says for the one-arg getChildren()
    If this target element has no nested elements with the given name outside a namespace, an empty List is returned.
    Your elements have a namespace (the default one) so it should be worth a try.
    Dave Patterson

  • Problem in Configuring web.xml or portlet.xml

    Hi all,
    We are developing an application on the VAP 7 using Portlets.
    Can some one tell me, how to trigger a servlet from the Portlet? Rather how do i configure the web.xml or the Portlet.xml to make it identify the servlet that has to be called on load of the jsp.
    I have tried this the regular jsp and xml way (i.e. without using the Portlets and calling it from the JSP)
    I have the web.xml where i have the mapping for the single jsp ( this has the call servlet within the SRC attribute of the IMG tag. ) , also with the mapping details for the servlet to be called and this way it works fine there.
    How do i do the same for Portlets.?

    are you very new to servlets..
    ok then.
        <servlet>
            <servlet-name>bittu1</servlet-name>
            <servlet-class>Library1</servlet-class>
        </servlet>
        <servlet-mapping>
            <servlet-name>bittu1</servlet-name>
            <url-pattern>/lop1</url-pattern>
        </servlet-mapping>
    <servlet>
            <servlet-name>bittu2</servlet-name>
            <servlet-class>Library2</servlet-class>
        </servlet>
        <servlet-mapping>
            <servlet-name>bittu2</servlet-name>
            <url-pattern>/lop2</url-pattern>
        </servlet-mapping> i think this will help you.

  • Can't parse configuration file

    hi i'm trying to deploy an application on oc4j 10.1.3.1.0. i use Eclipse IDE and ant for deploy.
    i have this:
    [java] java.rmi.RemoteException: bindWebApp() failed!; nested exception is:
    [java] oracle.oc4j.admin.internal.DeployerException: Can't parse configuration file:code-source:/C:/JDeveloper/j2ee/home/applib/adf-faces-impl.jar!/META-INF/faces-config.xml
    [java] at com.evermind.server.administration.DefaultApplicationServerAdministrator.bindWebApp(DefaultApplicationServerAdministrator.java:420)
    [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    [java] at java.lang.reflect.Method.invoke(Method.java:585)
    [java] at com.evermind.server.rmi.RmiMethodCall.run(RmiMethodCall.java:53)
    [java] at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
    [java] at java.lang.Thread.run(Thread.java:595)
    [java] Caused by: oracle.oc4j.admin.internal.DeployerException: Can't parse configuration file:code-source:/C:/JDeveloper/j2ee/home/applib/adf-faces-impl.jar!/META-INF/faces-config.xml
    [java] at com.sun.faces.config.ConfigureListener.parse(ConfigureListener.java:1224)
    [java] at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:321)
    [java] at com.evermind.server.http.HttpApplication.initDynamic(HttpApplication.java:1130)
    [java] at com.evermind.server.http.HttpApplication.<init>(HttpApplication.java:738)
    [java] at com.evermind.server.ApplicationStateRunning.getHttpApplication(ApplicationStateRunning.java:414)
    [java] at com.evermind.server.Application.getHttpApplication(Application.java:545)
    [java] at com.evermind.server.http.HttpSite$HttpApplicationRunTimeReference.createHttpApplicationFromReference(HttpSite.java:1990)
    [java] at com.evermind.server.http.HttpSite$HttpApplicationRunTimeReference.<init>(HttpSite.java:1909)
    [java] at com.evermind.server.http.HttpSite.addHttpApplication(HttpSite.java:1606)
    [java] at oracle.oc4j.admin.internal.WebApplicationBinder.bindWebApp(WebApplicationBinder.java:238)
    [java] at com.evermind.server.administration.DefaultApplicationServerAdministrator.bindWebApp(DefaultApplicationServerAdministrator.java:418)
    [java] ... 7 more
    [java] Error: bindWebApp() failed!; nested exception is:
    [java] oracle.oc4j.admin.internal.DeployerException: Can't parse configuration file:code-source:/C:/JDeveloper/j2ee/home/applib/adf-faces-impl.jar!/META-INF/faces-config.xml

    I had similar problems with jsf-impl.jar.
    Sun do provide the xsd schemas locally inside the jar files so internet connection
    should not be required if parser is configured right.
    In my case I removed commons-digester-1.6.jar from my application and replaced it
    with commons-digester.jar supplied by JDeveloper builtin library named Commons Digester 1.5.
    Digester was configuring the (oracle) xerces parser.

Maybe you are looking for

  • Adobe creative cloud installation error 201

    adobe creative cloud installation error 201 How to solve this problem?

  • Regarding SAP Cariear

    Hi freinds,        Currently i m working as a SAP ABAP Condultant......from last 6 months..now i m getting a chance to learn....SAP BW,SAP XI,SAP SD................. pls,tell me which one is better for my future...........i  m very confuse....... Reg

  • Add generic partition getting ORA-14020

    Hi, i wrote some test statements, for trying to achiev that. but now i got an ORA-14020: this physical attribute may not be specified for a table partition i try to generate a generic partition name with the SYSTIMESTAMP. the stement i use is: alter

  • Why is my SATA enclosure not working?

    I have just fitted the hard drive from my Macbook Pro (which recently died after logic board issues) into a SATA USB enclosure to transfer all the data over to my brand new iMac. After connecting the enclosure to the iMac, the red LED on the front of

  • Network Error... help!

    About 2 months ago I switched high-speed providers and now I can no longer publish my website or use my isight in iChat... Do you have any suggestions? I have checked my firewall to make sure that no ports were blocked, and the provider did the same.