Hi Kolinko, I have now removed the ResourceLink and left with Resource in my context.xml which is resided at WebContent/META-INF.
And this is C:\Program Files\Apache Software Foundation\Tomcat 8.0\conf\context.xml <?xml version="1.0" encoding="UTF-8"?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --><!-- The contents of this file will be loaded for each web application --><Context> <!-- Default set of monitored resources. If one of these changes, the --> <!-- web application will be reloaded. --> <WatchedResource>WEB-INF/web.xml</WatchedResource> <WatchedResource>${catalina.base}/conf/web.xml</WatchedResource> <!-- Uncomment this to disable session persistence across Tomcat restarts --> <!-- <Manager pathname="" /> --> <!-- Uncomment this to enable Comet connection tacking (provides events on session expiration as well as webapp lifecycle) --> <!-- <Valve className="org.apache.catalina.valves.CometConnectionManagerValve" /> --> </Context> And here's my web.xml : <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1"> <display-name>Hi5S</display-name> <welcome-file-list> <welcome-file>Index.jsp</welcome-file> </welcome-file-list> <resource-ref> <description>MySQL Datasource</description> <res-ref-name>jdbc/hi5</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref> </web-app> The error remains the same and my Tomcat failed to start, despite I cleaned them etc etc. SEVERE: A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]] Could you advise how to go about making it work ? Hope to hear from you soon. -------------------------------------------- On Fri, 9/22/17, Konstantin Kolinko <knst.koli...@gmail.com> wrote: Subject: Re: Help needed - JPA probem - No connection specified with project To: "Tomcat Users List" <users@tomcat.apache.org>, "Karen Goh" <karenwo...@yahoo.com> Date: Friday, September 22, 2017, 10:00 PM 2017-09-22 13:35 GMT+03:00 Karen Goh <karenwo...@yahoo.com.invalid>: > Hi expert, > > I have been trying very hard to nail the above problem including asking various forums like CodeRanch, dream in code etc but to no avail. > > As such, I am hoping to get help from the Apache Tomcat user support. > > Tools and setting : Eclipse Mars, Tomcat 1.8, MySQL, OS : Windows 7, Maven, Java JPA with Hibernate framework 5.1.0 There is no such version as "Tomcat 1.8". I assume that you meant some version of Tomcat 8.0.x. > The MySQL setting is confirmed correct, as I have managed to insert the data via single JDBC connection. > > Project summary : J2ee servlet with JSP, Java JPA in Hibernate framework. (Hibernate is for pure insertion of data - many to many relationship) > > My purpose is to get the JNDI datasource working but till now I can't just get it work. > > Here's my context.xml : > > <?xml version="1.0" encoding="UTF-8"?> > <Context path="/Hi5S" docBase="Hi5S" crossContext="true" reloadable="true" antiResourceLocking="true" debug="1"> > <ResourceLink global="jdbc/hi5" name="jdbc/hi5" type="javax.sql.DataSource"/> > <Resource> > name="jdbc/hi5" > auth="Container" > type="javax.sql.DataSource" > maxTotal="8" > maxActive="100" > maxIdle="30" > maxWait="-1" > username="root" > singleton="true" > override="true" > factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" > password="password" > alternateUsernameAllowed="true" > driverClassName="com.mysql.jdbc.Driver" > url="jdbc:mysql://localhost:3306/hi5" /> > </Resource> > </Context> The META-INF/context.xml file of a web application must have only one of <Resource, ResourceLink> elements with the same value of "name" attribute. If you have a ResourceLink in context.xml, it means that your Resource element must go into GlobalNamingResources element of conf/server.xml file. http://tomcat.apache.org/tomcat-8.5-doc/config/globalresources.html BTW, you should not modify conf/context.xml file. It is the defaults file shared by all web applications. (Modifying it is a common configuration mistake). Best regards, Konstantin Kolinko --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org