Greetings, I've researched this problem for several days, but I must be doing something wrong. I'm trying to upgrade from Tomcat 7.0.23 to 7.0.27 (actually running Liferay). I'm getting the following exception when trying to access a datasource via Hibernate:
16:28:27,694 ERROR [http-bio-8080-exec-1][DatasourceConnectionProvider:110] Could not find datasource: java:/comp/env/jdbc/MySqlDS javax.naming.NameNotFoundException: Name [java:/comp/env/jdbc/MySqlDS] is not bound in this Context. Unable to find [java:]. at org.apache.naming.NamingContext.lookup(NamingContext.java:820) at org.apache.naming.NamingContext.lookup(NamingContext.java:168) at org.apache.naming.SelectorContext.lookup(SelectorContext.java:158) at javax.naming.InitialContext.lookup(InitialContext.java:392) at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceCo nnectionProvider.java:75) at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(Con nectionProviderFactory.java:143) at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(Con nectionProviderFactory.java:84) at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.j ava:459) at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:90) at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:286 3) at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2859) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1870) The exact same code runs fine in 7.0.23 (I can drop the WAR file in either instance). Here is my $CATALINA_HOME/conf/context.xml file (comments removed): <?xml version='1.0' encoding='utf-8'?> <!-- The contents of this file will be loaded for each web application --> <Context> <!-- Default set of monitored resources --> <WatchedResource>WEB-INF/web.xml</WatchedResource> <Resource name="jdbc/MySqlDS" auth="Container" type="javax.sql.DataSource" driverClassName="com.mysql.jdbc.Driver" username="xxx" password="xxx" url="jdbc:mysql://localhost:3306/xx?useUnicode=true&characterEncoding=UT F-8&relaxAutoCommit=true" maxActive="200" maxIdle="30" maxWait="10000" minIdle="3" testWhileIdle="true" testOnBorrow="true" timeBetweenEvictionRunsMillis="120000" minEvictableIdleTimeMillis="600000" validationQuery="select 1" /> </Context> The web.xml from the application: <?xml version="1.0"?> <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <servlet> <servlet-name>HibernateServlet</servlet-name> <servlet-class>com.liferay.samplehibernate.servlet.HibernateServlet</servlet -class> </servlet> <servlet-mapping> <servlet-name>HibernateServlet</servlet-name> <url-pattern>/servlet/*</url-pattern> </servlet-mapping> <jsp-config> <taglib> <taglib-uri>http://java.sun.com/portlet_2_0</taglib-uri> <taglib-location> /WEB-INF/tld/liferay-portlet.tld </taglib-location> </taglib> </jsp-config> <resource-ref> <description>data source</description> <res-ref-name>jdbc/MySqlDS</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref> </web-app> And finally the the hibernate.cfg.xml file: <?xml version="1.0"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <property name="current_session_context_class">thread</property> <!-- Mappings --> <property name="connection.datasource">java:/comp/env/jdbc/MySqlDS</property> <property name="dialect"> org.hibernate.dialect.MySQLDialect </property> <mapping resource="com/liferay/samplehibernate/model/FoodItem.hbm.xml" /> </session-factory> </hibernate-configuration> Did a bit more research. On vanilla versions of Tomcat 7.0.27 and the corresponding Liferay bundle, I can make a global definition using the same resource in server.xml. I can see the connection pool using psi-probe and run queries. However, as soon as I introduce a resource-ref, either in the app or in the global web.xml, psi-probe complains that the resource is not configured correctly. Any suggestions about what I'm missing? Thanks. Bob --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org