Good, cheap, non-tomcat servlet container?

Specifically, not using the Jasper jsp compiler, as it can't be counted on to recompile a changed .jsp (see http://issues.apache.org/bugzilla/show_bug.cgi?id=33453). I am frustrated with Apache software quality and (lack of)support, and searching for alternatives to Tomcat. It would also have to either work with JBoss or include an EJB stack with similar functionality to JBoss.
I have looked at Sun Application Server, which appears to use Tomcat in its entirety, and Jetty, which uses Jasper.

Here's a quote from Resin ML archive:
<quote>
From Resin users ML archive:
Q:
I have a general question about the most effective way to process JSP page
updates.
My impression of the JSP engine is that in the event of a change to the JSP
file (changed file modification date), the JSP page is automatically
recompiled and reloaded. This is a great feature -- it means you have the
flexibility that is often found in interpreted languages like Perl in terms
of not having to restart the server when changes are made.
Unfortunately for me, that flexibility breaks down when I start including
JavaBeans, or other Java classes into my JSP pages through the "import"
directive. There doesn't seem to be any way to make a JSP page also
dependent on another external class file, and to force recompilation if
that external class file
Here's an example...
start of file MyJSP.jsp...
<@ page language=java
import="com.mycompany.MyClass,caucho.sql.db.*,java.io.*" />
....some JSP code mixed with HTML....
end of file MyJSP.jsp
For the above JSP file, the servlet engine doesn't seem to recognize that
the JSP page is dependent on the file "com.mycompany.MyClass". If I make
any changes to the file MyClass.java and recompile, the changes won't take
effect until I restart the servlet engine.
Any thoughts on how to make a JSP file explicitly dependent on another
external file?
I suppose you could try to use a utility like make to help manage
dependencies, but this gets ugly -- especially for compiled JSP page
servlet classes which are temporary anyways. Any suggestions for a solution
to this problem?
----- Bryan Bunch
A:
You don't actually need to recompile the JSP pages, you just need them
reloaded. JSP pages are just like any other Java classes; you usually can
compile classes independently. The only case where you need the JSP pages
recompiled is if you change 'final static' constants.
If your classes are in the global classpath, there's nothing Resin can do. I
don't know how you're loading your classes like com.mycompany.MyClass.
However, you can put them in WEB-INF/classes or in a jar in WEB-INF/lib. When
any class/jar in either changes, Resin will reload the entire application
including any JSPs. I'm pretty sure this is what you want.
Resin lets you add to the auto-update class path. Here's how:
<http-server>
<classpath id='/home/myhome/ws/classes'/>
<classpath id='/home/myhome/ws/myjar.jar'/>
</http-server>
If any of the classes in /home/myhome/ws/classes changes, Resin will reload
the application just like it reloads a JSP.
If you're really daring, you can have Resin compile your beans for you.
(There are a few important bugs fixed in the latest snapshot, so you would
want to use the snapshot.) That way, you get auto-compilation and
auto-loading of your beans when you change any Java source. This is certainly
helpful for small test cases, but it can get confused for large projects.
<classpath id='/home/myhome/ws/classes' source='/home/myhome/ws/src'/>
-- Scott
</quote>

