Tomcat, jstl, jndi problem

Hi,
I've been attempting to use JSTL to print out some info from a JNDI datasource (mysql) that I have created in Tomcat. I am running Tomcat 5.0.27. I have tested the JNDI datasource using this code and it works fine:
<%
     Context ic = new InitialContext();
     DataSource myDataSource = (DataSource) ic.lookup("java:comp/env/jdbc/helpdesk");
     Connection conn = myDataSource.getConnection();
     if (conn == null)
          out.println("The connection was null");
     else
          out.println("The connection was not null");
     Statement st = conn.createStatement();     
     ResultSet rs = st.executeQuery("SELECT * FROM projecttypes");
     while (rs.next())
          out.print("<br>");
          out.print(rs.getString("typeName"));
          out.print("<br>");
          out.print(rs.getString("typeID"));
          conn.close();
%>However, when I attempt to access the same datasource via JSTL, the tags seem to render, but it doesn't print any values, just the name of the variable. Here is an example:
The code:
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<sql:query var="rs" dataSource="jdbc/helpdesk">
select typeID, typeName from projecttypes
</sql:query>
<html>
  <head>
    <title>DB Test</title>
  </head>
  <body>
  <h2>Results</h2>
<c:forEach var="row" items="${rs.rows}">
    ID<c:out value="${row.typeID}"/><br/>
    Name <c:out value="${row.typeName}"/><br/>
</c:forEach>
  </body>
</html>Here is the output:
Results
ID ${row.typeID}
Name ${row.typeName}I don't understand what's going on, because when I view the source, the tags look as they have been rendered, but I get no database output. But, when I used the JSP scriptlet I had above, it works fine. Also, here are my web.xml, server.xml, and my context file:
web.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
    "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
     <!-- general application info -->
     <display-name>
          Americas IT Customer Support Website
       </display-name>
       <description>
            Provides helpdesk information and services to Uniqema Americas.
     </description>
     <!-- context parameters -->
     <context-param>
            <param-name>javax.servlet.jsp.jstl.sql.dataSource</param-name>
          <param-value>jdbc/helpdesk</param-value>
     </context-param>
     <!-- servlet info -->
          <!-- standard action servlet configuration (with debugging) -->
       <servlet>
         <servlet-name>action</servlet-name>
         <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
         <init-param>
                <param-name>config</param-name>
                <param-value>/WEB-INF/struts-config.xml</param-value>
         </init-param>
         <init-param>
                <param-name>debug</param-name>
                <param-value>2</param-value>
         </init-param>
         <init-param>
                <param-name>detail</param-name>
                <param-value>2</param-value>
         </init-param>
         <load-on-startup>2</load-on-startup>
       </servlet>
     <!-- servlet mappings -->
          <!-- standard action servlet mapping -->
       <servlet-mapping>
         <servlet-name>action</servlet-name>
         <url-pattern>*.do</url-pattern>
       </servlet-mapping>
     <!-- welcome file list -->
     <welcome-file-list>
          <welcome-file>index.jsp</welcome-file>
          <welcome-file>index.html</welcome-file>
     </welcome-file-list>
     <!-- tld definitions -->
          <!-- struts tag library descriptors -->
       <taglib>
          <taglib-uri>/WEB-INF/tld/struts-bean.tld</taglib-uri>
         <taglib-location>/WEB-INF/tld/struts-bean.tld</taglib-location>
       </taglib>
       <taglib>
         <taglib-uri>/WEB-INF/tld/struts-bean.tld</taglib-uri>
         <taglib-location>/WEB-INF/tld/struts-bean.tld</taglib-location>
       </taglib>
       <taglib>
         <taglib-uri>/WEB-INF/tld/struts-logic.tld</taglib-uri>
         <taglib-location>/WEB-INF/tld/struts-logic.tld</taglib-location>
       </taglib>
       <taglib>
         <taglib-uri>/WEB-INF/tld/struts-nested.tld</taglib-uri>
         <taglib-location>/WEB-INF/tld/struts-nested.tld</taglib-location>
       </taglib>
       <taglib>
         <taglib-uri>/WEB-INF/tld/struts-tiles.tld</taglib-uri>
         <taglib-location>/WEB-INF/tld/struts-tiles.tld</taglib-location>
     </taglib>
<taglib>
    <taglib-uri>http://java.sun.com/jstl/fmt</taglib-uri>
     <taglib-location>/WEB-INF/tld/fmt.tld</taglib-location>
  </taglib>
  <taglib>
    <taglib-uri>http://java.sun.com/jstl/fmt-rt</taglib-uri>
     <taglib-location>/WEB-INF/tld/fmt-rt.tld</taglib-location>
  </taglib>
  <taglib>
    <taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
     <taglib-location>/WEB-INF/tld/c.tld</taglib-location>
  </taglib>
  <taglib>
    <taglib-uri>http://java.sun.com/jstl/core-rt</taglib-uri>
     <taglib-location>/WEB-INF/tld/c-rt.tld</taglib-location>
  </taglib>
  <taglib>
    <taglib-uri>http://java.sun.com/jstl/sql</taglib-uri>
     <taglib-location>/WEB-INF/tld/sql.tld</taglib-location>
  </taglib>
  <taglib>
    <taglib-uri>http://java.sun.com/jstl/sql-rt</taglib-uri>
     <taglib-location>/WEB-INF/tld/sql-rt.tld</taglib-location>
  </taglib>
  <taglib>
    <taglib-uri>http://java.sun.com/jstl/x</taglib-uri>
     <taglib-location>/WEB-INF/tld/x.tld</taglib-location>
  </taglib>
  <taglib>
    <taglib-uri>http://java.sun.com/jstl/x-rt</taglib-uri>
     <taglib-location>/WEB-INF/tld/x-rt.tld</taglib-location>
  </taglib>
     <!-- error page info -->
     <error-page>
          <error-code>404</error-code>
          <location>/errors/404.jsp</location>
     </error-page>
     <error-page>
          <error-code>500</error-code>
          <location>/errors/500.jsp</location>
     </error-page>
     <error-page>
          <exception-type>java.lang.Exception</exception-type>
          <location>/errors/error.jsp</location>
     </error-page>
     <resource-ref>
      <res-ref-name>jdbc/helpdesk</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
       <res-auth>Container</res-auth>
  </resource-ref>
</web-app>server.xml
<?xml version='1.0' encoding='utf-8'?>
<Server>
  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"/>
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
  <GlobalNamingResources>
    <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
    <Resource auth="Container" description="User database that can be updated and saved" name="UserDatabase" type="org.apache.catalina.UserDatabase"/>
    <ResourceParams name="UserDatabase">
      <parameter>
        <name>factory</name>
        <value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
      </parameter>
      <parameter>
        <name>pathname</name>
        <value>conf/tomcat-users.xml</value>
      </parameter>
    </ResourceParams>
  </GlobalNamingResources>
  <Service name="Catalina">
    <Connector acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" port="80" redirectPort="8443" maxSpareThreads="75" maxThreads="150" minSpareThreads="25">
    </Connector>
    <Connector port="8009" protocol="AJP/1.3" protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler" redirectPort="8443">
    </Connector>
    <Engine defaultHost="localhost" name="Catalina">
      <Host appBase="webapps" name="localhost">
        <Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_log." suffix=".txt" timestamp="true"/>
      </Host>
      <Logger className="org.apache.catalina.logger.FileLogger" prefix="catalina_log." suffix=".txt" timestamp="true"/>
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"/>
    </Engine>
  </Service>
