[Te-webmaster] Help needed on registration and Tomcat jdni connection

Karen Goh karenworld at yahoo.com
Fri Sep 29 00:14:53 PDT 2017


Hi,

I chance upon your website and I have this question which I have asked in Tomcat forum but till now nobody is able to give me the answer.

So, I registered myself but I can't log in.  Can I just ask the question here instead?

The tomcat version is 8.5.20.
I have problem in the jndi connection.

My context.xml is :

<?xml version="1.0" encoding="UTF-8"?>
<Context path="/Hi5S">
<GlobalNamingResources>
  <Resource type="javax.sql.DataSource"
            name="jdbc/hi5"
            factory="org.apache.tomcat.jdbc.pool"
            driverClassName="com.mysql.jdbc.Driver"
            url="jdbc:mysql://localhost:3306/hi5"
            username="root"
            password="password"
/>
 </GlobalNamingResources>
<ResourceLink type="javax.sql.DataSource"
                name="jdbc/hi5"
                global="jdbc/hi5"
/>
</Context>

and my xml is :

<?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>
  

        <listener>
            <listener-class>org.apache.logging.log4j.web.Log4jServletContextListener</listener-class>
        </listener>
     
        <filter>
            <filter-name>log4jServletFilter</filter-name>
            <filter-class>org.apache.logging.log4j.web.Log4jServletFilter</filter-class>
        </filter>
        <filter-mapping>
            <filter-name>log4jServletFilter</filter-name>
            <url-pattern>/*</url-pattern>
            <dispatcher>REQUEST</dispatcher>
            <dispatcher>FORWARD</dispatcher>
            <dispatcher>INCLUDE</dispatcher>
            <dispatcher>ERROR</dispatcher>
            <dispatcher>ASYNC</dispatcher><!-- Servlet 3.0 w/ disabled auto-initialization only; not supported in 2.5 -->
        </filter-mapping>
    <listener>
        <listener-class>util.HibernateSessionFactoryListener</listener-class>
    </listener>
</web-app>

Even though I am able to get a ping to my database, I just can't get it connected at the Tomcat's server.

Hope you can tell me how to make it work.

Tks & rgds,
Karen


More information about the Te-webmaster mailing list