Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

Apache 1.3 to Tomcat 4 *strange* problem

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I linked apache 1.3 to Tomcat 4 on WinXP and ran most sample jsp or servlet given in Tomcat, most of them havent problem EXCEPT the 'Naming' Servlet at http://127.0.0.1/user/servlets/index.html
if I ran through http://127.0.0.1:8080/user/servlet/JndiServlet , fine; but http://127.0.0.1/user/servlet/JndiServlet , error code will return like this::
JNDI lookup failed : javax.naming.NameNotFoundException: Name maxExemptions is not bound in this Context
list() on /comp/env Context :
Binding : mail: org.apache.naming.NamingContext
Binding : minExemptions: java.lang.Integer
Binding : ejb: org.apache.naming.NamingContext
Binding : name3: java.lang.Integer
Binding : foo: org.apache.naming.NamingContext
listBindings() on /comp/env Context :
Binding : mail: org.apache.naming.NamingContext rg.apache.naming.NamingContext@d36dfe
Binding : minExemptions: java.lang.Integer:1
Binding : ejb: org.apache.naming.NamingContext rg.apache.naming.NamingContext@86c730
Binding : name3: java.lang.Integer:1
Binding : foo: org.apache.naming.NamingContext rg.apache.naming.NamingContext@7f242c

Based on my observation, error is caused by "java:/comp/env/maxExemptions",etc, but how I can solve this on linked via Apache? Thanks!!
----------------------------------------
Source Code for Naming Example
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Enumeration;
import java.util.Hashtable;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.naming.NamingException;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingEnumeration;
import javax.naming.directory.InitialDirContext;
/**
* Demonstration of the web application environment support.
*
* @author Remy Maucherat
*/
public class JndiServlet
extends HttpServlet {

public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {

PrintWriter out = response.getWriter();
response.setContentType("text/plain");

Context ctx = null;

try {
ctx = new InitialContext();
} catch (NamingException e) {
out.println("Couldn't build an initial context : " + e);
return;
}

try {
Object value = ctx.lookup("java:/comp/env/maxExemptions)";
out.println("Simple lookup test : ");
out.println("Max exemptions value : " + value);
} catch (NamingException e) {
out.println("JNDI lookup failed : " + e);
}

try {
Context envCtx = (Context) ctx.lookup("java:/comp/env/");
out.println("list() on /comp/env Context : ");
NamingEnumeration enum = ctx.list("java:/comp/env/");
while (enum.hasMoreElements()) {
out.print("Binding : ");
out.println(enum.nextElement().toString());
}
out.println("listBindings() on /comp/env Context : ");
enum = ctx.listBindings("java:/comp/env/");
while (enum.hasMoreElements()) {
out.print("Binding : ");
out.println(enum.nextElement().toString());
}
} catch (NamingException e) {
out.println("JNDI lookup failed : " + e);
}

}
 
Saloon Keeper
Posts: 24528
167
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It wants an entry at /comp/env/maxExemptions and is finding none. Do you have a (properly capitalized) definition for it in your web.xml file? You have a minExemptions, according to your display code, but no maxExemptions.
 
Tazzmission
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But in web.xml in tomcat dir, I can't find any keyword of "minExemptions"/"maxExemptions".
And, this java has no problem when calling in directly via http://...:8080/.... but problem only occurs when calling via http://.../... with the help of tomcat.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
minExemptions and maxExemptions are set in the server.xml file.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic