Problem getting simple servlet to run in tomcat

i am trying to get a servlet to run that is explained in wrox Professional JSP second edition. i am using tomcat as the book explains.
1. i have created the ch03/WEB-INF/classes directory within the webapps folder in tomcat.
2. in the classes folder i created the directory
com/wrox/projsp/ch03/myfirstwebapp.
3. in the folder myfirstwebapp i have the compiled file
MyFirstServlet.class
4. i made sure the code is exactly as in the book.
5. it states that if i go to
http://localhost:8080/ch03/servlet/com.wrox.projsp.ch03.myfirstwebapp.MyFirstServlet i should get the correct output.
6. the only way i can get this to work is if i create a web.xml
file and point it to
com.wrox.projsp.ch03.myfirstwebapp.MyFirstServlet and then in the
browser i type in
http://localhost:8080/ch03/com.wrox.projsp.ch03.myfirstwebapp.MyFirstServlet thus leaving out /servlet in the URL
7. this seems fine but i would like to get it to work how the book shows which is without having to use the web.xml. am i missing something? do i need to set up anything (eg. a context tag for this app)within the server.xml.
any help would greatly be appreciated,
gary bushek

I don't know how the book you're using instructed you to setup the server but my web.xml simply has the following in it:
<?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>
</web-app>
I'm using tomact 3.2 and am able to run my servlets using
http://localhost/servlet/package_name.servletName
you might want to checkout www.coreservlets.com for more help on setting up tomcat.

