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

Reply via email to