See this thread.<http://stackoverflow.com/questions/10712365/cant-configure-mysql-datasource-in-gwt-hibernate-mysql-project>
On Sunday, May 20, 2012 5:42:49 PM UTC-6, Bill Compton wrote: > > Our Hibernate setup works fine in non-GWT projects. I'm using Eclipse > Indigo, Google Suite Plugin 2.5, Google GWT Designer 2.4.2. > > The short-short version is that the MysqlConnectionPoolDataSource class > from jetty-env.xml is evidently not getting instantiated, causing the > resource reference from web.xml to fail. > > Here are the steps I took and excerpts of files that I think matter. > (Apologies in advance - this is a bit verbose but wanted to be sure my > question is complete and clear.) > > My war/WEB-INF/classes/hibernate.cfg.xml includes: > <property name="hibernate.connection.datasource"> > *java:comp/env/jdbc/nndb > * </property> > > A service class AuthenticateServiceImpl.authenticate(Credentials c) calls > DAOFactory.getDefaultInstance().getCustomerDAO(); > The above works fine in my pure tomcat (non-GWT project). But in the GWT > project it fails with: > SEVERE: Could not find datasource: java:comp/env/jdbc/nndb > javax.naming.NameNotFoundException; remaining name 'jdbc/nndb' > So, I added following entry to web.xml: > <resource-ref> > <description>NN Database Connection Pooling</description> > <res-ref-name>*jdbc/nndb*</res-ref-name> > <res-type>*javax.sql.DataSource*</res-type> > <res-auth>Container</res-auth> > <res-sharing-scope>Shareable</res-sharing-scope> > </resource-ref> > and also created CustomJettyLauncher as described > here<http://webtide.intalio.com/2011/08/gwt-and-jndi/> > . > and added Eclipse run config to use it (Run Config Arguments -server > com....CustomJettyLauncher) > This results in: > jetty-6.1.x > [WARN] Configuration problem at <resource-ref><description>NN Database > Connection > Pooling</description><res-ref-name>jdbc/nndb</res-ref-name><res-type>javax.sql.DataSource</res-type><res-auth>Container</res-auth><res-sharing-scope>Shareable</res-sharing-scope></resource-ref> > java.lang.IllegalStateException: Nothing to bind for name * > javax.sql.DataSource/default* > > Presumably at this point I need an entry in either the jetty-env.xml or > jetty-web.xml file (which?) defining the resource. I tried jetty-env.xml: > <?xml version="1.0"?> <!DOCTYPE Configure PUBLIC "-//Mort Bay > Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd"> > <Configure class="org.mortbay.jetty.webapp.WebAppContext"> > <New id="nndb" class="org.mortbay.jetty.plus.naming.Resource"> > <Arg>j*dbc/nndb*</Arg> > <Arg> <New > class="com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource"> > <Set name="Url">jdbc:mysql://*dbserver/dbname*</Set> > <Set name="User">*dbuser*</Set> > <Set name="Password">*dbpasswd*</Set> > </New> > </Arg> > </New> > </Configure> > > But the above error (Nothing to bind for name > javax.sql.DataSource/default) remains. Interestingly, if I intentionally > bugger up the datasource classname (e.g. > NOSUCH.com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource) there's > no gripe, so it may not even be trying to instantiate that class. (Similar > "tracer" errors for WebAppContext and Resource *DO* produce gripes, so > it's only ConnectionPoolDataSource that it's not trying to instantiate.) > > I also tried using a jetty-web.xml file but that is evidently not getting > read at all. > > Whew! > > Does anyone see what's wrong? Any recommendations would be greatly > appreciated. > > Thanks in advance! > -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/hG_myikwZxgJ. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.