Servlet basics

Hi there,
I have a static web site which i have develloped using dreamweaver. I would like to add some servlets and jdbc to the application. The java will be very basic as all i need to do is take in info from a single form and store it in a database.
The bit i need help with is this :
I currently have a number of html files on my website, which i ftp to a remote webserver.
Where will I store my servlet classes, and how do i upload these to the web server. Do i need to install a seperate servlet runner ? If so, how and where do i set this up ?
Also, if i am sending info in from the html forms to an access database, where should i store the java class containing the jdbc code.
Please help as I am fairly new to this. Any work i have done with servlets in the past has been with tomcat running on my local machine. Now that i am in the real world, things seem slightly different :)
dav

You mention you already have experience with servlets on your local machine? The real world isn't much different, since you say you want only to write simple servlets.
Just like you have Tomcat installed on your local machine, your web server needs a servlet container of its own. Tomcat seems to be a common choice because it is a good servlet container and is free. Many web servers have it. You should convene with your system administrator about whether they have Tomcat or a servlet container for you to use for your web site.
If you use Tomcat on your local machine, you should make a WAR file from your webapp directories and just deploy the WAR file on the server. That will make it much easier.
Don't forget you may need to have your system administrator modify the $CATALINA_HOME/conf/server.xml file and restart the servlet container so that your webapp is recognized.

