My application is working very well until i decide to migrade from seam1.2 to 
seam2, i am stuck by hibernate configuration problem in seam2, which always 
sent the message "Can't find the data source" , I have to list the related 
configuration files here, I also check your forum, it seems that there are 
other people are asking the similar question before , but with no good answer.

1. components.xml under "WEB-INF" directory of my application

  | 
  | <?xml version="1.0" encoding="UTF-8"?>
  | <components xmlns="http://jboss.com/products/seam/components";
  |     xmlns:core="http://jboss.com/products/seam/core";
  |     xmlns:bpm="http://jboss.com/products/seam/bpm";
  |     xmlns:persistence="http://jboss.com/products/seam/persistence";
  |     xmlns:security="http://jboss.com/products/seam/security";
  |     xmlns:transaction="http://jboss.com/products/seam/transaction";
  |     xmlns:framework="http://jboss.com/products/seam/framework";
  |     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
  |     xsi:schemaLocation="http://jboss.com/products/seam/core 
http://jboss.com/products/seam/core-2.0.xsd 
  |                  http://jboss.com/products/seam/bpm 
http://jboss.com/products/seam/bpm-2.0.xsd 
  |                  http://jboss.com/products/seam/persistence 
http://jboss.com/products/seam/persistence-2.0.xsd 
  |                  http://jboss.com/products/seam/security 
http://jboss.com/products/seam/security-2.0.xsd
  |                  http://jboss.com/products/seam/transaction 
http://jboss.com/products/seam/transaction-2.0.xsd
  |                  http://jboss.com/products/seam/framework 
http://jboss.com/products/seam/framework-2.0.xsd
  |                  http://jboss.com/products/seam/components 
http://jboss.com/products/seam/components-2.0.xsd";>
  | 
  |     <core:init debug="true" transaction-management-enabled="false" />
  | 
  |     <!-- 120 second conversation timeout -->
  |     <core:manager conversation-timeout="1800000"
  |             concurrent-request-timeout="500" 
conversation-id-parameter="cid" />
  | 
  |     <!-- this is related with hibernate.cfg.xml which install the hibernate 
entity manager-->
  | 
  |     <persistence:hibernate-session-factory
  |             name="hibernateSessionFactory" />
  | 
  |     <persistence:managed-hibernate-session name="session"
  |             session-factory-jndi-name="java:/HibernateSessionFactory"
  |             auto-create="true" />
  | 
  | 
  | </components>
  | 

2.hibernate.cfg.xml and seam.properties deployed directly in jar file of  my 
application

  | <hibernate-configuration>
  |             <session-factory name="java:/HibernateSessionFactory">
  |             <property name="hibernate.show_sql">false</property>
  |     <property 
name="connection.datasource">java:/CPI_SqlserverDatasource</property>
  | 
  | ...
  | </hibernate-configuration>
  | 

3.my ds.xml file for data source, i deploy it into the 
{Tomcat6.home}\lib\deploy directory


  | 
  | <?xml version="1.0" encoding="UTF-8"?>
  | <datasources>
  | 
  |  <local-tx-datasource>
  |         <jndi-name>CPI_SqlserverDatasource</jndi-name>
  |         
<connection-url>jdbc:sqlserver://127.0.0.1:1433;DatabaseName=CPI_NEW;integratedSecurity=true;applicationName=CPI
 UI;</connection-url>
  | 
  |         
<driver-class>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver-class>
  |     
  |             <min-pool-size>5</min-pool-size>
  |             <max-pool-size>20</max-pool-size>
  |             
<transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation> 
  |             <idle-timeout-minutes>0</idle-timeout-minutes>
  |  </local-tx-datasource>
  |      
  | </datasources>
  | 


4. faces-config.xml under "WEB-INF" directory of my application

  | 
  | <?xml version='1.0' encoding='UTF-8'?>
  | <faces-config version="1.2"
  |               xmlns="http://java.sun.com/xml/ns/javaee";
  |               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
  |               xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd";>
  |       
  |     
  |     <application>
  |             <locale-config>
  | 
  |                     <default-locale>en</default-locale>
  |                     <supported-locale>en</supported-locale>
  |                     <supported-locale>zh</supported-locale>
  | 
  |             </locale-config>
  |      
  |     </application>
  |     
  |     
  | 
  | </faces-config>
  | 


5. context.xml under the "META-INF" directory of my application

  | <?xml version="1.0" encoding="UTF-8"?>
  | <Context override="true">
  |     <Manager 
  |             className="org.apache.catalina.session.StandardManager" 
  |             distributable="false"
  |             maxActiveSessions="-1"
  |             pathname=""     
  |     />
  | </Context>
  | 
  | 

the exception i got is 

严重: Exception sending context initialized event to listener instance of 
class org.jboss.seam.servlet.SeamListener
org.hibernate.HibernateException: Could not find datasource: 
java:/CPI_SqlserverDatasource
        at 
org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:59)
        at 
org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)
        at 
org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:56)
        at 
org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:414)
        at 
org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:62)
        at 
org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009)
        at 
org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292)
        at 
org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:915)
        at 
org.jboss.seam.persistence.HibernateSessionFactory.createSessionFactory(HibernateSessionFactory.java:165)
        at 
org.jboss.seam.persistence.HibernateSessionFactory.startup(HibernateSessionFactory.java:79)
        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:585)
        at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
        at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:125)
        at org.jboss.seam.Component.callComponentMethod(Component.java:2074)
        at org.jboss.seam.Component.callCreateMethod(Component.java:1997)
        at org.jboss.seam.Component.newInstance(Component.java:1968)
        at org.jboss.seam.contexts.Contexts.startup(Contexts.java:304)
        at org.jboss.seam.contexts.Contexts.startup(Contexts.java:278)
        at 
org.jboss.seam.contexts.ServletLifecycle.endInitialization(ServletLifecycle.java:95)
        at org.jboss.seam.init.Initialization.init(Initialization.java:555)
        at 
org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:34)
        at 
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3830)
        at 
org.apache.catalina.core.StandardContext.start(StandardContext.java:4337)
        at 
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
        at 
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
        at 
org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:626)
        at 
org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
        at 
org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
        at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
        at 
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
        at 
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
        at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
        at 
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
        at 
org.apache.catalina.core.StandardService.start(StandardService.java:516)
        at 
org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
        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:585)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)


Can someone give me some userful comments on this ? Thanks in advance.

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4109120#4109120

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4109120

_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to