</Server>helpdesk.xml (context file)
<?xml version='1.0' encoding='utf-8'?>
<Context crossContext="true" debug="5" displayName="Americas IT Customer Support Website" docBase="D:/projects/helpdesk/web" path="/helpdesk" reloadable="true" workDir="work\Catalina\localhost\helpdesk">
  <Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_helpdesk_log." suffix=".txt" timestamp="true"/>
  <Resource name="jdbc/helpdesk"
               auth="Container"
               type="javax.sql.DataSource"/>
  <ResourceParams name="jdbc/helpdesk">
    <parameter>
      <name>factory</name>
      <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
    </parameter>
    <!-- Maximum number of dB connections in pool. Make sure you
         configure your mysqld max_connections large enough to handle
         all of your db connections. Set to 0 for no limit.
         -->
    <parameter>
      <name>maxActive</name>
      <value>100</value>
    </parameter>
    <!-- Maximum number of idle dB connections to retain in pool.
         Set to 0 for no limit.
         -->
    <parameter>
      <name>maxIdle</name>
      <value>30</value>
    </parameter>
    <!-- Maximum time to wait for a dB connection to become available
         in ms, in this example 10 seconds. An Exception is thrown if
         this timeout is exceeded.  Set to -1 to wait indefinitely.
         -->
    <parameter>
      <name>maxWait</name>
      <value>10000</value>
    </parameter>
    <!-- MySQL dB username and password for dB connections  -->
    <parameter>
     <name>username</name>
     <value>helpdesk</value>
    </parameter>
    <parameter>
     <name>password</name>
     <value>helpdesk</value>
    </parameter>
    <!-- Class name for the old mm.mysql JDBC driver - uncomment this entry and comment next
         if you want to use this driver - we recommend using Connector/J though
    <parameter>
       <name>driverClassName</name>
       <value>org.gjt.mm.mysql.Driver</value>
    </parameter>
     -->
    <!-- Class name for the official MySQL Connector/J driver -->
    <parameter>
       <name>driverClassName</name>
       <value>com.mysql.jdbc.Driver</value>
    </parameter>
    <!-- The JDBC connection url for connecting to your MySQL dB.
         The autoReconnect=true argument to the url makes sure that the
         mm.mysql JDBC Driver will automatically reconnect if mysqld closed the
         connection.  mysqld by default closes idle connections after 8 hours.
         -->
    <parameter>
      <name>url</name>
      <value>jdbc:mysql://webdev:3306/helpdesk?autoReconnect=true</value>
    </parameter>
  </ResourceParams>
</Context>Ok, I think that's all. Thanks in advance.

The problem is that your EL is being ignored. This is caused by using an out-of-date web.xml DTD. Your web.xml begins like this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
    "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>Giving you the 2.2 version of the web app. You want 2.4 (newest version) which you get by doing this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
                             http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
         version="2.4">to your web.xml
(No doctype, that long tag is the web-app tag)