Similar Messages

  • Can't Get My Servlets to Run in Tomcat. Please help...

    Hi!
    I've been banging my head against the same brick wall for a day and a half now and am getting pretty desperate...
    I installed Tomcat 4.1.24 with no problem and successfully ran one or two of the example servlets. However, I can't get my own (working) servlets to run in either ROOT or any other folder that I create under webapps. If I move my servlets into webapps\WEB-INF\classes, though, they run fine!
    Using 'x' represent the folder I've created, I have placed a servlet called FirstServlet in x\WEB-INF\classes. I have also placed the following web.xml file inside x\WEB-INF:
    <?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>
    <servlet>
    <servlet-name>FirstServlet</servlet-name>
    <servlet-class>FirstServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>FirstServlet</servlet-name>
    <url-pattern>/servlet/FirstServlet</url-pattern>
    </servlet-mapping>
    </web-app>
    [I have also tried omitting '/servlet' above and tried changing the name of the url-pattern.]
    In addition to this, I have tried editing the server.xml file by adding the following context:
    <Context path="/x" docBase="webapps/x" debug="0"
    reloadable="true">
    </Context>
    Despite all of this, I still continue to get the error message 404: The requested resource is not available.
    Can anybody please give me some idea of what I'm doing wrong or am failing to do??
    Many thanks in anticipation.
    Cheers.
    Jan

    Hi, Sharnee.
    Thanks for taking the time to email me. However, I really don't need to test my servlets, since (a) they all work under the JSWDK Web server and (b) the one that I am attempting to test ('FirstServlet') works fine when I place it in webapps\examples\WEB-INF\classes.
    In answer to your previous email, the URL I have used in attempting to run my servlet (with the servlet in ...\webapps\x\WEB-INF\classes, of course) is:
    http://localhost:8080/x/servlet/FirstServlet
    In desperation, I have also tried each of the following (with similar lack of success):
    http://localhost:8080/webapps/x/servlet/FirstServlet
    http://localhost:8080/ROOT/servlet/FirstServlet (after copying the servlet into ...\webapps\ROOT\WEB-INF\classes)
    http://localhost:8080/webapps/ROOT/servlet/FirstServlet
    Any suggestions?? I'm really frustrated, since the basic process that is required seems so straightforward, but simply isn't working for me!
    Thanks in anticipation.
    Jan

  • Need help getting first servlet to run in tomcat

    hi,
    i've complied my first servlet ok, using tomcat as server, problem is it can't find it. i up the class file under Web-inf/myApp under tomcat directory, typed:
    http://localhost:8080/myApp/TestingServlet
    in the url but it can't locate it. also i did start tomcat before going to url. can someone tell me what am i missing?
    Thank you.

    ok i got it to run but i had to create a classes dir under web-inf and had to use the url:
    http://localhost:8080/myApp/servlet/TestingServlet
    but why the servlet in the url, i don't have a servlet dir, does tomcat map classes dir to servlet dir?
    Thank you.

  • Anyone have problems getting Office 2004 to run after Lion upgrade?

    Anyone have problems getting Office 2004 to run after Lion upgrade?

    For the rare few, such as myself, who have some Office 2004 or older documents that fail to translate well in Office 2011, another option is to run Office 2004 in Snow Leopard (with Rosetta) installed in Parallels:
                             [click on image to enlarge]
    Full Snow Leopard installation instructions are here:
    http://forums.macrumors.com/showthread.php?t=1365439

  • Can't get servlets to run on tomcat

    i have the proper entries in the web.xml and server.xml, so thats definately not the problem. however, when i do run my servlet, i get this error message:
    Error: 500
    Location: /meetthestudent/servlet/helloworld
    Internal Servlet Error:
    java.lang.NullPointerException
         at java.lang.ClassLoader.resolveClass0(Native Method)
         at java.lang.ClassLoader.resolveClass(ClassLoader.java:545)
         at org.apache.tomcat.loader.AdaptiveClassLoader.loadClass(AdaptiveClassLoader.java, Compiled Code)
         at org.apache.tomcat.loader.AdaptiveServletLoader.loadClass(AdaptiveServletLoader.java:174)
         at org.apache.tomcat.core.ServletWrapper.loadServlet(ServletWrapper.java:265)
         at org.apache.tomcat.core.ServletWrapper.init(ServletWrapper.java:289)
         at org.apache.tomcat.core.Handler.service(Handler.java:254)
         at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
         at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:812)
         at org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
         at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)
         at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java, Compiled Code)
         at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java, Compiled Code)
         at java.lang.Thread.run(Thread.java:479)
    the code of the servlet is as follows:
    package helloworld;
    * <p>Title: </p>
    * <p>Description: </p>
    * <p>Copyright: Copyright (c) 2003</p>
    * <p>Company: </p>
    * @author not attributable
    * @version 1.0
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.ServletException;
    import java.io.IOException;
    import java.io.PrintWriter;
    public class HelloWorld extends HttpServlet {
    protected void doPost (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    out.println("<html>\n\t<body>\n\t\t<basefont face=\"verdana\">\n\t\tHello World!\n\t</body>\n</html>");
    out.close();
    what's the problem? thanx for any help, i would immensely appreciate it!
    -Tom

    Try to change your doPost to doGet...
    And anyway, what is the version of your Tomcat?
    The new code:
    package helloworld;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.ServletException;
    import java.io.IOException;
    import java.io.PrintWriter;
    public class HelloWorld extends HttpServlet {
    protected void doGet (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    out.println("<html>\n\t<body>\n\t\t<basefont face=\"verdana\">\n\t\tHello World!\n\t</body>\n</html>");
    out.close();

  • Online tutorial,documentation to get simple servlet

    Hi,
    I am new to servlet.
    I have J2EE 1.4 SDK in my pc.
    I want to develop simple servlet,deploy and run.
    will you please give me some websites ,link of tutorial,documentation to write a simple servlet and deploy in j2EE 1.4?
    Thank you so much

    Hello David,
    The problem seems to be with,
    MBeanServer mbeanServer = MBeanServerFactory.createMBeanServer();
    This does not get the MBeanServer that weblogic server uses. Try getting
    the MBeanServer from MBeanHome and register your MBean in this server.
    Check out
    http://e-docs.bea.com/wls/docs81/jmx/basics.html
    to lookup MBeanHome and getting the MBeanServer.
    Thanks,
    -satya
    David Karr wrote:
    Like other people reading this group, I'm trying to get started with JMX in WebLogic (8.1) despite the apparent lack of useful information.
    I'll eventually be writing an mbean which is intended to run on each managed server (registered by a servlet) which will read and write a particular file on each managed server (contention problems are unavoidable).
    In the beginning, however, I'm just trying to build a simple POC, with a servlet that creates and registers a simple mbean. That part was deceptively easy, but I'm not sure I did it right, as I'm not sure of the best way to look at the results of what I did.
    I found the "wlshell" tool, which is a jmx client for WebLogic. After my servlet registers the mbean, I tried reloading the wlshell display, but I don't see anything new. I'm sure I'm misunderstanding something (probably in the "ObjectName" constructor).
    The "init()" method of my servlet looks like this:
    public void init()
    MBeanServer mbeanServer = MBeanServerFactory.createMBeanServer();
    Sample sample = new Sample();
    try
    ObjectName objectName = new ObjectName("Sample:name=sample");
    mbeanServer.registerMBean(sample, objectName);
    The Mbean and impl look like:
    public interface SampleMBean
    public void setFlag(boolean flag);
    public boolean getFlag();
    public class Sample implements SampleMBean
    private boolean flag;
    public void setFlag(boolean flag) { this.flag = flag; }
    public boolean getFlag() { return (flag); }

  • Problem compiling simple servlet

    I am trying to compile a very simple servlet.
    When I do, I get the following error message:
    Package javax.servlet does not exist
    I am using the Java 2 SDK, Standard Edition Version 1.3.1.
    I have downloaded the servlet api (zip file servletapi2_1_1win.zip)
    from Sun's site. I unzipped these files in my lib directory; there are two folders,
    one called api and the other called src. Api and Src directories have their own
    sub-folders, javax/servlet/http etc.
    I am using W2K ; I had to create a CLASSPATH system variable in the environment
    variables section of control panel since there was none defined.
    I added the following line:
    C:\jdk1.3.1_01\lib\api\javax\servlet;C:\jdk1.3.1_01\lib\api\javax\servlet\http;
    I also did this for the PATH statement..
    My servlet looks like this:
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class howdy extends HttpServlet {
    public void doGet(HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException {
    res.setContentType("text/html");
    PrintWriter out = res.getWriter();
    out.println("<HTML>");
    out.println("<HEAD><TITLE>Hello World </TITLE></HEAD>");
    out.println("<BODY>");
    out.println("<BIG>Hello World </BIG>");
    out.println("</BODY></HTML>");

    Thanks. I was able to figure it out by specifying the
    full classpath
    at the command line, like this:
    C:> javac -classpath
    C:\jdk1.3.1_01\lib\servletapi2_1_1-win.zip\MyServlet.ja
    a
    Apparantly the system doesn't acknowledge the
    environmental variable that
    I created in the control panel; also I have no
    autoexec.bat file...so it
    looks like I have to write out the full path whenever
    I need to compile
    something. Kind of bothersome, but at least it
    works.
    You shouldn't have to do this. What operating system are you using?
    If you are using win2000, winNT or winxp, you should set the classpath in your system environment varialbes. You can also make a config.bat file and put everything in there. Then just run this config.bat file to set up your environment once for every session.
    Here's a file that I have set up on one of our NT machines. I just double click the icon for this file on my shortcut, and it gives me the window where I can compile my java programs.
    Hope this helps.
    Kamran
    =========== File SetJava.bat ============
    set PATH=%PATH%;m:\jdk1.3\bin
    set CLASSPATH=m:\jdk1.3\jre\lib;m:\jdk1.3\jaxp-1.1\jaxp.jar;m:\jdk1.3\jaxp-1.1\crimson.jar;m:\jdk1.3\jaxp-1.1\xalan.jar;.
    cd cis235
    %SystemRoot%\system32\cmd.exe

  • Help needed get JSF final release running on tomcat 5

    Hi there,
    I know my topic seems to be a easy thing which is often discusseb but I tell you it's not. And after searching the forum an the web... it's driving me crazy I want to make some development and tests but I can' get my stuff running on tomcat 5 and jsf final release.
    This is my last error message... seems like tomcat don't know anything about jsf...
    my directories---------------------------
    my webbapp
    -- WEB-INF
    classes
    lib
    scr
    web.xml
    faces-config.xml
    WEB-INF
    commons-beanutils.jar
    commons-collections.jar
    commons-digester.jar
    commons-logging.jar
    jsf-api.jar
    jsf-impl.jar
    jstl.jar
    standard.jar
    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>
    <display-name>MyWeb</display-name>
    <description>
    FElix
    </description>
    <context-param>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>client</param-value>
    </context-param>
    <!-- ############# Faces Servlet ############# -->
    <servlet>
    <servlet-name>JavaServer Faces Servlet</servlet-name>
    <servlet-class>
    javax.faces.webapp.FacesServlet
    </servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <!-- ############# Mapping ############### -->
    <servlet-mapping>
    <servlet-name>JavaServer Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    <listener>
    <listener-class>
    com.sun.faces.config.ConfigureListener
    </listener-class>
    </listener>
    </web-app>
    faces-config.xml---------------------------------
    <?xml version="1.0"?>
    <!DOCTYPE faces-config PUBLIC
    "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
    "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
    <faces-config>
    <navigation-rule>
    <from-view-id>/eingabe.jsp</from-view-id>
    <navigation-case>
    <from-outcome>success</from-outcome>
    <to-view-id>/ausgabe.jsp</to-view-id>
    </navigation-case>
    </navigation-rule>
    <managed-bean>
    <managed-bean-name>Square</managed-bean-name>
    <managed-bean-class>src.com.edu.jsf.bean.SquareBean</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>
    </faces-config>
    ERROR - MESSAGE
    org.apache.jasper.JasperException: /eingabe.jsp(19,3) No tag "input_number" defined in tag library imported with prefix "h"
    org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:83)
    org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:402)
    org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:236)
    org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1346)
    org.apache.jasper.compiler.Parser.parseElements(Parser.java:1598)
    org.apache.jasper.compiler.Parser.parseBody(Parser.java:1827)
    org.apache.jasper.compiler.Parser.parseOptionalBody(Parser.java:1100)
    org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1405)
    org.apache.jasper.compiler.Parser.parseElements(Parser.java:1598)
    org.apache.jasper.compiler.Parser.parseBody(Parser.java:1827)
    org.apache.jasper.compiler.Parser.parseOptionalBody(Parser.java:1100)
    org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1405)
    org.apache.jasper.compiler.Parser.parseElements(Parser.java:1598)
    org.apache.jasper.compiler.Parser.parse(Parser.java:171)
    org.apache.jasper.compiler.ParserController.doParse(ParserController.java:258)
    org.apache.jasper.compiler.ParserController.parse(ParserController.java:139)
    org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:237)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:456)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:553)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
    com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:142)
    com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
    com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
    com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
    I really stuck so any help is appriciated...
    I also tried to put the jars in the common/lib
    but still not working...
    I tried to get it running with jwsdp ... but same s*** ...
    best regards
    Felix

    thanks....
    this means... everything was working and I better should have read the notes...
    I went back.... installed jwsdp1.3 and everything was fine...
    so I will give it a try... change the classes and at this time i use the right tags...
    but this will also work for the tomcat downloaded from the apache.org site?
    I only need the jar files in the jsf-1.0/lib file and the latest jstl-jars ---
    thanks again
    reagards felix

  • How to Make simple JSP page running on TOMCAT 5.5.14

    Hi, Friends
    I have tried many to put test.jsp page in my webapps folder in tomcat installation directory and try to run http://localhost:8080/test.jsp but it will showing errors instead of running it.
    And will u provide me the basic and simple structure of creating the WEB-INF, src, web.xml, build.xml etc. etc.
    I am using my OS as WinXP prof. with sp2.
    also please post answer on mail. [email protected]

    Create a dir under webapps say "mydir"
    under this dir place your .jsp file and create WEB-INF directory too
    and run
    http://localhost:8080/test.jsp

  • Urgent: Parameter problem for portlet displaying jsp running inside tomcat

    Following jsp when run with portal 9.0.2 displays value of Name and Age but value of Telephone parameter is displayed as Null. Can anybody tell me the reason?
    Running this jsp on IBM WebSphere.
    <%@ page contentType="text/html;charset=UTF-8" %>
    <%@page import="java.util.*, oracle.portal.provider.v2.*" %>
    <%@page import="oracle.portal.provider.v2.http.HttpCommonConstants" %>
    <%@page import="oracle.portal.provider.v2.render.PortletRendererUtil" %>
    <%@page import="oracle.portal.provider.v2.render.PortletRenderRequest" %>
    <%@page import="oracle.portal.provider.v2.render.http.HttpPortletRendererUtil" %>
    <%@page import="oracle.portal.provider.v2.url.UrlUtils" %>
    <%
    // The form submit URL refers to the current Portal page. All portlets
    // on this page share this URL. This means that the per portlet parameters
    // are in the same request. Portlets must ensure that its paramerters don't
    // collide either with other portlets or other instances of itself. This
    // is generally accomplished by using "fully-qualified" parameter names. A
    // fully-qualified parameter name prepends the (unique) portlet reference to
    // the parameter. The JPDK provides a utility to accomplish this.
    String portletParamName = "mName";
    String portletParamAge = "mAge";
    String portletParamSubmit = "mSubmit";
    String fName = HttpPortletRendererUtil.portletParameter(request, portletParamName);
    String fAge = HttpPortletRendererUtil.portletParameter(request, portletParamAge);
    String fSubmit = HttpPortletRendererUtil.portletParameter(request, portletParamSubmit);
    // These are the session attribute names used to store the current values.
    // Because all instances of this portlet share the same user session we must
    // also fully-qualify these names to avoid collisions.
    String sName = HttpPortletRendererUtil.portletParameter(request, "sName");
    String sAge = HttpPortletRendererUtil.portletParameter(request, "sAge");
    String sTelephone = request.getParameter("TELEPHONE");
    PortletRenderRequest pRequest = (PortletRenderRequest)
    request.getAttribute(HttpCommonConstants.PORTLET_RENDER_REQUEST);
    String formName = UrlUtils.htmlFormName(pRequest,null);
    ProviderUser user = pRequest.getUser();
    ProviderSession providerSession = user.getSession();
    if (providerSession == null)
    %>
    Your provider session has been terminated or has timed out
    and you need to logout and then login to re-establish the session.
    <%
    else
    // Record, in session storage, the last values submitted.
    if (pRequest.getQualifiedParameter(portletParamSubmit) != null)
    providerSession.setAttribute(sName, pRequest.getQualifiedParameter(portletParamName));
    providerSession.setAttribute(sAge, pRequest.getQualifiedParameter(portletParamAge));
    %>
    <!-- Output the HTML content -->
    <center>
    <table width="70%">
    <tr>
    <td>
    <b>This portlet shows how to post and process information from HTML forms.</b>
    </td>
    </tr>
    </table>
    <form name="<%= formName %>" method="POST"
    action="<%= UrlUtils.htmlFormActionLink(pRequest,UrlUtils.PAGE_LINK) %>">
    <%= UrlUtils.htmlFormHiddenFields(pRequest,UrlUtils.PAGE_LINK, formName) %>
    <table>
    <tr>
    <td>
    <b>Name :</b>
    </td>
    <td>
    <input type="text" size="20" name="<%= fName %>" value="">
    </td>
    </tr>
    <tr>
    <td>
    <b>Age : </b>
    </td>
    <td>
    <input type="text" size="3" name="<%= fAge %>" value="">
    </td>
    </tr>
    <tr>
    <td>
    <b>Telephone : </b>
    </td>
    <td>
    <input type="text" size="3" name="TELEPHONE" value="">
    </td>
    </tr>
    </table>
    <br>
    <INPUT TYPE=submit name="<%= fSubmit %>" Value="Submit">
    </form>
    <%
    if ((providerSession.getAttribute(sName) == null)&& (providerSession.getAttribute(sAge) == null)) {
    %>
    <b>No values have been submitted yet.</b>
    <%
    } else {
    %>
    <b> Last submitted values:</b><br>
    <table>
    <tr>
    <td>
    <b>Name: </b>
    </td>
    <td>
    <b><%= providerSession.getAttribute(sName) %></b>
    </td>
    </tr>
    <tr>
    <td>
    <b>Age: </b>
    </td>
    <td>
    <b><%= providerSession.getAttribute(sAge) %></b>
    </td>
    </tr>
    <tr>
    <td>
    <b>Telephone: </b>
    </td>
    <td>
    <b><%= sTelephone %></b>
    </td>
    </tr>
    </table>
    <%
    %>
    </center>
    <%
    %>
    <!-- End output the HTML content -->
    Can somebody please help me on this?
    Thanks

    Hello,
    Let me know if the answer that I made Help needed: JSP and portal parameter problem.
    Regards
    Tugdual Grall

  • [Solved] Problem getting Batch Files to run as Admin in Win 8.1

    I'm trying to control certain Services with batch files to have them stop automatically at start.  However, with certain services, stopping requires run as admin.  My user account has admin privileges.
    For example, a batch file with this command will stop with a command prompt requiring Y/N to confirm the stop.
    NET STOP "Audiosrv"
    I can create a shortcut and set it to run as admin and it will stop the service without issue when it's clicked.  However, if I put the shortcut in the Windows startup folder, so the script runs automatically at boot it seems to ignore the shortcuts.
    I've tried the RunAs command below in a batch file, but it doesn't stop the service.
    runas /user:jaguar\Admin NET STOP "Audiosrv"
    Thanks for your help.

    Hello Peter, that works great.   I found I can add multiple arguments by separating them with a semi colon and I could hide the powershell window with the command at the end.
    My last question is if there's an additional command that will hide or minimize the command line window when the script runs?
    powershell.exe "Start-Process powershell -ArgumentList 'stop-service audiosrv; stop-service AudioEndpointBuilder; stop-service MMCSS' -Verb RunAs" -windowstyle hidden

  • Simple servlet shoed error in tomcat server sql error

    import java.sql.*;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class submit extends HttpServlet
         //Connection con;
         public void doGet(HttpServletRequest req,HttpServletResponse res) throws IOException,ServletException
         String str1,str2;
         str1=req.getParameter("emailid");
         str2=req.getParameter("comment");
         System.out.println(str1);
         System.out.println(str2);
         res.setContentType("text/html");
         PrintWriter out=res.getWriter();
            try {
             Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
            //connection object created using DriverManager class
            //addtodatabase is the name of the database
            Connection connect =DriverManager.getConnection("jdbc:odbc:booksrc");
            //creating prepared statement object pstm so that query can be sent to database
            PreparedStatement pstm=connect.prepareStatement("insert into gbook(emailid, comment) values(?,?)");
            pstm.setString(1,str1);
            pstm.setString(2,str2);
            //execute method to execute the query
            pstm.executeUpdate();
            out.println("<html><h2>Guest Book is Successfully Updated</h2></html>");
             //closing the prepared statement  and connection object
             pstm.close();
             connect.close();
           catch(SQLException sqe)
             System.out.println("SQl error");
            catch(ClassNotFoundException cnf)
             System.out.println("Class not found error");
    public void doPost(HttpServletRequest req,HttpServletResponse res) throws
    ServletException,IOException{
    doGet(req,res);
    }

    How about a little effort and initiative on your part? Did you try Google[1]?
    [1] http://www.google.com/search?q=%5BMicrosoft%5D%5Bodbc+manager%5Ddata+source+name+not+found+and+no+default+driver+specified
    P.S. You've not specified your DB and I'm pretty sure you've not setup a system DSN
    People on the forum help others voluntarily, it's not their job.
    Help them help you.
    Learn how to ask questions first: http://faq.javaranch.com/java/HowToAskQuestionsOnJavaRanch
    ----------------------------------------------------------------

  • Memory issue in servlet application in a tomcat  container

    Hi ,
    i am a newbie in tomcat server and webapplication . we have a simple servlet application running in a tomcat container . which handles more than 10 requests in a sec . in the application we are storing the recieved xml in the server .
    the used memory size was gradually inceased upto 11 GB out of 12GB . when i killed all java also the memory used was not released .
    28390: /usr/java/jdk1.5.0_06/bin/java -Xms128m -Xmx1536m -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file=/usr/local/tomcat//conf/logging.properties -Djava.endorsed.dirs=/usr/local/tomcat//common/endorsed -classpath :/usr/local/tomcat//bin/bootstrap.jar:/usr/local/tomcat//bin/commons-logging-api.jar -Dcatalina.base=/usr/local/tomcat/ -Dcatalina.home=/usr/local/tomcat/ -Djava.io.tmpdir=/usr/local/tomcat//temp org.apache.catalina.startup.Bootstrap start
    Address Kbytes RSS Anon Locked Mode Mapping
    00283000 60 - - - r-x-- libresolv-2.5.so
    00292000 4 - - - r-x-- libresolv-2.5.so
    00293000 4 - - - rwx-- libresolv-2.5.so
    00294000 8 - - - rwx-- [ anon ]
    009b2000 104 - - - r-x-- ld-2.5.so
    009cc000 4 - - - r-x-- ld-2.5.so
    009cd000 4 - - - rwx-- ld-2.5.so
    009d0000 1268 - - - r-x-- libc-2.5.so
    00b0d000 8 - - - r-x-- libc-2.5.so
    00b0f000 4 - - - rwx-- libc-2.5.so
    00b10000 12 - - - rwx-- [ anon ]
    00b15000 8 - - - r-x-- libdl-2.5.so
    00b17000 4 - - - r-x-- libdl-2.5.so
    00b18000 4 - - - rwx-- libdl-2.5.so
    00b1b000 148 - - - r-x-- libm-2.5.so
    00b40000 4 - - - r-x-- libm-2.5.so
    00b41000 4 - - - rwx-- libm-2.5.so
    00b44000 76 - - - r-x-- libpthread-2.5.so
    00b57000 4 - - - r-x-- libpthread-2.5.so
    00b58000 4 - - - rwx-- libpthread-2.5.so
    00b59000 8 - - - rwx-- [ anon ]
    00c7f000 76 - - - r-x-- libnsl-2.5.so
    00c92000 4 - - - r-x-- libnsl-2.5.so
    00c93000 4 - - - rwx-- libnsl-2.5.so
    00c94000 8 - - - rwx-- [ anon ]
    08048000 60 - - - r-x-- java
    08057000 8 - - - rwx-- java
    0977a000 14444 - - - rwx-- [ anon ]
    47da4000 12 - - - rwx-- [ anon ]
    47da7000 504 - - - rwx-- [ anon ]
    47e25000 12 - - - rwx-- [ anon ]
    47e28000 504 - - - rwx-- [ anon ]
    47ea6000 12 - - - ----- [ anon ]
    47ea9000 504 - - - rwx-- [ anon ]
    47f27000 12 - - - ----- [ anon ]
    47f2a000 504 - - - rwx-- [ anon ]
    47fa8000 12 - - - ----- [ anon ]
    47fab000 504 - - - rwx-- [ anon ]
    48029000 12 - - - ----- [ anon ]
    4802c000 504 - - - rwx-- [ anon ]
    480aa000 12 - - - ----- [ anon ]
    480ad000 504 - - - rwx-- [ anon ]
    4812b000 12 - - - ----- [ anon ]
    4812e000 504 - - - rwx-- [ anon ]
    481ac000 12 - - - ----- [ anon ]
    481af000 504 - - - rwx-- [ anon ]
    4822d000 12 - - - ----- [ anon ]
    48230000 504 - - - rwx-- [ anon ]
    482ae000 12 - - - rwx-- [ anon ]
    482b1000 504 - - - rwx-- [ anon ]
    4832f000 12 - - - ----- [ anon ]
    48332000 504 - - - rwx-- [ anon ]
    4d201000 204 - - - r-xs- catalina-cluster.jar
    4d234000 108 - - - r-xs- commons-modeler.jar
    4d24f000 8 - - - r-xs- servlets-invoker.jar
    4d251000 88 - - - r-xs- tomcat-http.jar
    4d267000 164 - - - r-xs- tomcat-ajp.jar
    4d290000 24 - - - r-xs- servlets-webdav.jar
    4d296000 24 - - - r-xs- catalina-ant-jmx.jar
    4d29c000 20 - - - r-xs- tomcat-coyote.jar
    4d2a1000 20 - - - r-xs- tomcat-jkstatus-ant.jar
    4d2a6000 64 - - - r-xs- catalina-storeconfig.jar
    4d2b6000 28 - - - r-xs- catalina-ant.jar
    4d2bd000 20 - - - r-xs- servlets-default.jar
    4d2c2000 48 - - - r-xs- naming-resources.jar
    4d2ce000 52 - - - r-xs- jsp-api.jar
    4d2db000 40 - - - r-xs- naming-factory.jar
    4d2e5000 76 - - - r-xs- jasper-runtime.jar
    4d2f8000 112 - - - r-xs- commons-el.jar
    4d314000 96 - - - r-xs- servlet-api.jar
    4d32c000 400 - - - r-xs- jasper-compiler.jar
    4d390000 152 - - - r-xs- naming-factory-dbcp.jar
    4d3b6000 412 - - - r-xs- mysql-connector-java-3.1.10-bin.jar
    4d41d000 1188 - - - r-xs- jasper-compiler-jdt.jar
    4d546000 40 - - - r-xs- tomcat-i18n-en.jar
    4d550000 36 - - - r-xs- tomcat-i18n-es.jar
    4d559000 32 - - - r-xs- tomcat-i18n-fr.jar
    4d561000 36 - - - r-xs- tomcat-i18n-ja.jar
    4d56a000 784 - - - r-xs- localedata.jar
    4d62e000 172 - - - r-xs- sunpkcs11.jar
    4d659000 152 - - - r-xs- sunjce_provider.jar
    4d67f000 4 - - - ----- [ anon ]
    4d680000 1528 - - - rwx-- [ anon ]
    4d7fe000 8 - - - ----- [ anon ]
    this is the total java process running in the system . i am not able to identify the process - r-x-- [ anon ] ..( i deleted more anon process as the character exceeds more ) please advise me to find a solution for this ..
    thanks
    Dhinesh

    bedhinesh wrote:
    the used memory size was gradually inceased upto 11 GB out of 12GB . when i killed all java also the memory used was not released . Some possible reasons.
    1. You are using a memory tool and are incorrectly reading the results.
    2. You are using JNI or using a third party JNI which uses an unusual system resource and that is not cleaning up that resource.
    3. One very unusual case, you have a log file (or some other file) which is being posted into the same place in the file system as the OS swap space. When that happens the "memory" fills up.

  • Problem running simple servlet on tomcat 4.0

    hi,
    i have setup tomcat4.0 on the server and i am trying to run a simple servlet but it is not working. here is what i have done:
    1. setting the CATALINA_HOME variable to the directory where tomcat is installed
    2. setting the classpath variable to servlet.jar
    3. i am putting the .class fille in tomcat-home-directory/webapps/ROOTS/WEB-INF/classes
    4. i am giving the url as http://localhost:8080/servlet/HelloServlet.class
    but error is given...could you please tell where could i have probably made a mistake
    regards
    preeti

    hi tnguyen1973
    now my servlets are running on the server provided they are kept under /examples/WEB-INF/classes. But now i have my own folder at the same level of examples called Lm which also has WEB-INF/classes. but if i put my servlets here it is giving exception.hope u got me. please, tell me where should i make necessary modifications to get the servlets run from my own folder instead of examples
    thank u

  • Problems getting tomcat to run on localhost or anywhere...

    I have a huge problem, I have a servlet that i'm developing for the company of my internship, and this is the first servlet i've ever had to develop. It has taken me the entire semester to get as far as i have, and i have a lot of time invested in getting this servlet-centric application to work.
    My problem is that i cannot even get tomcat web container to work right on just the local computer- much less the server it will need to run on to support this web app. I have looked through tons of documentation on the web and on the apache website for help on configuring tomcat, and have worked through tutorials on how to get it working, but have not yet had a success story. Time is really running to the line now!
    I have read that in order for tomcat to run on IIS you need to configure 'isapi_redirect.dll' and get IIS to filter requests to tomcat. I have even worked through tutorials in doing this, but cannot get it working still. I have tomcat installed, and even shutting off IIS will not allow me to run tomcat and get even an example file included with tomcat to load up when pointing to http://localhost:8080/ or any port listed in the server.xml config file. I can though, get IIS's default page to come up when it is running by pointing to http://localhost/.
    I have exhausted all ideas i have to try and make it work, and am not consulting the forum for help. I know there must be a simpler way to get tomcat working at least on the localhost. ANY advice that leads to me being able to get tomcat running right so i can even just test my servlet how it would run on my local computer would be very very great help. Also, if help can be given on how to get it installed with least amount of hassles on a web-hosting server it would be very appreciative.
    I am in desperate need of help on this,
    please please help me!
    -mike

    Found the problem- setup turned out a lot easier when i downloaded the right Tomcat file- i had the .zip- which doesn't have an installer on it- so i just talked to a friend, he recommended the one with the installer- less to go wrong in configuration- and it works perfect for the local machine at least- the server might be an issue with support mostly though- don't know yet til i test it there- thanx for trying to help- but got the problem fixed before you guys got the chance to really help much.

Maybe you are looking for

  • From my library, how do I upload previous purchased songs into the cloud?

    I have a slew of songs in my library, but I can't figure out how to upload those songs into the iCloud, and yes, they were purchased from the iTunes store. Help!

  • New iMac, 24" 3.06 Ghz - WIRED Connection Problem

    Hi All - This machine has been in service 2 weeks. About a week ago, the connectivity to the internet has become faulty. I can successfully connect to a web site, but after about a minute or so, it will drop. Using the same browsers and MacOS on a Ma

  • Setting Default Configuration in 1.4.2

    Previous versions of Java Web Start had a default configuration file javaws.cfg which contained the default preferences. When JWS was installed on PCs in our intranet, we could switch the cfg file to one which, amongst other things, set the proxy cor

  • Encoding URL in jsp

    Hello All, I want to encode URL in my jsp code such that when the jsp is rendered and if user sees the source code then the url should not be shown. Is this possible ? Thanks

  • Unable to use Adobe 9 Pro with Office 2010

    The year is 2012 and Adobe still has not resolved issues with beinga able to use the features I paid them for. Specifically the ability to retain metadata, hyperlink the TOC and maintain other links when converting an Office 2010 Profesional document