On Thu, Sep 28, 2017 at 12:57 PM, Karen Goh <karenwo...@yahoo.com.invalid> wrote:
> > -------------------------------------------- > On Tue, 9/26/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> > Date: Tuesday, September 26, 2017, 8:52 AM > > 2017-09-25 18:02 GMT+03:00 Karen > Goh <karenwo...@yahoo.com>: > > 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 ? > > Mailing list rules: > http://tomcat.apache.org/lists.html#tomcat-users > -> Top-posting is bad. > > Ok. Tks, now I follow your requirements. > > > 1. See a link to Eclipse IDE FAQ here: > > https://wiki.apache.org/tomcat/FAQ/Developing#Q6 > > > 2. See the > following thread on how to turn on "Publish module > context > to separate XML files" option > in Eclipse. > > By default > (without that option) Eclipse IDE places <Context> > elements > into server.xml, which is a rather > discourage practice. > > http://markmail.org/message/7zkyocvph56b6t6q > > > OK. I managed to turn on "Publish module context..but my problem of > context not bound is still there. > > 3. > Documentation on Context: > > http://tomcat.apache.org/tomcat-8.0-doc/config/context.html > > The <Context> element in > your context.xml has a lot of attributes that > should not be there, starting with > "debug". What (bad) example were > they copied from? > > > 4. The current version of > Tomcat 8.0 is 8.0.46. > There were security > fixes in Java as well (8u141 was a security update > in July 2017) > > Also EOL date for Tomcat 8.0 has been > announced. Users are advised to > migrate to > 8.5. > http://tomcat.apache.org/tomcat-80-eol.html > > Hi kolinko, I have now installed Tomcat 8.5.20 but same problem. > > > > > 5. Your > META-INF/context.xml is broken: > [[[ > <Resource> // here is rogue > ">", thus your Resource has no name (all > the following is plain text, not attributes) > and thus NPE happens > > 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" /> // > You either use /> or > </Resource>, > not both. > </Resource> > ]]] > > > I have changed my context.xml as follows : > > <?xml version="1.0" encoding="UTF-8"?> > <Context path="/Hi5S" docBase="Hi5S" crossContext="true" reloadable="true" > > > <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" /> > </Context> > > And 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> > Try add here <jndi-name>jdbc/hi5</jndi-name> > <res-type>javax.sql.DataSource</res-type> > <res-auth>Container</res-auth> > </resource-ref> > <listener> > <listener-class>util.HibernateSessionFactoryListener</listener-class> > // I do not know if this is necessary. Wld like to have your comments. Tks. > </listener> > </web-app> > > 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 > > -- Guang <http://grails.asia/java-string-array-declaration/>