Similar Messages

  • Tomcat 4.0.x and JSP / JSTL performance problems.

    Hello everyone,
    I've got a web application where some of my JSP pages are rendering quite slowly. As an example I'll use a JSP page that I wrote for browsing through a user database. It uses two beans...
    1. jobBean - Ensures that all of the required (and correct) beans that will be used for processing the request have been loaded.
    2. browserBean - A basic JavaBean that holds a set of UserBean(s) and other information pertinent to database queries (start, limit, order).
    I'm using Apache Struts to map requests to the appropriate processing modules. Now the problem I'm having is that each request is taking between 1 and 2 seconds to execute. As you can imagine that's not going to allow for very many simaltaneous users. I've tracked the problem down to something JSP related. All of my code executes fairly quickly (I think). It takes about 20-30ms for my code to identify the request, load the requested data from the database, and convert it into a usable format (the browserBean). Here's my code...
    <%@ page contentType="text/html"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <META http-equiv="Cache-Control" content="no-cache">
    <title>
    Browse Users
    </title>
    </head>
    <body>
    <!-- Set up the OrganizationBeans for use -->
    <jsp:useBean id="jobBean" class="com.vacode.jobs.generic.JobBean" scope="session" />
    <jsp:useBean id="browserBean" class="com.vacode.mqdb.beansets.user.UserBrowserBean" scope="session" />
    <!---------------------------->
    <!-- Start Time Logged Here -->
    <!---------------------------->
    <c:if test="${jobBean.currentJob.name != 'BrowseUserJob'}">
         <!-- This page was accessed before everything was properly initialized -->
         <c:url var="browseUser" value="manageUsers.do">
              <c:param name="action" value="browse" />
         </c:url>
         <c:redirect url="${browseUser}" />
    </c:if>
    <form action="manageUsers.do" method="get">
         <input type="hidden" name="action" value="browse">
         <input type="hidden" name="start" value="<c:out value="${browserBean.dummyStart}" />">
         <input type="hidden" name="order" value="<c:out value="${browserBean.order}" />">
         I would like to view
         <select name="limit">
              <c:forEach begin="1" end="5" var="current">
                   <option value="<c:out value="${current*5}" />"
                        <c:if test="${browserBean.dummyLimit == current*5}">
                        selected
                        </c:if>
                   >
                    <c:out value="${current*5}" />
                   </option>
              </c:forEach>
         </select>
         results per page.
         <input type="submit" action="submit">
    </form>
    <c:url var="id" value="manageUsers.do">
         <c:param name="action" value="browse" />
         <c:param name="start" value="0" />
         <c:param name="order" value="USER_ID" />
         <c:param name="limit" value="${browserBean.dummyLimit}" />
    </c:url>
    <c:url var="name" value="manageUsers.do">
         <c:param name="action" value="browse" />
         <c:param name="start" value="0" />
         <c:param name="order" value="USER_NAME" />
         <c:param name="limit" value="${browserBean.dummyLimit}" />
    </c:url>
    <c:url var="firstName" value="manageUsers.do">
         <c:param name="action" value="browse" />
         <c:param name="start" value="0" />
         <c:param name="order" value="USER_FIRST_NAME" />
         <c:param name="limit" value="${browserBean.dummyLimit}" />
    </c:url>
    <c:url var="lastName" value="manageUsers.do">
         <c:param name="action" value="browse" />
         <c:param name="start" value="0" />
         <c:param name="order" value="USER_LAST_NAME" />
         <c:param name="limit" value="${browserBean.dummyLimit}" />
    </c:url>
    <c:url var="email" value="manageUsers.do">
         <c:param name="action" value="browse" />
         <c:param name="start" value="0" />
         <c:param name="order" value="USER_EMAIL_ADDRESS" />
         <c:param name="limit" value="${browserBean.dummyLimit}" />
    </c:url>
    <c:url var="organization" value="manageUsers.do">
         <c:param name="action" value="browse" />
         <c:param name="start" value="0" />
         <c:param name="order" value="USER_ORGANIZATION_NAME" />
         <c:param name="limit" value="${browserBean.dummyLimit}" />
    </c:url>
    <c:url var="status" value="manageUsers.do">
         <c:param name="action" value="browse" />
         <c:param name="start" value="0" />
         <c:param name="order" value="USER_STATUS_NAME" />
         <c:param name="limit" value="${browserBean.dummyLimit}" />
    </c:url>
    <c:url var="role" value="manageUsers.do">
         <c:param name="action" value="browse" />
         <c:param name="start" value="0" />
         <c:param name="order" value="ROLE_NAME" />
         <c:param name="limit" value="${browserBean.dummyLimit}" />
    </c:url>
    <table>
         <tr>
              <td><a href="<c:out value="${id}" />">Id</a></td>
              <td><a href="<c:out value="${name}" />">User Name</a></td>
              <td><a href="<c:out value="${firstName}" />">First Name</a></td>
              <td><a href="<c:out value="${lastName}" />">Last Name</a></td>
              <td><a href="<c:out value="${email}" />">E-Mail</a></td>
              <td><a href="<c:out value="${organization}" />">Organization</a></td>
              <td><a href="<c:out value="${status}" />">Status</a></td>
              <td><a href="<c:out value="${role}" />">User Type</a></td>
         </tr>
    <c:forEach items="${browserBean.beans}" var="bean">
         <tr>
              <c:url var="manage" value="manageUsers.do">
                   <c:param name="action" value="modify" />
                   <c:param name="beanId" value="${bean.userId}" />
              </c:url>
              <td><a href="<c:out value="${manage}" />"><c:out value="${bean.userId}" /></a></td>
              <td><c:out value="${bean.userName}" /></td>
              <td><c:out value="${bean.firstName}" /></td>
              <td><c:out value="${bean.firstName}" /></td>
              <td><c:out value="${bean.email}" /></td>
              <td><c:out value="${bean.organizationName}" /></td>
              <td><c:out value="${bean.statusName}" /></td>
              <td><c:out value="${bean.roleName}" /></td>
         </tr>
    </c:forEach>
    <!-------------------------->
    <!-- End Time Logged Here -->
    <!-------------------------->
    </table>
    <c:url var="next" value="manageUsers.do">
         <c:param name="action" value="browse" />
         <c:param name="start" value="${browserBean.nextPageStart}" />
         <c:param name="limit" value="${browserBean.dummyLimit}" />
         <c:param name="order" value="${browserBean.order}" />
    </c:url>
    <c:url var="previous" value="manageUsers.do">
         <c:param name="action" value="browse" />
         <c:param name="start" value="${browserBean.previousPageStart}" />
         <c:param name="limit" value="${browserBean.dummyLimit}" />
         <c:param name="order" value="${browserBean.order}" />
    </c:url>
    <c:if test="${browserBean.previousPageStart>-1}">
         <a href="<c:out value="${previous}" escapeXml="false" />">previous</a>
    </c:if>
    <c:if test="${browserBean.nextPageStart>-1}">
         <a href="<c:out value="${next}" escapeXml="false" />">next</a>
    </c:if>
    <br>
    <br>
    Quick Jump To Page:
    <c:forEach varStatus="loopTag" items="${browserBean.pageStartValues}" var="current">
    <c:choose>
         <c:when test="${loopTag.index+1==browserBean.currentPageNumber}">
              <c:out value="${loopTag.index+1}" />
         </c:when>
         <c:otherwise>
         <c:url var="thisPage" value="manageUsers.do">
              <c:param name="action" value="browse" />
              <c:param name="start" value="${current}" />
              <c:param name="limit" value="${browserBean.dummyLimit}" />
              <c:param name="order" value="${browserBean.order}" />
         </c:url>
         <a href="<c:out value="${thisPage}" />"><c:out value="${loopTag.index+1}" /></a>
         </c:otherwise>
    </c:choose>
    </c:forEach>
    <br>
    <br>
    Max Possible Pages: <c:out value="${browserBean.maxNumberOfPages}" />
    <br>
    Current Page: <c:out value="${browserBean.currentPageNumber}" />
    </body>
    </html>I've added comments where I timed my code from (by writing new Date().getTime() to the console). It usually takes between 1 and 2 seconds for that block of JSP to execute. I wrote a test class that should be very similar to the process (iterating over the forEach loop mainly) and it usually executed in 10ms to 20ms.
    I had a look at the servlets that were generated by Tomcat and I noticed that for each <c:url> I used there's about 300 lines of code (with several syncronized() methods). Could this have anything to do with it? If so, what could I do to improve the performance?
    Worth mentioning... The machine I am using is an AMD Athlon 1GHZ with 768MB RAM, 7200 RPM UDMA100 IDE HDD.
    I'm also using Tomcat integrated with a development environment (IntelliJ IDEA).
    Any help that anyone could offer is much appreciated.
    Thanks,
    Ryan

    Can you get acceptable performance if you hack out everything except the browserBean forEach loop? Maybe you are trying to do too much runtime EL evaluation on the page.
    If performance improves, you may want to push the URL construction and startValue computations to a Struts Action and put a bunch of objects on the requestScope (like "id_url", "name_url", "pageStartValue").
    Putting these computations in the Action would avoid having JSTL parse each of the ${} arguments, evaluating the expressions, and using costly reflection to turn ${browserBean.order} into browserBean.getOrder().

  • Getting tomcat,JSTL and JNDI working

    I have been trying to get this working for a quite a while now and I am so confused with different versions and this JNDI. All I want to to do as get taglibs working to query a database. I have installed Tomcat 5.5 and downloaded jakarta-taglibs-standard-1.1.2 that told me to copy the two lib files and put them in web app lib folder. What do I do next?

    this what I did based on what I understood from the notes created a web.xml put in the WEB-INF folder
    WEB.XML
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
        PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
        "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    <resource-ref>
      <description>eastenders database</description>
      <res-ref-name>jdbc/eastenders</res-ref-name>
      <res-ref-type>javax.sql.DataSource</res-ref-type>
      <res-auth>Container</res-auth>
    </resource-ref>
    </web-app>alter the sever.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <Server>
      <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
      <Listener className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"/>
      <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"/>
      <GlobalNamingResources>
        <Environment
          name="simpleValue"
          type="java.lang.Integer"
          value="30"/>
        <Resource
          auth="Container"
          description="User database that can be updated and saved"
          name="UserDatabase"
          type="org.apache.catalina.UserDatabase"
          pathname="conf/tomcat-users.xml"
          factory="org.apache.catalina.users.MemoryUserDatabaseFactory"/>
    <Resource name="jdbc/eastenders" auth="Container"
                type="javax.sql.DataSource"
         description="eastenders database"/>
      </GlobalNamingResources>
      <Service
          name="Catalina">
        <Connector
            port="8080"
            redirectPort="8443"
            minSpareThreads="25"
            connectionTimeout="20000"
            maxSpareThreads="75"
            maxThreads="150"
            maxHttpHeaderSize="8192">
        </Connector>
        <Connector
            port="8009"
            redirectPort="8443"
            protocol="AJP/1.3">
        </Connector>
        <Engine
            defaultHost="localhost"
            name="Catalina">
          <Realm className="org.apache.catalina.realm.UserDatabaseRealm"/>
          <Host
              appBase="webapps"
              name="localhost">
          </Host>
        </Engine>
      </Service>
    </Server>and also the context file
    <!-- The contents of this file will be loaded for each web application -->
    <Context>
        <!-- Default set of monitored resources -->
        <WatchedResource>WEB-INF/web.xml</WatchedResource>
        <!-- Uncomment this to disable session persistence across Tomcat restarts -->
        <!--
        <Manager pathname="" />
        -->
      <Resource name="jdbc/eastenders" auth="Container"
                type="javax.sql.DataSource"
         description="eastenders database"/>
    </Context>I don't have the commons files the instructions for the taglibs mentioned nothing about that .
    Your other two questions I don't know how to deploy web apps and I don't know if I am using war files.
    Would your advice to me be forget about these taglibs and just program it using jsp or do you think I should try to get taglibs working?

  • Do you know how to get Tomcat's JNDI example to work? - Help!

    With regards to the example for JNDI Datasource How-To found on Apache's site at http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html
    I did the example as they explained to. But I keep getting "foo - not connected" when I run the "test.jsp" page on my Tomcat server.
    I made the following changes to the example
    1) don't know if this bears any importance, but I've changed wherever it says "TestDB" to "DBTest"
    2) I changed the portion in bold text in this parameter ---
    <parameter>
    <name>url</name>
    <value>jdbc:mysql://localhost:3306/javatest?autoReconnect=true</value>
    </parameter>
    in the server.xml file to localhost:8080 as this is my port # for the tomcat server.
    3) they had the <value> attribute set to org.gjt.mm.mysql.Driver so I changed it to the following...was this incorrect for me to do?
    <parameter>
    <name>driverClassName</name>
    <value>com.mysql.jdbc.Driver</value>
    </parameter>
    Questions and noticeable problems
    1) I'm getting a **END NESTED EXCEPTION ** Attempted reconnect 3 times. Giving up.
    at com.mysql.jdbc.Connection.createNewIO(Connection.java:1780)
    at com.mysql.jdbc.Connection.<init>(Connection.java:427)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:395)
    and the list continues (this is in the dos-prompt window that pops up after starting Tomcat). Unforntunately I'm unable to copy and paste it all into this forum. It also has lines similar to above relating to org.apache.commons.dbcp.DriverConnectionFactory etc.
    2)What am I doing wrong? I really want to get this to work....I'm hoping to eventually learn and apply connection pooling to an application....
    3) is there something somewhere that I'm not "configuring" properly?
    Ask me for any information pertinent to this problem I'm having, and I'll try to post a reply with whatever is requested.
    can anybody help me out??

    With regards to the example for JNDI Datasource How-To
    found on Apache's site at
    http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-da
    asource-examples-howto.html
    I did the example as they explained to. But I keep
    getting "foo - not connected" when I run the
    "test.jsp" page on my Tomcat server.
    I made the following changes to the
    example
    1) don't know if this bears any importance, but I've
    changed wherever it says "TestDB" to "DBTest"This ought to reflect the name of the database you're connecting to in MySQL.
    >
    2) I changed the portion in bold text in this
    parameter ---
    <parameter>
    <name>url</name>
    <value>jdbc:mysql://localhost:3306/javatest?auto
    econnect=true</value>
    </parameter>
    in the server.xml file to localhost:8080 as
    this is my port # for the tomcat server.No, the port number in this case should be the one that the database listener is attached to, not the Tomcat server. Think about what this is doing: it's setting up the database URL, not the Tomcat listener.
    >
    3) they had the <value> attribute set to
    org.gjt.mm.mysql.Driver so I changed it to the
    following...was this incorrect for me to do?
    <parameter>
    <name>driverClassName</name>
    <value>com.mysql.jdbc.Driver</value>
    </parameter>That looks like the name of the MySQL JDBC driver class.
    >
    Questions and noticeable problems
    1) I'm getting a **END NESTED EXCEPTION **
    Attempted reconnect 3 times. Giving up.
    at
    com.mysql.jdbc.Connection.createNewIO(Connection.java:1
    80)
    at
    com.mysql.jdbc.Connection.<init>(Connection.java:427)
    at
    com.mysql.jdbc.NonRegisteringDriver.connect(NonRegister
    ngDriver.java:395)
    and the list continues (this is in the dos-prompt
    window that pops up after starting Tomcat).
    Unforntunately I'm unable to copy and paste it all
    into this forum. It also has lines similar to above
    relating to
    org.apache.commons.dbcp.DriverConnectionFactory etc.
    2)What am I doing wrong? I really want to get this to
    work....I'm hoping to eventually learn and apply
    connection pooling to an application....
    3) is there something somewhere that I'm not
    "configuring" properly?
    Ask me for any information pertinent to this problem
    I'm having, and I'll try to post a reply with whatever
    is requested.
    can anybody help me out??Did you put the MySQL JDBC JARs in your WEB-INF/lib? How 'bout the database connection pool JAR?
    This works. If it's not happening, that means you're doing something wrong. The good news is that you'll find it eventually if you keep digging.

  • Tomcat Connection pooling problem

    I am using Tomcat connection pooling (DBCP) to get the connection from the Database
    It really works great with Oracle, MySQL, Sybase and as well as DB2.
    Recently I tried to integrate apache with tomcat to improve the performance.
    But now the problem is I am unable to load the JDBC Driver its giving me an error message as Cannot load JDBC driver class ?null?
    @ org.apache.commons.dbcp.BasicDataSource.createDataSource ..
    Interseting thing is I am able to get connection through datasource(DBCP) if I use the following URL
    http://localhost:8080/application _name/Hello.jsp
    But I get the error message when I try to get connection through datasource(DBCP)
    as Cannot load JDBC driver class ?null? for this URL
    http://localhost/application_name/Hello.jsp
    Both the URL use same server.xml, httpd.conf,servlet class and jsp pages
    Gurus can you please help me to understand why my application is unable to get the connection when I use this URL http://localhost/application_name/Hello.jsp
    But not with other one
    Please........... Some one help me
    Thanks in Advance
    Maria

    How did you make Tomcat connection pooling(DBCP) working with Oracle?
    I refereced to the "JNDI Datasource HOW-TO" in Jakarta Tomcat. I am using Tomcat 4.18. I can get DataSource object, but when to get connection from dataSource, not any response, It seems freezing.
    I appreciate any reply.
    Johnson Ouyang

  • Jndi problem

    Hi,
    I have to write a simple application that uses jndi to get a jdbc connection.
    I'll try to explain step by step everything what I did. I used Tomcat 5.5.12, SQL Server 2000.
    1. I created a simple web app "jndi" and next I put the jdbc lib to the WEB-INF/lib
    2. I added
    <Context docBase="jndi" path="/jndi" reloadable="true" source="org.eclipse.jst.j2ee.server:jndi">
    <Resource name="jndi/cimmarron_com" auth="Container" type="javax.sql.DataSource"
    maxActive="100" maxIdle="30" maxWait="10000" username="xxx" password="xxx"
    driverClassName="com.microsoft.jdbc.sqlserver.SQLServerDriver"
    url="jdbc:microsoft:sqlserver://localhost:1433;databaseName=db1;password=hib1"/>
    </Context>
    to server.xml . The preceding xml code is between <host> tag
    3. My web.xml file in WEB-INF/ looks:
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlnssi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    <display-name>
    jndi</display-name>
    <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
    </welcome-file-list>
    <resource-ref>
    <description>DB Connection</description>
    <res-ref-name>jndi/cimarron_com</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    </web-app>
    4. At the end, I wrote the simple Main.java :
    package test;
    import javax.naming.*;
    import java.sql.*;
    import javax.sql.DataSource;
    public class Main {
    * @param args
    public static void main(String[] args) throws SQLException,NamingException{
    Context ctx = new InitialContext();
    DataSource source = (DataSource) ctx.lookup("java:comp/env/jdbc/cimarron_com");
    Connection conn = source.getConnection();
    Problems:
    I've got the exception like this:
    Exception in thread "main" javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
    at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:284)
    at javax.naming.InitialContext.lookup(InitialContext.java:351)
    at test.Main.main(Main.java:12)
    and I have web.xml warning "CHKJ4019W: Invalid res-sharing-scope; valid values are "Shareable" or "Unshareable"
    I really don't know where is the problem, I've looked for helping in google for 2 days and I still don't know

    Tourang,
    I have only two suggestions for you (but no answers -- sorry).
    1. Try the JDeveloper and ADF forum.
    2. For your information, "JDeveloper" has an embedded OC4J server. Are you deploying to a different OC4J (_not_ the embedded one) and trying to run your application from the embedded one?
    Good Luck,
    Avi.

  • New version of JDev causing JNDI problems

    We just upgraded to the newest Developer Preview of JDEV and all of a sudden client code that compiled and ran fine under the old version is no longer running. I'm guessing something changed in the libraries, but I'm not sure what and why this is occurring.
    Here's what happened:
    1) It seems that the constructor for InitialContext having a parameter for Properties is no longer available. PITA...but whatever, I switched it to use the Hashtable environment which should I figured work. However:
    2) Upon switching to the new environment passage I get an exception:
    javax.naming.CommunicationException with the topmost stacked function being oracle.oc4j.security.KeyExchange.getKeyAgreement.
    I'm guessing that passing the string password into the environment is no longer acceptable?!? WTF!
    So, does anyone have any suggestions to fix this. I'm sure we should be using jndi.properties and all that jazz, but we have tons of client code that works this way and I'm not about to go changing it all unless I really have to.
    edit: I tried a sample piece of code using jndi.properties file and am getting the same exception. Maybe this is a problem between the two libraries (OC4J server & the lib on JDev??) GRRRRRRR!
    Message was edited by:
    [email protected]

    OK...turned out to be the second one. I guess the new JDEV libs aren't compatible with the older server I'm running? I just had to remove all the Jdev libraries from the project and point them to the libs within the server install.
    So...if anyone else runs into this...that's how I fixed it. Sorry I wasted y'alls time and threadspace :D.

  • Crystal Report JRC and JNDI problem

    I need to convert one of our internal web application from using Crystal Report Server 10 RAS to using Crystal Report XI Java Component (JRC). I found several examples from SAP/BusinessObjects but am stuck with a database connectivity problem.
    The basic enviornment info:
    JBoss 4.0.3 SP1
    Crystal Report JRC XI
    Windows XP/Server 2003
    JDK 1.5.x
    MS SQL Server 2005
    The error I am getting is "Error finding JNDI name (xxx)", although the application is already using the same JNDI and was able to display data on the web.
    I added debug code:
                    Context initialContext = null;
                    try {
                        initialContext = new InitialContext();
                        DataSource ds = (DataSource) initialContext.lookup("java:MYAPP");
                        String t = ds.toString();
                        log.debug(t);
                    } catch (NamingException e) {
                        log.error(e);
    I was able to get the data source successfully. The actual report file uses JDBC with JNDI named as "MYAPP". When I call the viewer, it gives
    Error finding JNDI name (MYAPP)
    message.
    Any comment or help would be appreciated.
    Thanks.

    How are you setting your connection info?
    This is what we do:
    IConnectionInfo connectionInfo = new ConnectionInfo();
    PropertyBag propertyBag = new PropertyBag();                    
    propertyBag.put("JNDI Datasource Name", reportJndiName);
    propertyBag.put("Database DLL", DATABASE_DLL); // required!!! (but we don't actually provide a DLL, or even run in windows)
    connectionInfo.setAttributes(propertyBag);
    connectionInfo.setKind(ConnectionInfoKind.SQL);
    ConnectionInfos connectionInfos = databaseController.getConnectionInfos(null);
    IConnectionInfo oldConnectionInfo = connectionInfos.getConnectionInfo(0);
    databaseController.replaceConnection(oldConnectionInfo, connectionInfo, null, DBOptions._useDefault );

  • Tomcat Servlet Security Problem? : Start Excel with NJAWIN - COMObjects

    I get an exception when I start my programm as servlet , as application it works just fine (when I start it as Servlet in the internal Tomcat from JBuilder it also works fine).
    Application app = new Application(Application.progID); // interfaces built with java2com for Excel
    com.develop.jawin.COMException: 8000ffff: CoCreateInstance for "{024500-00-0000-c000-000000000046}" failed
    at com.develop.jawin.win32.Ole32.CoCreateInstance(Unknown Source)
    at com.develop.jawin.win32.Ole32.GetFromProgID(Unknown Source)
    at com.develop.jawin.DispatchPtr.<init>(Unknown Source)
    at excel2pdf.Excel._Application.<init>(_Application.java:31)
    Actually Excel is started but as SYSTEM and not as my Username. Perhaps there's a problem with the security policy, I already gave all rights to catalina for my whole projekt( each directory of it). Have smb already had this problem? Any Ideas?

    Thanks for answering
    In my case I think I cannot use POI because I need Excel
    and a Virtual Printer , so I can convert excel files with exactly the same
    format to PDF. POI is suppose better idea for creating or manipulating
    OpenOffice files (they are working together with OO on file formats),
    and unfortunately OpenOffice doesnt work fine with charts (I already had
    this solution, openoffice-server and Uno ).
    It must be smth with Tomcat-Configuration or security, because my
    programm is working with the internal tomcat-server of JBuilder, and
    as application too. In both cases Excel is started with my username and
    not SYSTEM (my tomcat server is started as service, perhaps thats why
    by starting excel from my servlet Excel is by user - SYSTEM).

  • Oracle 8i & JNDI Problem

    I am trying to connect to a remote instance of Oracle 8i. The DataSource object is bound, but when I do a lookup I get a null pointer exception.
    Here's the source code so far:
    public class ConnectionManager {
    private static ConnectionManager instance = null;
    private static String USER_NAME = "dyn3";
    private static String PASSWORD = "dyn3";
    private static String DRIVER_TYPE = "thin";
    private static String DATABASE_SERVER_NAME = "3.87.208.60";
    private static int PORT = 1521;
    private static String DATABASE_NAME = "etest";
    private static int MAX_CONNECTIONS = 500;
    public static final String ORACLE_DATABASE_URL = "@3.45.93.127:1521:";
    public static final String ORACLE_DATABASE_SID = "media6";
    private static String BIND_NAME =
    DATABASE_NAME+"@"+DATABASE_SERVER_NAME+":"+PORT;
    private InitialContext initCtx = null;
    * Loads the Oracle JDBC driver
    * @see oracle.jdbc.driver.OracleDriver
    * @see java.sql.DriverManager
    private ConnectionManager() throws Exception {
    try {
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    createOracleDataSource();
    }catch(Exception s) {
    s.printStackTrace();
    throw s;
    private void createOracleDataSource()
    throws SQLException, NamingException {
    DataSource ods = new DataSource();
    ods.setDriverType(DRIVER_TYPE);
    ods.setServerName(DATABASE_SERVER_NAME);
    ods.setDatabaseName(DATABASE_NAME);
    ods.setPortNumber(PORT);
    ods.setUser(USER_NAME);
    ods.setPassword(PASSWORD);
    ods.setMaxLimit(MAX_CONNECTIONS);
    rebind(ods);
    private void rebind(OracleConnectionCacheImpl ods)
    throws NamingException {
    try {
    File directory = new File("jdbc");
    if ( ! (directory.exists()) ) {
    directory.mkdir();
    System.out.println("url= "+directory.toURL().toString());
    Hashtable env = new Hashtable ();
    env.put (Context.INITIAL_CONTEXT_FACTORY,
    "com.sun.jndi.fscontext.RefFSContextFactory");
    env.put (Context.PROVIDER_URL,
    directory.toURL().toString());
    initCtx = new InitialContext(env);
    System.out.println("Context = "+initCtx);
    System.out.println("BIND_NAME="+BIND_NAME);
    initCtx.rebind(BIND_NAME, ods);
    }catch(NameAlreadyBoundException n) {
    //do nothing - this is OK
    }catch(NamingException ne) {
    ne.printStackTrace();
    throw ne;
    }catch(Exception e) {
    e.printStackTrace();
    * Returns an instance of ConnectionManager
    public static ConnectionManager getInstance() throws Exception {
    if (instance == null) {
    instance = new ConnectionManager();
    return instance;
    * Gets a connection to the database
    public Connection getConnection() throws SQLException, NamingException {
    DataSource pds = (DataSource)initCtx.lookup(BIND_NAME);
    return pds.getConnection();
    Can anyone shed some light on this problem? The Oracle manuals aren't much help.
    Thanks!

    You can use internet just to check if the apache server embedded with your oracle, not to verify oracle itself. Open a prompt in your host and try to access it by sqlplus "/ as sysdba" this should let you connect, then verify listener is up and running, lsnrctl status , this will let you know if you are able to connect, next if you want to access it from outside, install an 8i client on a remote pc and configure connectivity files using netca.
    ~ Madrid

  • FS JNDI problem in PI 7.1

    Hi,
    We configured File Based JNDI 1.1.2 in SAP PI 7.0 and it was working fine. But recently we upgraded this to PI 7.1 from then its not working any more.
    In communication channels i could see some error like
    Error connecting due to missing class: com.sun.jndi.fscontext.RefFSContextFactory. Ensure that all resources required are present in the JMS provider library: aii_af_jmsproviderlib.sda
    we have deployed all the necessary libraries. But still we are getting this error.
    Any ideas what's happing here? Pleas  help me out.
    Best Regards,
    Prasad Babu.

    Hi Stefan,
    actually its the problem with the descriptor file. After fixing it i was able to deploy it on the server. Now i configured PI 7.1 JMS communication channel with the module i created and deployed. In communication channel i am getting i am below exception.
    Message processing failed. Cause: javax.ejb.TransactionRolledbackLocalException: Exception raised from invocation of public com.sap.aii.af.lib.mp.module.ModuleData com.Demo.JMSadapterModuleBean.process(com.sap.aii.af.lib.mp.module.ModuleContext,com.sap.aii.af.lib.mp.module.ModuleData) throws com.sap.aii.af.lib.mp.module.ModuleException method on bean instance com.Demo.JMSadapterModuleBean@63120b10 for bean sap.com/DemoJMSEARxml|DemoJMSEJB.jarxml|JMSadapterModuleBean; nested exception is: java.lang.NullPointerException; nested exception is: javax.ejb.EJBException: Exception raised from invocation of public com.sap.aii.af.lib.mp.module.ModuleData com.Demo.JMSadapterModuleBean.process(com.sap.aii.af.lib.mp.module.ModuleContext,com.sap.aii.af.lib.mp.module.ModuleData) throws com.sap.aii.af.lib.mp.module.ModuleException method on bean instance com.Demo.JMSadapterModuleBean@63120b10 for bean sap.com/DemoJMSEARxml|DemoJMSEJB.jarxml|JMSadapterModuleBean; nested exception is: java.lang.NullPointerException; nested exception is: javax.ejb.EJBTransactionRolledbackException: Exception raised from invocation of public com.sap.aii.af.lib.mp.module.ModuleData com.Demo.JMSadapterModuleBean.process(com.sap.aii.af.lib.mp.module.ModuleContext,com.sap.aii.af.lib.mp.module.ModuleData) throws com.sap.aii.af.lib.mp.module.ModuleException method on bean instance com.Demo.JMSadapterModuleBean@63120b10 for bean sap.com/DemoJMSEARxml|DemoJMSEJB.jarxml|JMSadapterModuleBean; nested exception is: java.lang.NullPointerException; nested exception is: javax.ejb.EJBException: Exception raised from invocation of public com.sap.aii.af.lib.mp.module.ModuleData com.Demo.JMSadapterModuleBean.process(com.sap.aii.af.lib.mp.module.ModuleContext,com.sap.aii.af.lib.mp.module.ModuleData) throws com.sap.aii.af.lib.mp.module.ModuleException method on bean instance com.Demo.JMSadapterModuleBean@63120b10 for bean sap.com/DemoJMSEARxml|DemoJMSEJB.jarxml|JMSadapterModuleBean; nested exception is: java.lang.NullPointerException
    Any idea on what could be the problem?
    Am i missing something here. Do i need to adjust any libraries on server?
    Thanks for your help.
    Best Regards,
    Prasad Babu.

  • Reading a global variable from tomcat with JNDI. Example not working

    Hi you can help me to make this example work?
    Context initCtx = new InitialContext();
    Context envCtx = (Context)initCtx.lookup("java:comp/env");
    Object o = envCtx.lookup("testvariable");
    <GlobalNamingResources>
    <Environment name="testvariable" type="java.lang.Boolean" value="false"/>
    Nice greetings Christian

    I found out that in addition to having the JNDI lookup code, you have to
    - have the environment variable declared in the app server configuration
    - have a resource-env-ref entry in your webapp module
    - have the application container bind your named variable with the global variable
    I am using tomcat 5.5, and have done the following. with success.
    the following example uses the default sample environment variable in the tomcat server.xml
    in tomcat server.xml:
    <GlobalNamingResources>
    <Environment
    name="simpleValue"
    type="java.lang.Integer"
    value="30"/>
    </GlobalNamingResources>
    in my application's web.xml:
    <resource-env-ref>
    <description>Test read resource environment variable</description>
    <resource-env-ref-name>simpleValue</resource-env-ref-name>
    <resource-env-ref-type>java.lang.Integer</resource-env-ref-type>
    </resource-env-ref>
    in my META-INF/context.xml (or otherwise, in tomcat's context deployment configuration)
    <ResourceLink name="simpleValue" global="simpleValue"
    type="java.lang.Integer"/>
    Note: in theory, the named resource by your web app could be different from the global environment variable, but here they are the same 'simpleValue'
    This is the really important step, that with out it, nothing works.,
    the context.xml is known to work with tomcat when it exists in META-INF/context.xml inside the .war file (i use war files to deploy, but you should be able to create META-INF/context in an unpacked webapp directory too, and tomcat will find it.,
    I can not say what it is like for other app servers, but this mapping step is the critical point that i discovered after A LOT of hair pulling.
    then, make use of it, i created a jndiTest.jsp:
    <%@ page import="javax.naming.Context" %>
    <%@ page import="javax.naming.InitialContext" %>
    <%@ page import="javax.naming.NamingException" %>
    <%
    try {
    Context initCtx = new InitialContext();
    Context ctx = (Context) initCtx.lookup("java:/comp/env");
    Object o = ctx.lookup("simpleValue");
    %>
    <%=o%><br>
    <%
    catch (NamingException ex) {
    System.err.println(ex);
    %>
    since my server.xml defines the value for 'simpleValue' to be 30, this page displays 30

  • JNDI problems in OC4J

    Hi,
    I'm running OC4J integrated with the SOA Suite 10.1.3.3.
    I have a legacy web service created with XFire and deployed in OC4J, lets call it HelloWorldService. I would like to bind a POJO object from within this service with JNDI.
    I would then like to lookup this object from another web service which is a EJB3 session bean, deployed in the same OC4J instance. Lets call it LookupBean.
    I can see in the JNDI browser that the POJO is bound under the HelloWorldService. But when i try to lookup the POJO i get an error saying that the POJO cannot be found.
    This is how i bind the POJO from HelloWorldService
    Context initialContext = new InitialContext();
    initialContext.bind("HelloWorldServicePOJO", obj);
    This is how i try to do the lookup from LookupBean:
    Hashtable env = new Hashtable();
    env.put("java.naming.factory.initial",
    "com.evermind.server.rmi.RMIInitialContextFactory");
    env.put("java.naming.provider.url","ormi://localhost:12401/HelloWorldService");
    //env.put("java.naming.provider.url","opmn:ormi://localhost:6003:home/HelloWorldService");
    env.put("java.naming.security.principal","oc4jadmin");
    env.put("java.naming.security.credentials","oc4jadmin");
    Context context = new InitialContext(env);
    POJO obj = (POJO) context.lookup("HelloWorldServicePOJO");
    I have tried also with the out commented line above, but it does not work. What can be wrong?
    Thanks,
    Mattias

    Hi,
    thanks for the link, but I already knew it and read a lot in it. I still don't get what exactly is going wrong. I replaced the jgroups-core.jar by my jgroups-jar which results in the same exception. It also seems that somehow the commons-logging.jar-classes from /webservices is being loaded even though it's not in the classpath of my application. I noticed this when I replaced every commons-logging.jar by the commons-logging-api.jar from JCL 1.0.4 (which we use in our application) since my EJBs could not be loaded then due to the following problem:
    06/08/04 15:34:42 oracle.oc4j.admin.internal.DeployerException: java.lang.InstantiationException: Error initializing ejb-modules: [cms-core:pbb-jms-receiver-1.0:Importer_Topic] - Unable to load ejb-class com.pironet.pbng.jms.mdb.asynchron.ImporterTopicSubscriber, see section 23.2 of the EJB 2.1 specificationjava.lang.ExceptionInInitializerError
    06/08/04 15:34:42 at oracle.oc4j.admin.internal.ApplicationDeployer.addApplication(ApplicationDeployer.java:510)
    06/08/04 15:34:42 Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Category
    06/08/04 15:34:42 at java.lang.Class.getDeclaredConstructors0(Native Method)
    06/08/04 15:34:42 at java.lang.Class.privateGetDeclaredConstructors(Class.java:2328)
    06/08/04 15:34:42 at java.lang.Class.getConstructor0(Class.java:2640)
    06/08/04 15:34:42 at java.lang.Class.getConstructor(Class.java:1629)
    06/08/04 15:34:42 at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:410)
    06/08/04 15:34:42 ... 27 more
    It seems like the initialization of the jchannel happens, even though it's being initialized in my application, in one of the classloaders which don't have access to my libs...and I'm definitely not going to add all my jars into locations the root-classloader (or whoever) has access to.

  • Apache + 2 Tomcats session replication problem.

    Greetings everyone.
    Before stating the problem, let me explain how my environment is set.
    I have two machines. One (PC1) running Apache (HTTP server 2.0.58)
    and one instance of Tomcat (5.0.28) and another machine (PC2) with
    another instance of Tomcat(5.0.28).
    The Apache server
    It is configured to handle static content, to redirect dynamic content to a
    Tomcat instance through AJP 1.3 connector.
    This process is done through the mod_jk and the workers.properties
    The workers.properties file is configured to have sticky_session = True
    so it assigns a SESSION_ID to the same Tomcat it was first assigned.
    The workers.properties file is configured to have
    sticky_session_force = True so if the Tomcat the SESSION_ID was
    assigned is not available, the server answers with a 500 error.
    The Tomcat servers
    Both have only the AJP 1.3 connector enabled
    Both have the Cluster tag from the server.xml file uncommented
    and the useDirtyFlag flag set to false, for not to allow SESSION
    replication between Tomcats.
    The workers.properties file
    workers.apache_log=C:/Apache2/logs
    workers.tomcat_home=C:/Tomcat5
    workers.java_home=C:/j2sdk1.4.2_13
    ps=/
    #Defining workers -----------------------------
    worker.list=balancer,jkstatus
    #Defining balancer ---------------------------
    worker.balancer.type=lb
    worker.balancer.balance_workers=tel1, tel2
    worker.balancer.sticky_session=True
    worker.balancer.sticky_session_force=True
    worker.balancer.method=B
    worker.balancer.lock=O
    #Defining status -----------------------------
    worker.jkstatus.type=status
    worker.jkstatus.css=/jk_status/StatusCSS.css
    #Workers properties ---------------------------
    worker.tel1.type=ajp13
    worker.tel1.port=8009
    worker.tel1.host=127.0.0.1
    worker.tel1.lbfactor=1
    worker.tel1.socket_keepalive=False
    worker.tel1.socket_timeout=30
    worker.tel1.retries=20
    worker.tel1.connection_pool_timeout = 20
    #worker.tel1.redirect=tel2
    worker.tel1.disabled=False
    worker.tel2.type=ajp13
    worker.tel2.port=8009
    worker.tel2.host=199.147.52.181
    worker.tel2.lbfactor=1
    worker.tel2.socket_keepalive=False
    worker.tel2.socket_timeout=30
    worker.tel2.retries=20
    worker.tel2.connection_pool_timeout = 20
    #worker.tel2.redirect=tel1
    worker.tel2.disabled=False
    THE PROBLEM
    I open a browser in the jk-status page to see how the Tomcat instances are
    working, and both are working fine: Stat -> OK, now as the
    loadbalancing factor is 1 on both Tomcats, an even alternating session
    distribution is set.
    While this browser is open to keep an eye on the status, I open a new
    browser (B1)to connect to my Web Application, Apache answers
    correctly and gives me a SESSION_ID for Tomcat instance 1 [both
    instances are OK], if I make a simple refresh, my SESSION_ID is still the
    same so I'm assigned to Tomcat instance 1 but this time I get an
    ERROR 503 - Service unavailable but looking at the status of the
    Tomcat instances both instances are still OK, no-one is down. And it
    stays throwing this error for as many refreshes i do.
    Now, I open a new browser (B2)and do the same process as before,
    as expected, Apache now gives me a SESSION_ID for Tomcat instance 2,
    repeating the same refreshing process, the error is thrown again, but still at
    the jk-status page, both instances are fine.
    Without closing these windows, I make a new refresh try on B1 and
    even though the jk-status says both Tomcat instances are OK, the error
    is still thrown. I open a third one (B3), and Apache again, correctly
    gives me a new SESSION_ID for Tomcat instance 1 and answers
    correctly on the first call. But once again if i repeat the refreshing process, the
    error is thrown again.
    Note: Using a different resolution to always keep and eye on the
    instances status and using a refresh rate of 1 second for status, both
    servers always were OK.
    So the main problem is that somehow when the session is replicated
    to the same tomcat, Apache confuses and thinks it is not available, when
    asking it through the jk-status it tells it is OK
    I've been trying different configurations with both Apache and Tomcat,
    but there must be something missing since I don't get it to work correctly
    Thanks in advance for all your helping comments.
    - @alphazygma

    Whew... that was quite an answer... definitely is going to help him a lot. Yeah any n00b by now should know how to use google, but that's not the point in this forums, here we are to help each other. and wether you like it or not many of us deploy applications to tomcat and stumble on this. So dont try to be cool posting this kind of answers like google this or google that if you dont have an answer please dont comment you will appear to be more noobish than you aparently are.
    Well enough talking.
    I found the following useful: (it comes in the server.xml of the tomcat configuration)
    <!-- You should set jvmRoute to support load-balancing via JK/JK2 ie :
    <Engine name="Standalone" defaultHost="localhost" debug="0" jvmRoute="jvm1">
    -->
    Enabling that entry on both machines should be enough.
    Aparently the problem is not with apache. is with tomcat since it can't retain the session apache gives.
    more information in the Tomcat help at:
    http://tomcat.apache.org/tomcat-5.0-doc/balancer-howto.html#Using%20Apache%202%20with%20mod_proxy%20and%20mod_rewrite

  • Tomcat 6 - apache problem

    Hello,
    this is my first post, and I hop that someone here can help me.
    I want to create ajp connection.
    server.xml:
    <Connector port="8010" protocol="AJP/1.3" redirectPort="8444" />
    httpd.conf:
    LoadModule jk_module /usr/lib/apache2/modules/mod_jk.so
    JkWorkersFile /etc/libapache2-mod-jk/workers.properties
    JkLogFile /var/log/apache2/mod_jk.log
    JkLogLevel info
    JkMount /test/. test_worker
    JkMount /test/* test_worker
    JkMount /test test_worker
    JkOptions ForwardKeySize ForwardURICompat -ForwardDirectories -ForwardLocalAddress
    JkRequestLogFormat "%w %V %T"
    workers.properties:
    workers.tomcat_home=/etc/apache-tomcat-6.0.24
    workers.java_home=/home/sloba/jdk1.6.0_18/jre/
    ps=/
    worker.list=test_worker
    worker.test_worker.port=8010
    worker.test_worker.host=localhost
    worker.test_worker.type=ajp13
    worker.test_worker.lbfactor=1
    worker.loadbalancer.type=lb
    worker.loadbalancer.balance_workers=test_worker
    problem is that I have servlet jAjax, and I cannot get to him thru apache
    I can manage this
    localhost:8081/test
    localhost:8081/test/jAjax
    localhost/test
    I cannot manage this
    localhost/test/jAjax
    tomcat 6.0.24
    apache 2.0
    ubuntu 9.10
    if you need more info just ask,
    ps. sorry for my poor English.

    Thanks for replay.
    I found problem.
    I use ajax with jsp, and problem is that I need to change path of servlet in my request method
    from
    localhost:8081/test/jAjaxto
    localhost/test/jAjaxThank you.
    Best regards ..

Maybe you are looking for

  • Problems with pdf files on OSX10.9

    since updating I cannot save files in pdf format to desktop cloud or evernote also cannot save scans from HP 4700 irritating and apparently no fix any help out there?

  • Modify Std. code to get value for User Exit.

    I am executing release strategry at user exit EXIT_SAPLEBND_002  ( Exit Name M06E0004 ), for the field ( USRN1) This has got user program ZXM06U22 in it. In this exit I get values from I_CEKKO , IT_BEKPO, IT_BEKET, IT_EKKNU and I have to pass the PO

  • I'm receiving a "blocked plug-in" message in Safari

    A user in my group has recently upgraded to Mac OS 10.8.4. The user has recently started receiving the following message when logging into workamajig and a few other sites: "Blocked plug-in" And no access to the requested site. I've tried updating Ad

  • Can i reverse a never for this websit click on ipad safari

    A colleague clicked never for this website when she borrowed my ipad to check her facebook page, can ireverse this? Thanks

  • Storage Quota Limit on MySite

    I have a storage quota limit set to 100 MB (default by SharePoint) for MySite site collections. But I encountered a user who went over it to 115 MB. Hence this error gets logged every hour in ULS and Windows Event Application Logs: Your changes coul