Similar Messages

  • Tomcat servlet/JSP container default files on 10gAS(10.1.2.0.2)

    Hi Friends,
    I am using Oracle Application Server 10g (10.1.2.0.2) on windows
    I have the Vulnerability: Apache Tomcat servlet/JSP container default files.
    and the fix is Review the files and delete those that are not needed.
    i would like to know the location of the files to review and delete.Please suggest?
    Regards,
    DB

    Apache/Tomcat is not related to OAS, where did you get this info? OAS is based in a Orion Web Server and Apache HTTP Server, not Tomcat.
    For this kind of problems there are the CPU you may want to check in Metalink for them.
    Can you clarify also what default files?
    Greetings.

  • Running in Servlet Container or Standalone?

    How can I detect if I'm running in a servlet container or a standalone application?
    if ( iAmRunningInAServletContainer() )
      // do this
    else
      // do thatIs there a System property that all servlet containers set? I can't find any.

    Hopes this helps,
    http://java.sun.com/blueprints/guidelines/designing_webservices
    I use jaxrpc and tomcat to host web services. It works good as long the web services don't need to be invoked internal to the app. I don't like working with anything other than the remote interface (ex. gen'd stubs) when calling remote methods from within my app. I think that hosting a web service in an ejb container allows you to access the service with jndi. That would be a nice feature to have. Although, if I used an ejb container I would change my implementation so that the web service proxy'd to an ejb and all internal access would use the ejb where external would go through the web service.
    Matthew

  • Subject.getSubject in servlet container

    Hi All,
    Interested if the following code will produce a Subject that was authenticated by a JAAS module.
    This code is to be executed in the servlet container after the LoginModule.login() was done and number of subsequent requests to the secured web/ejb resources.
    AccessControlContext context = AccessController.getContext();
    return Subject.getSubject(context);The reason for this question is a LoginContext.logout API. I will need a subject to logout with.
    From what I read on JAAS and security implementation in different containers, they all have a way of getting to the current request Subject, but all of the ways a proprietary as they require a call to the app server specific API. I would like to have a portable application and would like not to create factories and facades to hide the proprietary APIs from end user. The above code is the only one I know in JDK that will achive that goal but I haven't tested it in any servlet/ejb container yet.
    I can always pop a Subject into an HttpSession after a login, but I don't know if that is the correct usage pattern or Subject.getSubject should be used or app server specific api should be used.
    It seems that all of the articles that talk about JAAS are dealing with a stand-alone clients accessing EJBs, and none go into a detailed analysis of JAAS in a web application or discuss usage patterns for web apps.
    Thanks
    Dmitry

    Hi,
    the issue you are facing will probably be discussed in the next version of the Servlet spec. As of now, getting the Subject from the AccessControllerContext is one possibility (PE 8.0 does it), but other container may not do it.
    In Tomcat and PE, you can retrieve the Subject using the HttpSession key: javax.security.auth.subject.
    Still, this will not be portable. So adding your own key is probably the way to go if you look for portability.
    Thanks
    -- Jeanfrancois

  • Using JDO in a Servlet container/app server

    Hi,
    I was just wondering what Solarmetric recommends when using Kodo in a
    servlet container/app server. Specifically the following:
    1. Should each user session maintain a PersistenceManager or should the
    PM be created per request? I am thinking it might be expensive to
    maintain PMs across requests since you may have idle sessions and the
    PMs may hold database resources? But since PMs aren't pooled in Kodo is
    creating/closing a PM per request expensive or is it offset by Kodo's
    connection pooling?
    2. Is it advisable to store data to be displayed on a JSP by storing the
    JDO instances themselves or serializable proxies (simple data beans) of
    these objects in a user's session?
    3. If you can store the JDO instances in the session, do you need to
    make them transient instances using makeTransient() and call close() the
    PersistenceManager?
    Thanks in advance,
    Khamsouk

    These are all very good questions. There really is no one right answer to any
    of them, so I'll just try to educate you on the issues involved and you can
    make your own decision. Hopefully other people who are actually using Kodo
    in a servlet/JSP environment will chime in too.
    1. Should each user session maintain a PersistenceManager or should the
    PM be created per request? I am thinking it might be expensive to
    maintain PMs across requests since you may have idle sessions and the
    PMs may hold database resources? But since PMs aren't pooled in Kodo is
    creating/closing a PM per request expensive or is it offset by Kodo's
    connection pooling?As long as you are outside of a datastore transaction, a PM does not maintain
    any database resources. The only significant state it maintains is a soft
    cache of persistent objects that have already been instantiated. If you are
    using Kodo 2.3 RC1 and have no set the
    com.solarmetric.kodo.DefaultFetchThreshold property to -1, then some
    large collections you obtain from query results or relation traversals may be
    scrollable result sets on the back-end, in which case they obviously maintain
    some database resources.
    2. Is it advisable to store data to be displayed on a JSP by storing the
    JDO instances themselves or serializable proxies (simple data beans) of
    these objects in a user's session?
    3. If you can store the JDO instances in the session, do you need to
    make them transient instances using makeTransient() and call close() the
    PersistenceManager?I'll address these together. JDO fully supports serialization, and in fact
    I think you'll find it does so in exactly the way that you want. If you choose
    to store serialized persistent objects in the session, then during
    serialization the objects will transparently pull in all of their persistent
    state and relations, so the entire object graph is serialized. When you
    deserialize, the objects will no longer be attached to their persistence
    manager -- they will be transient.
    Another options is to store the object IDs in the session, and re-retrieve
    the persistent objects for each web request.
    One design pattern that can probably net very good performance is to maintain
    a global read-only persistence manager that you use to dereference these IDs.
    Of course, if you ever want to change an object, you'll have to re-fetch it
    in a new persistence manager, and evict it from the global manager's cache.
    I hope this helps.

  • Tomcat Servlet - TCP Port Already in Use?

    My problem is that tomcat/servlet is not releasing its TCP port after my servlet closes the port. Next time a servlet tries to use the port it gets an error "Port already in use". Using netstat I can see the port is still in use. If I stop tomcat and restart it, the port is released. I have not had this sort of problem writing C programs that use sockets.
    My setup is Fedora Core 6 with JDK1.5_14 and Tomcat 5.5.26. I know it's not the latest, but sockets and streams have been around for a long time.
    Actual implementation uses a trivial javaserver page to instantiate a class to create/accept connection from a client (JApplet). After connection, it starts a thread to receive data. I am using ServerSocket(), InputStreamReader(), and OutputStreamWriter(). On ServerSocket I set ReuseAddress to true.
    I have try/catch on all my I/O and use tomcat context log for error and OK messages. Data transfer is perfect. Detect close by client works. In the context log I see close of streams and ServerSocket occur with no exceptions. Then, I manually close the jsp window. No indication of any problems. If I use different port 2nd time (e.g. 50001) it all works perfect. If I use my default (50000) again, servlet gets an error during bind, "Port already in use".
    2.5 years with Java. 5 years with Linux and C.
    Please advise or refer

    rwengr wrote:
    My problem is that tomcat/servlet is not releasing its TCP port after my servlet closes the port. Next time a servlet tries to use the port it gets an error "Port already in use". Using netstat I can see the port is still in use. If I stop tomcat and restart it, the port is released. I have not had this sort of problem writing C programs that use sockets.Nice.... Not sure that matters though.
    >
    My setup is Fedora Core 6 with JDK1.5_14 and Tomcat 5.5.26. I know it's not the latest, but sockets and streams have been around for a long time.
    Actual implementation uses a trivial javaserver page to instantiate a class to create/accept connection from a client (JApplet). Bleah! Don't use a JSP for that. Use a servlet at worst. At best use a Servlet to start some other socket manager class which you can/have tested outside the Servlet Container environment.
    After connection, it starts a thread to receive data. I am using ServerSocket(), InputStreamReader(), and OutputStreamWriter(). On ServerSocket I set ReuseAddress to true.
    I have try/catch on all my I/O and use tomcat context log for error and OK messages. Data transfer is perfect. Detect close by client works. In the context log I see close of streams and ServerSocket occur with no exceptions. Then, I manually close the jsp window. Closing the browser window has no affect on the server.
    No indication of any problems. If I use different port 2nd time (e.g. 50001) it all works perfect. If I use my default (50000) again, servlet gets an error during bind, "Port already in use".
    2.5 years with Java. 5 years with Linux and C.
    Please advise or referShow some code. If you just want some generic advice it would be to close the port, as soon as you don't need it anymore. But you know that. Without any further code I think that is about all that can be said.
    P.S. Make the code as small as possible, compilable, but still demonstrating the problem. Also see: [this tutorial as an example...|http://www.javaworld.com/javaworld/jw-12-1996/jw-12-sockets.html?page=1]

  • Non-http servlet without headers

    I would like to create a servlet that does not respond to web requests, but to invocations by client sockets (on port 80).
    It all goes well, but even if I use a simple Servlet implementation, the web server wraps the response into a http response, and adds headers, which is unnecessary at all times. How can I avoid this?
    I use JBoss/Tomcat for container.

    Hi,
              import java.io.*;
              import javax.servlet.*;
              public class Helloservlet extends GenericServlet {
              public void service(ServletRequest req,ServletResponse res) throws
              ServletException,IOException {
              res.SetcontentType("text/html");
              PrintWriter pw = new PrintWriter();
              pw.println("<b>HelloWorld"); pw.close();
              The above example code for GenericServlet that is not specific to the http.
              Regards
              Anilkumar kari

  • How to provide web service in servlet container?

    If I want my servlet container to provide web service (JAX-RPC), how should I implement it?
    I'm using Tomcat/Resin as servlet container. Thanks in advance!

    It depends on what standard you are conforming to. Even though some specifications allow you to switch protocols, http is the dominating standard. WS-I, for example, requires the http protocol.
    Klas

  • How to get list of jar files loaded by servlet container.

    Hi,
    I need to display in my servlet program about the list of jar files loaded by servlet container. Does it vary for each servlet container or is it same. Where can I get those details.
    I need to write code to support tomcat 4x, iplanet 5.0 and websphere 6.0.
    Thanks & Regards,
    Nasrin.N

    For curious, here are output prints for all 3 methods:
    1) parsing system property
    2) tschodt
    3) overcast SystemClassLoader to URLClassLoader
    /home/espinosa/workspace/jboss_embedded_test1/target/test-classes
    /home/espinosa/workspace/jboss_embedded_test1/target/classes
    /opt/javalibs/javax/ejb/ejb-api/3.0/ejb-api-3.0.jar
    /opt/javalibs/javax/jms/jms/1.1/jms-1.1.jar
    /opt/javalibs/javax/annotation/jsr250-api/1.0/jsr250-api-1.0.jar
    package com.sun.org.apache.xerces.internal.impl.validation, Java Platform API Specification, version 1.6
    package com.thoughtworks.qdox.directorywalker
    package com.sun.org.apache.xerces.internal.parsers, Java Platform API Specification, version 1.6
    package java.util.jar, Java Platform API Specification, version 1.6
    package org.testng.internal.thread
    package com.sun.org.apache.xerces.internal.util, Java Platform API Specification, version 1.6
    package java.net, Java Platform API Specification, version 1.6
    package sun.reflect.misc, Java Platform API Specification, version 1.6
    package esp.ejb.samples1.test
    package sun.security.provider, Java Platform API Specification, version 1.
    file:/home/espinosa/workspace/jboss_embedded_test1/target/test-classes/
    file:/home/espinosa/workspace/jboss_embedded_test1/target/classes/
    file:/opt/javalibs/javax/ejb/ejb-api/3.0/ejb-api-3.0.jar
    file:/opt/javalibs/javax/jms/jms/1.1/jms-1.1.jar
    file:/opt/javalibs/javax/annotation/jsr250-api/1.0/jsr250-api-1.0.jar
    ...Interestingly, method 1 and 3 gives the same list, same order, same count, just format of item is a little bit different. The order is same as in Eclipse .classpath file.
    Method 2 (tschodt) give significantly more items! rougly 3x! Different order (somewhat random it seems to me). Some items contain extra information, like version and string "Java Platform API Specification".
    It prints not absolute paths but logical Java names.

  • Servlet Container, how many containers?

    i heard that there are several containers in java to execute the java application.. i know few details about servlet container.. which will act as container to process java programs..etc,
    can anyone explain me what are other containers available?

    i heard that there are several containers in java to
    execute the java application.. i know few details
    about servlet container.. which will act as container
    to process java programs..etc,Different kinds of containers, sure. Servlets/JSPs run in a servlet/JSP container, EJBs run in an EJB container.
    There are several implementations of each: Tomcat and Jetty for servlets/JSPs, WebLogic and JBOSS for EJBs.
    >
    can anyone explain me what are other containers available?Which others did you have in mind?
    %

  • Non-HTTP servlet

              I need to support concurrent access from multiple clients using a non-HTTP protocol
              over socket connection. One way is to write my socket server and create a new
              thread for each request. But WLS forbids user-created threads from calling into
              WLS components such as EJB. So I would like to write a non-HTTP servlet so that
              the WLS servlet container will create a new thread calling into the servlet and
              have the servlet calling EJBs on this WLS created thread. But is there a way to
              plug a subclass of GenericServelt into WLS?
              Thanks,
              T Tse
              

    I don't think there is a way to use non-HTTP servlet's, but still you can use WLS
              execute queue and execute threads, for example:
              ServerSocket serverSocket = new ServerSocket(...);
              for(;;) {
              new MyThread(new RequestHandler(serverSocket.accept())).start();
              class RequestHandler implements Runnable {
              Socket socket;
              public RequestHandler(Socket socket) {
              this.socket = socket;
              public void run() {
              // to see if this is executing on a WebLogic execute thread
              new Exception().printStackTrace();
              try {
              socket.close();
              } catch(Throwable whatever) {}
              class MyThread implements Schedulable, Triggerable {
              boolean done = false;
              Runnable runnable = null;
              Object sync = new Object();
              ScheduledTriggerDef std;
              public void join() throws InterruptedException {
              synchronized(sync) {
              if(!done) {
              sync.wait();
              public void run() {
                   if(runnable != null) {
                   runnable.run();
              public MyThread() {
              public MyThread(Runnable runnable) {
                   this.runnable = runnable;
              public boolean start() {
                   boolean ok = false;
                   try {
                   T3ServicesDef t3 = (T3ServicesDef)(new InitialContext()).lookup("weblogic.common.T3Services");
                   std = t3.time().getScheduledTrigger(this, this);
                   std.schedule();
                   ok = true;
                   } catch(NamingException ne) {
                   System.out.println(ne.getMessage());
                   } catch(TimeTriggerException tte) {
                   System.out.println(tte.getMessage());
                   return ok;
              public void trigger(Schedulable sched) {
                   try {
                   run();
                   } catch(Throwable t) {
                   System.out.println(t);
              synchronized(sync) {
              done = true;
              sync.notify();
              public long schedule(long time) {
                   return done ? 0 : 1;
              ttse <[email protected]> wrote:
              > I need to support concurrent access from multiple clients using a non-HTTP protocol
              > over socket connection. One way is to write my socket server and create a new
              > thread for each request. But WLS forbids user-created threads from calling into
              > WLS components such as EJB. So I would like to write a non-HTTP servlet so that
              > the WLS servlet container will create a new thread calling into the servlet and
              > have the servlet calling EJBs on this WLS created thread. But is there a way to
              > plug a subclass of GenericServelt into WLS?
              > Thanks,
              > T Tse
              Dimitri
              

  • Should I install Apache Web server to use Jakarta Tomcat Servlet engine?

    Hello,
    I have some problems and now have a question:
    Should I install Apache Web server to use Jakarta Tomcat Servlet engine?
    JTK home page is available via http://localhost:8080
    Tomcat ver 3.1.3
    Thanks.

    No, you don't need to run Apache webserver (httpd) to run Tomcat. Tomcat by default runs on port 8080, but you can set it to any port, including 80, if you have permission to do so (on *nix systems, you need root permissions to run services on any port below 1024).
    Tomcat is a webserver as well, just one that includes a servlet container and JSP processor. So it will serve your html files, images, etc (aka static content), just as well as Apache httpd, in addition to being able to run servlets and JSPs.
    Apache httpd has more options for serving static content than Tomcat, so many people prefer to use it as their main webserver and only use Tomcat as a sort of "plugin" to handle servlets and JSPs. This can be achieved through a connector. Instructions on how to set this up are on the Jakarta website.
    So you could use Apache and Tomcat combined, next to each other, or totally separated. In many cases, just Tomcat will do.

  • Non-http servlet engine?

    Hi, I'm new to servlet development and I'm not sure this question has been answered here before. So I apologize if it has.
    Basically I want to have an integrated server that can accept both http and non-http requests. So my initial thought was to write an HttpServlet and a GenericServlet. Then I googled for clues on how to implement that and found from the JavaRanch website http://faq.javaranch.com/java/ServletsFaq#otherProtocols that this task could be a daunting one because that'd imply that I have to write a new servlet engine.
    So my question is, is this true in your expert opinion? And, if the custom non-http protocol has a similar syntax as http (e.g. RTSP), is it possible to just extend the http servlet engine to support it? And would that be doable without much effort?
    Thanks,
    Liang.

    Would you actually need the entire servlet system for the new protocol? For your typical simple request/reply protocol you'd normally:
    Create a server socket.
    When a connection arrives, start a thread to service it.
    In the service thread, read and parse request.
    Send reply.
    Close socket, exit thread.
    A servlet system adds a bunch of stuff to that: a layer that allows you to configure pluggable request handlers; methdod-specific functions (POST -> doPost()); a ServletRequest object; etc. Are those things relevant to the new protocol? Do you have requests with URL-like things in the header, allowing routing requests to different servlets? Do you plan to have lots of servlets for the protocol (one servlet -> no much point in XML-configurable request routing)?
    I'd hope that I wouldn't need to implement a configurable request routing infrastructure. It's a lot of work if it's not really needed. Just write a socket server. If you have an associated web server (e.g. HTML pages from which the user starts RTSP requests) you can even run the socket server inside the servlet container if that helps.

  • ARE THERE ANY WAYS BY WHICH I CAN FIND THE Appln Servlet Container Memory

    ARE THERE ANY WAYS BY WHICH I CAN FIND THE Appln Servlet Container Memory .

    You can check out Tomcat memory usage using Tomcat Manger
    and clicking server status.
    It gives the information like this
    Free memory: 489.80 MB Total memory: 508.12 MB Max memory: 1016.12 MB
    For specific application stats, i think there are some profilers which u have to search in google.

  • Difference between web server and servlet container

    I can't able to figure out the techincal difference between web server(such as java web server) and servlet containers(such as jakarta-tomcat).If you please let me know then I will be very thankful to you.

    The web server serves html pages to browsers that request pages. It can also send images, javascript, flash content, and a few other things. When a request comes into the web server for a servlet or jsp, the web server calls on the Servlet container to do THOSE jobs.
    The Servlet container is the execution environment for a jsp or servlet (they are both servlets) to run Java code on the server and do logic.
    So you see, the web server spits out static content, where either no logic is involved, or the client's web browser does the logic. The Servlet container is used for applications that execute code, perform logic, connect to databases, etc.
    So they work together, but are completely separate logically.

Maybe you are looking for