Similar Messages

  • Image seems not loading in servlet running in tomcat 4 ... (win xp)

    This servlet basically takes a images file do some scaling then send out as outputstream.
    BUT the image dun since to load ... i keep getting a -1 for the width n height of the image .... seems that image cant load in tomcat....
    Is it something wrong wif my code or is there a bug in tomcat....
    Can someone help thanks
    This is the servlet code:
    import javax.servlet.http.*;
    import javax.servlet.*;
    import java.io.*;
    import javax.imageio.ImageIO;
    import javax.swing.*;
    import java.net.*;
    import java.awt.*;
    import java.awt.image.*;
    public class ImageOperater extends HttpServlet
    public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException
    { System.out.println("Start of post");
    OutputStream out = null;
    try{
    out = res.getOutputStream();
    catch(Exception e)
    e.printStackTrace();
    System.out.println("Start of imageprocessing");
    //image processing
    Image img = Toolkit.getDefaultToolkit().getImage("images/peppers.png");
    ImageFilter imf = new CropImageFilter(0,0,200,200);
    ImageProducer ip = new FilteredImageSource(img.getSource(),imf);
    img = Toolkit.getDefaultToolkit().createImage(ip);
    img =img.getScaledInstance(500,-1,Image.SCALE_AREA_AVERAGING);
    //image processing finish
    //check if the image is fully loaded
    System.out.println("Start of image loading");
    MediaTracker mediaTracker = new MediaTracker(new Container());
    mediaTracker.addImage(img, 0);
    try{
    mediaTracker.waitForID(0);
    System.out.println(mediaTracker.checkAll());
    System.out.println("thread sleep");
    Thread.sleep(1000);
    catch(Exception e)
    e.printStackTrace();
    try{
    mediaTracker.waitForID(0);
    System.out.println(mediaTracker.checkAll());
    System.out.println("thread sleep");
    Thread.sleep(1000);
    catch(Exception e)
    e.printStackTrace();
    //image fully loaded
    System.out.println("Start of buffered image ");
    System.out.println("width"+img.getWidth(null)+" Height "+img.getHeight(null));
    //preparing the buffered image to be send
    BufferedImage bimg = new BufferedImage(img.getWidth(null),img.getHeight(null),BufferedImage.TYPE_INT_RGB);
    Graphics gr = bimg.getGraphics();
    gr.drawImage(img, 0, 0, null);
    gr.dispose();
    //finished preparing
    //ig = Toolkit.getDefaultToolkit().createImage(bimg.getSource());
    System.out.println("Start of sending");
    //send out to client
    try{
    ImageIO.write((RenderedImage)bimg,"png",new File("c:\\test.png"));
    ImageIO.write((RenderedImage)bimg,"png",out);
    catch(Exception e)
    e.printStackTrace();
    try{
    out.flush();
    out.close();
    catch(Exception e)
    e.printStackTrace();
    System.out.println("post ended");
    but if the same code is put into an applet it works ... thw getWidth() and getHeight() returns the correct value:
    Image img = Toolkit.getDefaultToolkit().getImage("images/peppers.png");
    ImageFilter imf = new CropImageFilter(0,0,200,200);
    ImageProducer ip = new FilteredImageSource(img.getSource(),imf);
    img = Toolkit.getDefaultToolkit().createImage(ip);
    img =img.getScaledInstance(500,-1,Image.SCALE_AREA_AVERAGING);
    //image processing finish
    //check if the image is fully loaded
    System.out.println("Start of image loading");
    MediaTracker mediaTracker = new MediaTracker(new Container());
    mediaTracker.addImage(img, 0);
    try{
    mediaTracker.waitForID(0);
    System.out.println(mediaTracker.checkAll());
    System.out.println("thread sleep");
    Thread.sleep(1000);
    catch(Exception e)
    e.printStackTrace();
    try{
    mediaTracker.waitForID(0);
    System.out.println(mediaTracker.checkAll());
    System.out.println("thread sleep");
    Thread.sleep(1000);
    catch(Exception e)
    e.printStackTrace();
    //image fully loaded
    System.out.println("Start of buffered image ");
    System.out.println("width"+img.getWidth(null)+" Height "+img.getHeight(null));
    //preparing the buffered image to be send
    BufferedImage bimg = new BufferedImage(img.getWidth(null),img.getHeight(null),BufferedImage.TYPE_INT_RGB);
    Graphics gr = bimg.getGraphics();
    gr.drawImage(img, 0, 0, null);
    gr.dispose();
    //finished preparing
    //ig = Toolkit.getDefaultToolkit().createImage(bimg.getSource());
    System.out.println("Start of sending");
    //send out to client
    try{
    ImageIO.write((RenderedImage)bimg,"png",new File("c:\\test.png"));

    hi ganttan
    first you have to make sure your server is running xwindow. in most cases a linux/apache server does not run it by default. then there is a much simpler approach of scaling images with a servlet:
    Iterator readers = ImageIO.getImageReadersByFormatName("gif");
    ImageReader reader = (ImageReader)readers.next();
    ImageInputStream iis = ImageIO.createImageInputStream(new File(path));
    reader.setInput(iis, true);
    ImageReadParam param = reader.getDefaultReadParam();
    param.setSourceRenderSize(new Dimension(width, height));
    BufferedImage thumbnail = reader.read(0, param);
    ImageIO.write(thumbnail, "gif", response.getOutputStream());
    however this does not work for jpeg images. use setSourceSampling() instead of setSourceRenderSize() in this case but unfortunately it's limited and you can not scale to any size.

  • Servlet mapping problem in Resin, very weird!

    ENV: resin 2.1.6 on windows 2000
    1, I copied all the files and folders in $resin/doc/java_tut to $resin/webapps
    2, I did a little change to $resin/conf/resin.conf
    In the old resin.conf, there is a lot about the '/' webapp.
    <web-app id='/'>
    <classpath id='WEB-INF/classes'
    source='WEB-INF/classes'
    compile='true'/>
    </web-app>
    I replaced it just with
    <web-app id='/'/>
    3, I tested the 'java_tut' webapp
    http://localhost:8080/java_tut/servlet/example.servlet.basic.MappingServlet
    works well.
    http://localhost:8080/java_tut/exact
    works well, too.
    4, Then I tested the '/' webapp
    http://localhost:8080/servlet/example.servlet.basic.MappingServlet
    works well.
    but
    http://localhost:8080/java_tut/exact
    returns error code 404
    what's the problem?

    don't you need to get rid of the java_tut bit?

  • How to convert old Java Servlets to OSGi "Servlet" Bundles

    Hello I'm looking for some help/insight on the best way to convert some of our old Java Servlet code into new OSGi Bundles that can be accessed as servlets.  I'd like to be able to install the new bundles then access them on one of our CQ instance using something like "/servlet/servlet_name".
    So far I've been able to create a new bundle, and install it into CQ but I haven't been able to access the bundle at the servlet mapping URL that I would expect.  So far what I've found online has lead me to believe that I need to use the Felix Annotations to describe my servlet.
    @Component(immediate = true, metatype = true, label = "Servlet Name")
    @Service
    @Properties({
        @Property(name = Constants.SERVICE_DESCRIPTION, value = "Servlet Name"),
        @Property(name = "sling.servlet.methods", value={"GET"}),
        @Property(name = "sling.servlet.paths", value = "/servlet/my_servlet_mapping"),
        @Property(name = Constants.SERVICE_VENDOR, value = "VendorName")
    public class TellAFriend extends HttpServlet {...
    public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException
    Once I have this installed, and running without an error in the logs for CQ I tried to go on my local instance to http://localhost:4502/servlet/my_servlet_mapping but I only get 404 Resource Not Found errors.  I've even gone to the Sling Resource Resolver and it doesn't resolve to anything either.
    Is there more than the Servlet Information need into the Annotations to convert "old" code into a new OSGi Servlet Mapped Bundle?

    I must be missing something else configuration wise since I created a new Servlet basically using the code you provided above.  I deployed it as part of the bundle that I'm trying to create.
    The bundle installs and stars fine but I still can't access the servlet.  Are there CRXDE based configurations that are requried too to configure Servlets. 
    Here's my test servlet file.  I tried going to http://localhost:4502/servlet/TestCQServlet and just get the same 404 error I'm getting for the other 2 Servlets Java classes in my Bundle.
    import java.io.IOException;
    import javax.servlet.ServletException;
    import org.apache.felix.scr.annotations.sling.SlingServlet;
    import org.apache.sling.api.SlingHttpServletRequest;
    import org.apache.sling.api.SlingHttpServletResponse;
    import org.apache.sling.api.servlets.SlingSafeMethodsServlet;
    @SlingServlet(paths = "/servlet/TestCQServlet", methods = "GET")
    public class TestCQServlet extends SlingSafeMethodsServlet {
        // @Reference
        // private Repository repository;
        private static final long serialVersionUID = 6239754936223276983L;
        @Override
        protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServletException, IOException {
            response.setHeader("Content-Type", "application/json");
            response.getWriter().print("whatever");

  • Calling XSQL from java servlet

    I'm able to call XSQL, process the page, and display it. But, how do I set the stylesheet from within my java servlet.
    I tried params.put( "xml-stylesheet", "[path to sheet]" ), and then passing that to process(), but it just ignores it. I want to be able to set the stylesheet dynamicaly like when you call XSQL from the command line or from the XSQL servlet.
    XSQLRequest req = new XSQLRequest( xsql );
    Hashtable params = new Hashtable(2);
    params.put( "mths", "6");
    params.put( "run_id", "30");
    params.put( "grade", "A" );
    params.put( "xml-stylesheet", xsl ); <-- just seems to ignore this.
    ByteArrayOutputStream ostr = new ByteArrayOutputStream(2048);
    req.process( params, ostr, new PrintWriter(System.err) );

    Thanks for the help Steve (and thanks for a really nice book by the way.)
    To answer your first question, I have implemented a report caching servlet. In the application we're writing, reports are generated in HTML or PDF (using XSQL) on demand. However, the data really only changes once a day at most so I wanted to have a way to store the reports once they were generated. So this servlet basically gets the request for a report, checks to see if the report has already been generated and, if not, generates the report using XSQLRequest. Finally it returns the report to the user.
    One benefit to doing this is that it masks the generation process from the user (ie, they can just hit a link like http://somehost/path/to/report.pdf and they get a pdf report.) Of course the other benefit is that reports only need to be generated once, reducing server load.
    I will definitely try your suggestion and just redirect to the XSQL servlet. I guess I was thinking about it too hard, this is a simple solution which will probably address the problem with a minimum of fuss. ;o) Using XSQLRequest directly works, it's just that I want to be able to reference external images using relative paths... it's funny that relative references to XSL pages works though.
    Thanks again,
    Van
    null

  • Load balancing algorithm problems with servlets

    All,
    We have a simple servlet which looks up an RMI object from JNDI and invokes
    one of its methods in a loop. The RMI object is the HelloClusterImpl
    example provided by WebLogic. The servlet basically copies the code from
    the HelloClusterClient. In the cluster property file, our load algorithm is
    setup to be round-robin. We are using IIS as our web server. If we start
    up both servers in the cluster and then use another machine as our client to
    call the HelloClusterClient, we see that the calls to HelloClusterImpl
    alternate between the two clustered servers. In fact, it is done perfectly
    at 50% for each server. When we run the servlet from with the client's
    browser, however, it seems as if which ever server in the cluster that
    receives the servlet request then takes 100% of the calls to
    HelloClusterImpl and there is never any alternating. Although we can verify
    that different servers in the cluster receive the servlet request, it seems
    as if there is never any altering between the servers during the method
    invocations on the HelloClusterImpl servant. Does this seem right?
    Shouldn't there be alternating between the servers? Any help would be
    greatly appreciated.
    Thanks,
    -Jon

    I have to try this and I will let you.
    Thanks
    Jon Eagles wrote:
    All,
    We have a simple servlet which looks up an RMI object from JNDI and invokes
    one of its methods in a loop. The RMI object is the HelloClusterImpl
    example provided by WebLogic. The servlet basically copies the code from
    the HelloClusterClient. In the cluster property file, our load algorithm is
    setup to be round-robin. We are using IIS as our web server. If we start
    up both servers in the cluster and then use another machine as our client to
    call the HelloClusterClient, we see that the calls to HelloClusterImpl
    alternate between the two clustered servers. In fact, it is done perfectly
    at 50% for each server. When we run the servlet from with the client's
    browser, however, it seems as if which ever server in the cluster that
    receives the servlet request then takes 100% of the calls to
    HelloClusterImpl and there is never any alternating. Although we can verify
    that different servers in the cluster receive the servlet request, it seems
    as if there is never any altering between the servers during the method
    invocations on the HelloClusterImpl servant. Does this seem right?
    Shouldn't there be alternating between the servers? Any help would be
    greatly appreciated.
    Thanks,
    -Jon

  • Servlet deployment in 9i AS

    while running the makeit.bat file in $ORACLE_HOME\javavm\demo\demo\examples\servlets\basic\helloworld\makeit.bat
    i got an error
    /scottRoot/contexts/default is not a Servlet Context
    can u pls help how to solve this ?

    Alright, first your servlet class file (NOT the sourcefile) has to be copied to the WEB-INF/classes directory of your webapplication. Be sure to put in the correct subdirectories according to the package (so a com.myapp package would go in WEB-INF/classes/com/myapp).
    Second step: the servlet has to be mapped in your WEB-INF/web.xml file. The things to add are:
    <servlet>
    <servlet-name>Myservlet</servlet-name>
    <servlet-class>com.myapp.Myservlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>Myservlet</servlet-name>
    <url-pattern>/Myservlet</url-pattern>
    </servlet-mapping>And do this for all your servlets. Now inside your application your com.myapp.Myservlet servlet is known as "Myservlet". If you would want to forward to it, you would forward to "/Myservlet".
    The url-pattern tells Tomcat when to invoke your servlet and on which context path. When your url is something like http://localhost:8080/myapp/Myservlet (where myapp is your webapp name), the Myservlet servlet will get invoked. It won't if you put something like http://localhost:8080/myapp/subdir/Myservlet, then the url-pattern should have been:
    <url-pattern> /subdir/Myservlet</url-pattern>If you don't understand all that I suggest you find a good servlet tutorial on the net. There are loads of them.

  • Servlet Deployment

    I deployed ejb with a client application successfully in oracle 9ias .
    http server by default listens on port 80
    i tried the servlet to ejb example by running the makeit.bat file in
    $ORACLE_HOME\javavm\demo\demo\examples\servlets\basic\servletToejb\makeit.bat
    in this batch file while reaching the sess_sh session shell it' connecting to 8080
    since no port was listening on 8080 . i changed the httpd.conf to chane the listen port pf http from 80 to 8080 and again runthe bat file . i got the error
    </admin/shell> not found error. i read through the document provided for oracle 9ias oracle servlet engine deployment.
    but i couldn't solve the prob .so can u pls send me how to solve this prob??
    and how to deploy a new servlet especially how to create the servlet context ??
    Thanks And Regards
    Adarsh

    hi:
    please copy your servlet class file to Java Web Server 2.0 root/servlets directory.
    then invoke your servlet use command like this http://machine name:8080/servlet/your servlet name. don't add 's' character after servlet word. so enjory it!

  • Getting env variables into servlet

    I am making a call to a servlet http://3.70.201.210/servlets/basic?cmd=Attach
    Apparently, the servlet is not getting some of the environment variables it needs to make use of due to which it fails to load and the browser times out.
    In httpd.conf, I use
    PassEnv TARGET_ROOT
    PassEnv PRODUCT
    but they dont seem to get passed
    It was working before. All I did was upgrade Apache from 1.3.28 to 1.3.29. jserv version has been the same in both versions.
    Any pointers.
    Thanks in advance for any help or suggestions.

    Found it .. adding
    wrapper.env=var=value
    in jserv.properties fixed it !

  • Applet on client to help with session invalidation

    Dear All,
    I have a web application that when run by a user, per request, takes up approximately 40 MB of memory due to massive data structures being created, etc. Obviously, if the user leaves the site and goes elsewhere, I don't want that memory being held, even until the session times out(which I have to set at 30 minutes, due to the user community requests). It was suggested to me to create an applet that is embedded in every JSP page that constantly updates an property in a servlet basically saying "I'm here" and when that property hasn't been updated in N seconds, the servlet will call the invalidate method on the session that's not been updated.
    Is this approach feasible? Is there some simpler method I could take to get the same effect? I realize the web is state-less, but I need a work-around in this case to make it act like it is.
    Thanks,
    Mike Brubaker

    You should not need a full-blown applet. You could always use the HTTP meta-refresh tags to request that the browser poll over an interval you specify. The simplest approach would be to open a popup window that has the refresh logic. Place a button there, "logout". You could also have a message, such as, "User [username] has been logged on for [interval]."
    Also, consider serializing the 40 mB memory structure to the filesystem. This would work best if the time between requests is relatively longer than in most applications. If the latency of the database routines to generate the 40 mB structure is low, and the interval between requests is relatively high, consider discarding the memory structure after the request has been completed.
    - Saish
    "My karma ran over your dogma." - Anon

  • Clustering TopLink with 10g

    We are trying to use TopLink (version 9.0.4.3) in a cluster of Oracle 10g application servers (9.0.4.0.0) but we are having a number of issues getting it to work. When I add the following into the sessions.xml file I get a number of toplink errors on startup:
    &lt;cache-synchronization-manager&gt;
    &lt;clustering-service&gt;
    oracle.toplink.remote.rmi.RMIJNDIClusteringService
    &lt;/clustering-service&gt;
    &lt;jndi-user-name&gt;userName&lt;/jndi-user-name&gt;
    &lt;jndi-password&gt;password&lt;/jndi-password&gt;
    &lt;naming-service-initial-context-factory-name&gt;
    oracle.com.evermind.server.rmi.RMIInitialContextFactory
    &lt;/naming-service-initial-context-factory-name&gt;
    &lt;naming-service-url&gt;ormi://hostname:23791/appName&lt;/naming-service-url&gt;
    &lt;/cache-synchronization-manager&gt;
    The errors that we get are:
    Exception Description: Several [5] SessionLoaderExceptions were thrown:
    Exception [TOPLINK-9003] (OracleAS TopLink - 10g (9.0.4) (Build 031126)): oracle.toplink.exceptions.SessionLoaderException
    Exception Description: Unable to process XML tag [clustering-service] with value [
    oracle.toplink.remote.rmi.RMIJNDIClusteringService
    Internal Exception: java.lang.ClassNotFoundException:
    oracle.toplink.remote.rmi.RMIJNDIClusteringService
    Exception [TOPLINK-9003] (OracleAS TopLink - 10g (9.0.4) (Build 031126)): oracle.toplink.exceptions.SessionLoaderException
    Exception Description: Unable to process XML tag [jndi-user-name] with value [admin].
    Internal Exception: java.lang.NullPointerException
    Exception [TOPLINK-9003] (OracleAS TopLink - 10g (9.0.4) (Build 031126)): oracle.toplink.exceptions.SessionLoaderException
    Exception Description: Unable to process XML tag [jndi-password] with value [XXX].
    Internal Exception: java.lang.NullPointerException
    Exception [TOPLINK-9003] (OracleAS TopLink - 10g (9.0.4) (Build 031126)): oracle.toplink.exceptions.SessionLoaderException
    Exception Description: Unable to process XML tag [naming-service-initial-context-factory-name] with value [
    oracle.com.evermind.server.rmi.RMIInitialContextFactory
    Internal Exception: java.lang.NullPointerException
    Exception [TOPLINK-9003] (OracleAS TopLink - 10g (9.0.4) (Build 031126)): oracle.toplink.exceptions.SessionLoaderException
    Exception Description: Unable to process XML tag [naming-service-url] with value [ormi://localhost:23791/XXX].
    Internal Exception: java.lang.NullPointerException
    All feedback is appreciated,
    Marc

    There was a recent thread on this issue,
    Missing Descriptor in Servlet
    Basically TopLink does not get notified of the undeployment of an app, so cannot remove the session from the SessionManager. (unless you are using CMP)
    If you can receive notification of the deploy/undeploy you could remove or refresh the session from the session manager.
    A simple way to do this would be to keep a static boolean variable in your apps class that accesses the session from the session manager. The first time you access the session refresh it and set the static to true.
    To refresh a session from the session manager use the API,
    SessionManager.getSession(XMLSessionConfigLoader/XMLLoader xmlLoader, String sessionName, ClassLoader classLoader, boolean shouldLoginSession, boolean shouldRefreshSession)
    i.e.
    SessionManager.getManager().getSession(new XMLSessionConfigLoader/XMLLoader("sessions.xml/or your file name/path"), "yourSessionName", yourClassLoader, true, true);
    Only use this API the first time you access the session from the app.
    You can also use the following code to remove a session,
    SessionManager.getManager().getSessions().remove("yourSessionName");
    I have logged this issue internally, hopefully a better solution will be provided in the 10.1.3 release.

  • Authentication and EJB Providers in Apache SOAP 2.0

    Has anyone tried to modify the latest Apache SOAP code to pass the rpcrouter
    servlet Basic Authentication information (from HTTPSession) on to the JNDI
    initial context in the Stateless Session EJB Provider code (i.e. impersonate
    the authenticated http user for EJB calls)? I am thinking about allowing
    SOAP users to inherit the EJB deployment descriptor access control setup.
    Dan Meany

    With the link attached.
    Hi Denes, This is a configuration for configuring mod_auth_sspi on Apache 2.2 (and proxy to the EPG) I haven't tried 2.0 but I'm pretty sure it should work in the same way.
    Re: NTLM Authentication
    Rob..

  • How to execute batch files or command in JSP environment

    Hi,
    I am new to Java in general and JSP too.
    I have an application that uses JSP code i need to make it run or execute a number of batch files that run under command prompt (ms-dos)?
    Can you provide me with sample code on how to do this?

    Simply put, you can't do that.
    (Outputs from executing .BATs can be used in a response strings, though.)
    Learn Java and JSP/Servlet basics.

  • Regarding Error 404-please help!

    Hi Wisemen,
    I'm trying to deploy a servlet on my fresh installated tomcat. I believe I've succeded on installation as I can see the main page and run its servlets on http://eawars.sytes.net:8180/, which is the domain and port of my remote tomcat. (I run tomcat on a server on my LAN, but I've opened ports for you on router to check it and because we're deploying a java application as soon as I get it to work.
    Actually, it USED to work three days ago, then, I don't know why, the basic servlets I tried for testing stopped working, although the main page and servlets keep working.
    Anyway, I just tried a basic HelloWorld servlet. I assume the compilation was good and the .class file is correct, as it was before. I deploy the servlet structure into the webapps folder. However I get the resource not available error.
    Here's my web.xml:
    <?xml version="1.0" encoding="ISO-8859-15"?>
    <!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>
    <servlet>
    <servlet-name>Hello</servlet-name>
    <servlet-class>HolaMundo</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>Hello</servlet-name>
    <url-pattern>eawars</url-pattern>
    </servlet-mapping>
    </web-app>
    I run tomcat on an ubuntu server with shorewall (it has the port open). I'm putting the servlets not on the ROOT/webapps but on the /usr/share/tomcat5.5/webapps/
    the .class name is HolaMundo.class
    At first, I had the invoker mapping commented on /conf/web.xml, as suggested (though unrecommended) on many pages, I tried uncommenting it, and restarting, with no result. Same thing with
    <servlet>
    <servlet-name>invoker</servlet-name>
    <servlet-class>
    org.apache.catalina.servlets.InvokerServlet
    </servlet-class>
    <init-param>
    <param-name>debug</param-name>
    <param-value>0</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
    </servlet>
    Which is not what they point out to be uncommented.
    I didn't do a backup of the conf web.xml file, I'm afraid I may have screwed it up...
    I also tried deploying some *.war (one you provide and another one). Same result.
    I feel totally lost, I may re-install tomcat but I feel like it can be solved easily... I'm stuck.
    It's my first contact with servlets, I'll be reading the servlet basics, but I'm not sure it helps...
    Thank you for your attention, if you'd need any extra information, I'll gladly provide it.
    See ya!
    Quim

    I'll try recompiling the HelloWorld.java adding a package. I'll then have to put it on a folder inside the WEB-INF/classes/packagename/ and change the mapping to packagename.HolaMundo then. The tutorial seems highly oriented to NetBeans, which I don't have on this computer. It doesn't refer on plain-text configuration as far as I've read. And it focuses on a lot on features of NetBeans, while I would like to just test the servlet deployment of tomcat before going in-depth to a real web application. I've tried as well two .war files with no result, which I assume are properly set as the author claims. I guess it's more a tomcat issue?
    However, the final objective is to test a Netbeans project servlet a co-worked sent me and which I would like to upload it to the server I have at home. I haven't tried yet, but tomcat uses a diferent structure than the one used on the NetBeans project, I guess I have to copy just the web folder? -Absolute Beginner Talk on that-
    Thanks for your support,
    Quim
    pd. I forgot to say that the HelloWorld.java is the one provided by Tomcat example on tomcat default main page
    Edited by: QuimNuss on Nov 14, 2008 9:18 AM

  • Need urgent help: how to avoid concurrent calls on statefull session beans

    Hi,
    I need a little advice in designing a EJB session facade using JSPs, servlets, session and
    entity beans.
    My current design is:
    - JSP pages: here are only getMethods for the session bean used. All set-methods are handled by a
    - servlet: I have got one servlet handling several JSP pages. The servlet basically takes the
    form fields and stores them in the session bean and than dispatches to the next JSP-page
    - stateful session bean: here is, where all the business logic is conducted. There is one session
    bean per servlet using several
    - CMP entity beans: to talk to the database (Oracle 8i)
    The application server is JBoss 3.0.3.
    My problem is, if a user clicks on a submit button of a JSP page more than once before the next
    page builds up, I may get a "javax.ejb.EJBException: Application Error: no concurrent calls on
    stateful beans" error. I already synchronized (by the "session") the code in the servlet, but
    it happens in the JSP pages as well.
    I know, that Weblogic is able to handle concurrent calls, by JBoss isn't and it's clearly stated
    in the spec, that a user should avoid to have concurrent calls to a stateful bean.
    The big question is now: How can I avoid this? How can I prohibit the user to submit a form several
    times or to ignore anything, which arrives after the first submit?
    Thanks for any help,
    Thorsten.

    Synchronizing on the session is probably your best bet.
    You'll need to do all the data access and manipulation in the servlet. Cache any data you need using request.setAttribute() and then not access the EJB on the JSP page.
    If performance is an issue, you may also want to use create a user transaction to wrap all the EJB access in, otherwise each EJB call from the servlet is a new transaction. Just make sure you use a finally block to properly commit/rollback the transaction before you redirect to the JSP.
    UserTransaction utx    = null;
    synchronized (request.getSession())
      try {
        Context ctx = new InitialContext();
        utx = (UserTransaction) ctx.lookup("javax/transaction/UserTransaction");
        utx.begin();
        // ... Create session bean ...
        request.setAttribute("mydata", sessionBean.getMyData());
        try {
          utx.commit();
        catch (Exception ex) {
          log.warn("Transaction Rolled Back (" + ex.getClass().getName() + "): "
            + ex.getMessage(), ex);
        utx = null;
      } // try
      finally {
        if(utx != null)
          try {
            utx.rollback();
          catch (Exception e) {
            log.warn(e.getMessage(), e);
          } // catch
        } // if
      } // finally
    } // syncrhonized(session)

Maybe you are looking for

  • "T-Code" - ACACDATATRANS - Transfer Vendor Invoices to Accruals Engine

    Dear All, My Company is considering implementing the accruals engine. To my knowledge the accruals engine does NOT have the functionality to to pay vendor invoices. In particular we are looking to see if it's possible to do Automatic Vendor Prepaymen

  • How can I open a tdms file and replace a subset of data then save that change without re-writing the entire file again?

    Hi all, Is it possible to open a tdms file and make a small change an an array subset then save the file without having to save the whole dataset as a different file with a new name? That is to say, is there something similar to "Save" in MS Word rat

  • AP Divs

    www.graver-tank.com  is the  website.  On my project Summaries page, I have 3 separate images that  each need to be linked to their own pdf file. I set a rule for each one  as a DIV, but they still act as one when you click on the link.  Can  someone

  • Problem in reading a file

    Hello, I encounter a problem in an interface when I try to load the data which is in a Flat File. After looking to this file we've seen that there is at the end a carriage return symbol, and when we remove it all seems better. So I would like to know

  • CSA Agent not registering with CSA MC

    I have downloaded and installed my agent kit on a WinXP machine. But for some reason it is not registering with the CSA MC. Any idea why? The CSAMC is in a different subnet, but 443 is open for communication. Does the MC need other ports open to talk