Announcement Announcement Module
Collapse
No announcement yet.
Accessing the data bese using the Hibernate Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Accessing the data bese using the Hibernate

    Please help me out to access the databese using hibernate. I am trying to give the credentails through the properties file.but getting an error while deployment.
    Thsi is working fine if I hard code the databse credentials

    The error is :

    java:BPUPUATDataSource'
    19:13:41,329 INFO [TomcatDeployer] deploy, ctxPath=/eSSTATTSL, warUrl=.../tmp/deploy/tmp25024eSSTATTSL-exp.war/
    19:13:41,548 INFO [WebappClassLoader] validateJarFile(C:\jboss\server\default\.\tmp\depl oy\tmp25024eSSTATTSL-exp.war\WEB-INF\lib\servlet.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
    19:13:42,563 INFO [Environment] Hibernate 3.0.5
    19:13:42,563 INFO [Environment] hibernate.properties not found
    19:13:42,579 INFO [Environment] using CGLIB reflection optimizer
    19:13:42,579 INFO [Environment] using JDK 1.4 java.sql.Timestamp handling
    19:13:42,657 INFO [Configuration] configuring from resource: /hibernate.cfg.xml
    19:13:42,657 INFO [Configuration] Configuration resource: /hibernate.cfg.xml
    19:13:57,892 ERROR [Configuration] problem parsing configuration/hibernate.cfg.xml
    org.dom4j.DocumentException: www.springframework.org Nested exception: www.springframework.org
    at org.dom4j.io.SAXReader.read(SAXReader.java:484)
    at org.hibernate.cfg.Configuration.doConfigure(Config uration.java:1168)
    at org.hibernate.cfg.Configuration.configure(Configur ation.java:1112)
    at org.hibernate.cfg.Configuration.configure(Configur ation.java:1098)
    at com.tcs.telecom.essta.dataUtil.HibernatePlugin.ini t(HibernatePlugin.java:25)
    at org.apache.struts.action.ActionServlet.initModuleP lugIns(ActionServlet.java:869)
    at org.apache.struts.action.ActionServlet.init(Action Servlet.java:336)
    at javax.servlet.GenericServlet.init(GenericServlet.j ava:211)
    at org.apache.catalina.core.StandardWrapper.loadServl et(StandardWrapper.java:1091)
    at org.apache.catalina.core.StandardWrapper.load(Stan dardWrapper.java:925)
    at org.apache.catalina.core.StandardContext.loadOnSta rtup(StandardContext.java:3857)
    at org.apache.catalina.core.StandardContext.start(Sta ndardContext.java:4118)
    at org.apache.catalina.core.ContainerBase.addChildInt ernal(ContainerBase.java:759)
    at org.apache.catalina.core.ContainerBase.addChild(Co ntainerBase.java:739)
    at org.apache.catalina.core.StandardHost.addChild(Sta ndardHost.java:524)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.apache.commons.modeler.BaseModelMBean.invoke(B aseModelMBean.java:503)
    at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDy namicInvoker.java:150)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanSe rverImpl.java:644)
    at org.apache.catalina.core.StandardContext.init(Stan dardContext.java:5005)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.apache.commons.modeler.BaseModelMBean.invoke(B aseModelMBean.java:503)
    at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDy namicInvoker.java:150)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanSe rverImpl.java:644)
    at org.jboss.web.tomcat.tc5.TomcatDeployer.performDep loyInternal(TomcatDeployer.java:280)
    at org.jboss.web.tomcat.tc5.TomcatDeployer.performDep loy(TomcatDeployer.java:88)
    at org.jboss.web.AbstractWebDeployer.start(AbstractWe bDeployer.java:357)
    at org.jboss.web.WebModule.startModule(WebModule.java :68)
    at org.jboss.web.WebModule.startService(WebModule.jav a:46)
    at org.jboss.system.ServiceMBeanSupport.jbossInternal Start(ServiceMBeanSupport.java:274)
    at org.jboss.system.ServiceMBeanSupport.jbossInternal Lifecycle(ServiceMBeanSupport.java:230)
    at sun.reflect.GeneratedMethodAccessor2.invoke(Unknow n Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invok e(ReflectedDispatcher.java:141)
    at org.jboss.mx.server.Invocation.dispatch(Invocation .java:80)
    at org.jboss.mx.server.Invocation.invoke(Invocation.j ava:72)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(Ab stractMBeanInvoker.java:245)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanSe rverImpl.java:644)
    at org.jboss.system.ServiceController$ServiceProxy.in voke(ServiceController.java:943)
    at $Proxy0.start(Unknown Source)
    at org.jboss.system.ServiceController.start(ServiceCo ntroller.java:428)
    at sun.reflect.GeneratedMethodAccessor9.invoke(Unknow n Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invok e(ReflectedDispatcher.java:141)
    at org.jboss.mx.server.Invocation.dispatch(Invocation .java:80)
    at org.jboss.mx.server.Invocation.invoke(Invocation.j ava:72)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(Ab stractMBeanInvoker.java:245)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanSe rverImpl.java:644)
    at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyE xt.java:176)
    at $Proxy30.start(Unknown Source)
    at org.jboss.web.AbstractWebContainer.start(AbstractW ebContainer.java:400)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invok e(ReflectedDispatcher.java:141)
    at org.jboss.mx.server.Invocation.dispatch(Invocation .java:80)
    at org.jboss.mx.interceptor.AbstractInterceptor.invok e(AbstractInterceptor.java:118)
    at org.jboss.mx.server.Invocation.invoke(Invocation.j ava:74)
    at org.jboss.mx.interceptor.ModelMBeanOperationInterc eptor.invoke(ModelMBeanOperationInterceptor.java:1 27)
    at org.jboss.mx.interceptor.DynamicInterceptor.invoke (DynamicInterceptor.java:80)
    at org.jboss.mx.server.Invocation.invoke(Invocation.j ava:74)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(Ab stractMBeanInvoker.java:245)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanSe rverImpl.java:644)
    at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyE xt.java:176)
    at $Proxy31.start(Unknown Source)
    at org.jboss.deployment.MainDeployer.start(MainDeploy er.java:989)
    at org.jboss.deployment.MainDeployer.deploy(MainDeplo yer.java:790)
    at org.jboss.deployment.MainDeployer.deploy(MainDeplo yer.java:753)
    at sun.reflect.GeneratedMethodAccessor49.invoke(Unkno wn Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invok e(ReflectedDispatcher.java:141)
    at org.jboss.mx.server.Invocation.dispatch(Invocation .java:80)
    at org.jboss.mx.interceptor.AbstractInterceptor.invok e(AbstractInterceptor.java:118)
    at org.jboss.mx.server.Invocation.invoke(Invocation.j ava:74)
    at org.jboss.mx.interceptor.ModelMBeanOperationInterc eptor.invoke(ModelMBeanOperationInterceptor.java:1 27)
    at org.jboss.mx.server.Invocation.invoke(Invocation.j ava:74)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(Ab stractMBeanInvoker.java:245)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanSe rverImpl.java:644)
    at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyE xt.java:176)
    at $Proxy9.deploy(Unknown Source)
    at org.jboss.deployment.scanner.URLDeploymentScanner. deploy(URLDeploymentScanner.java:319)
    at org.jboss.deployment.scanner.URLDeploymentScanner. scan(URLDeploymentScanner.java:507)
    at org.jboss.deployment.scanner.AbstractDeploymentSca nner$ScannerThread.doScan(AbstractDeploymentScanne r.java:192)

  • #2
    Please use [ code][/code ] tags when posting code/stacktraces.

    Code:
    19:13:57,892 ERROR [Configuration] problem parsing configuration/hibernate.cfg.xml
    Judging by your exception there your configuration file (which should be an xml file) is wrong/has an error.

    Comment


    • #3
      Thanks for the response. My Hibernate Config.xml is pasted below.
      Thauht there may be a problem in The DTD, But could'nt find that.
      please help.


      [ code]

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
      <!-- Copyright (c) 2005 Tata Consultancy Services.-->
      <!-- 1.0 28-October-2005 -->
      <!-- author Sriram Rajagopal -->
      <!-- This file contains Reference DAO Configuration -->

      <beans>
      <bean id="testReferenceDaoSessionFactory" class="org.springframework.orm.hibernate3.LocalSes sionFactoryBean">
      <property name="dataSource" ref="myGeoDataSource"/>

      <property name="mappingResources">
      <list>
      <value>SystemUsersDtls.hbm.xml</value>
      <value>AccessRef.hbm.xml</value>
      <value>CafMdn.hbm.xml</value>
      <value>CreditDtls.hbm.xml</value>
      <value>InventoryRCV.hbm.xml</value>
      <value>PrimaryHSSPSales.hbm.xml</value>
      <value>RcvReturns.hbm.xml</value>
      <value>RetailerGen.hbm.xml</value>
      <value>RetailerInventoryRcv.hbm.xml</value>
      <value>RetailerProfile.hbm.xml</value>
      <value>SecondaryHsSpReturns.hbm.xml</value>
      <value>SecondaryHsSpSales.hbm.xml</value>
      <value>SecondaryRcvSales.hbm.xml</value>
      <value>Signage.hbm.xml</value>
      <value>Circles.hbm.xml</value>
      <value>Cities.hbm.xml</value>
      <value>Outlet.hbm.xml</value>
      <value>Role.hbm.xml</value>
      <value>Route.hbm.xml</value>
      <value>DistributorTransfer.hbm.xml</value>
      <value>UserRoleDAO.hbm.xml</value>
      <value>HsBulkUploadSales.hbm.xml</value>
      <value>SpBulkUpload.hbm.xml</value>
      <value>ReturnReason.hbm.xml</value>
      </list>

      </property>

      <!--
      <property name="hibernateProperties">
      <props>
      <prop key="hibernate.dialect">org.hibernate.dialect.Orac le9Dialect</prop>
      <prop key="hibernate.cache.region_prefix">hibernate.refe renceDao</prop>
      <prop key="hibernate.cache.provider_class">org.hibernate .cache.EhCacheProvider</prop>
      <prop key="hibernate.dbcp.maxActive">-1</prop>
      <prop key="hibernate.dbcp.maxIdle">4</prop>
      <prop key="hibernate.dbcp.maxWait">18000</prop>
      <prop key="hibernate.dbcp.whenExhaustedAction">1</prop>
      <prop key="hibernate.dbcp.test.OnBorrow">true</prop>
      <prop key="hibernate.dbcp.test.OnReturn">false</prop>
      <prop key="hibernate.dbcp.validationQuery">select 1 from dual</prop>
      </props>
      </property> -->


      <property name="hibernateProperties">
      <props>
      <!-- SQL dialect -->
      <prop key="hibernate.dialect">org.hibernate.dialect.Orac le9Dialect</prop>
      <!-- JDBC connection pool (use the built-in)
      <prop key="hibernate.connection.pool_size" >1</prop> -->
      <prop key="hibernate.cache.region_prefix">hibernate.refe renceDao</prop>
      <!-- Enable Hibernate's automatic session context management
      <prop key="hibernate.current_session_context_class" >thread</prop> -->
      <!-- Disable the second-level cache -->
      <prop key="hibernate.cache.provider_class" >org.hibernate.cache.EhCacheProvider</prop>
      <!-- Drop and re-create the database schema on startup -->
      <prop key="hibernate.c3p0.min_size" >1</prop>
      <prop key="hibernate.c3p0.max_size" >1500</prop>
      <prop key="hibernate.c3p0.timeout" >300</prop>
      <prop key="hibernate.c3p0.max_statements" >1000</prop>
      <prop key="hibernate.c3p0.idle_test_preriod" >3000</prop>
      <prop key="hibernate.show_sql">true</prop>
      </props>
      </property>


      </bean>


      <!--
      <bean id="myGeoDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
      <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
      <property name="url" value="@epos_oracle_server@"/>
      <property name="username" value="@epos_oracle_user@"/>
      <property name="password" value="@epos_oracle_password@"/>
      <property name="testOnBorrow" value="true"/>
      <property name="maxActive" value="100"/>
      <property name="validationQuery" value="select 1 from dual"/>

      </bean>
      -->
      <bean id="myGeoDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
      <property name="driverClass"><value>oracle.jdbc.driver.Oracl eDriver</value></property>
      <property name="jdbcUrl"><value>@essta_oracle_server@</value></property>
      <property name="user"><value>@essta_oracle_user@</value></property>
      <property name="password"><value>@essta_oracle_password@</value></property>
      </bean>


      <!---<bean id="myGeoDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
      <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
      <property name="url" value="jdbc:oracle:thin:@172.30.4.56:1525:EPOSTEST "/>
      <property name="username" value="epos"/>
      <property name="password" value="epos"/>
      </bean>-->


      <bean id="transactionManager" class="org.springframework.orm.hibernate3.Hibernat eTransactionManager">
      <property name="sessionFactory">
      <ref local="sessionFactory"/>
      </property>
      </bean>

      </beans>

      [/code ]

      Comment

      Working...
      X