How can I run a servlet with tomcat

I'm a new learner in servlet,I recently write a servlet program,when I compile it,the compiler throws the error
"package javax.servlet.http does not exist",I have put the servlet.jar(which exist in d:\tomcat\bin directory) file into the classpath directory;my servlet source files are in D:\tomcat\webapps\mywork\web-inf\classes\com\stardeveloper\servlets;
"com.stardeveloper.servlets" is the package for my servlet source files,so I have write the sentence "package com.stardeveloper.servlets;" in my servlet source file.
I don't know how to resolve this problem.can you give me a help?

servlet.jar doesn't exist in the folder you mentioned, but rather, in C:\tomcat40\common\lib, so this should be included in your classpath, the other thing you should care about is how you compiled your servlets, so that the package statement match the hirarchy of the file.
regards

Similar Messages

  • How can I run a servlet with Sun Java System Application Server PE 8?

    I've created a package with a TestServlet.class inside, used the deploytool to create a WAR and deployed this using the autodeploy folder.
    The filestructure has been generated and I find the TestServlet.class in
    [installdir]\domains\domain1\applications\j2ee-modules\testProject\WEB-INF\classes\[packagefolderstructure]\TestServlet.class.
    The context root is working fine, but I have no clue how I can run the servlet directly via the URL.
    I've tried many things like
    http://localhost:8080/testProject/TestServlet
    http://localhost:8080/testProject/servlet/TestServlet
    http://localhost:8080/testProject/servlet/[packagenamewithpoints]TestServlet
    http://localhost:8080/testProject/servlet/[packagenamewithslashes]TestServlet
    etc etc
    Can somebody tell me please how to write URLs to deployed servlets? Or send me an example url and xml descriptor files?
    Thanks a lot in advance!

    in web.xml use servlet mapping
    <servlet-mapping>
        <servlet-name>TestServlet</servlet-name>
        <url-pattern>/doit</url-pattern>
    </servlet-mapping>then use http://localhost:8080/testProject/doit

  • Just can't run HELLOWORLD servlet on Tomcat!

    Hi there, I worked with servlets all summer long and now I'm getting back to build one, and I'm totally confused... My problem's there :
    I try to run a simple HelloWorld servlet on Tomcat 4.1, and I get a 404 Error - Not found
    Well, here's the structure of my web application, contained in simpleservlet.war :
    WEB-APP
    -web.xml
    -CLASSES
    -servlet.class
    -LIB
    -servlet.jar
    Here's now the content of the web.xml file :
    <web-app>
         <servlet>
              <servlet-name>serv</servlet-name>
              <servlet-class>servlet</servlet-class>
         </servlet>
         <servlet-mapping>
              <servlet-name>serv</servlet-name>
              <url-pattern>/test</url-pattern>
         </servlet-mapping>
    </web-app>
    AND FINALLY here's how I invoke my servlet, I TRIED :
    http://localhost:1977/servlet/test
    AND ALSO
    http://localhost:1977/test
    AND BANG, I GET "ERROR 404 - NOT FOUND"
    A little help would be appreciated A LOT, well it's not supposed to be a hard problem... and by the way, I'm using port :1977, the problem's not there though.
    regards, Pierre

    Hi,
    First try http://localhost:1977 and see if you are getting Tomcat. As you said, this is not a problem. So, you should get the index.html of the Tomcat. Now, click on the one of the example. From the Address Bar, you will know the path of this example. Try putting your page at that location and then run.
    This should work.
    -- Ashish.

  • How do you run a servlet with no effect on the browser window?

    Is it possible to send parameters to a servlet (using POST or, if necessary, GET) from an application or html page running in a browser, without causing the current browser to be redirected, and without opening a visible new browser window to run the servlet?
    If so, can you explain how to do this?

    Sure, you could embed it as an image tag.
    <img src="http://yourserver/servlets/MyServlet?param1=foo&param2=bar" height=1 width=1>
    This will probably produce a broken image in some browsers, unless you have your Servlet send a 1x1 pixel image to its output stream.
    -Derek

  • How can i deploy a servlet with eclispe

    Hello,
    will any one of u give me the steps to deploy a servlet with eclipse on portal server(J2EE Engine),
    in help of eclipse they given as, whole webapplication deployement, but that is also giving me a error, the procedure they given is, once we created a .war file for our servlet project we need to refer this to a .Ear file, and then this Ear can be deployed in to the server. Is it the same and only procedure to deploy a servlet with eclipse, or if there is any other method,please give me the steps also.
    when i am deploying with the .Ear file, it is giving the error as,
    Jun 4, 2005 11:34:31 AM /userOut/deploy (com.sap.ide.eclipse.sdm.threading.DeployThreadManager) [Thread[Deploy Thread,5,main]] ERROR:
    [001]Deployment aborted
    Deployment exception : Cannot determine sdm host (is empty). Please configure your engine/sdm correctly !
    but the sdm is working on the server with the same host, and local deployement is also done successfully, but from my system im not able to deploy!
    Thanks&Regards,
    Sireesha.

    Yeah, i am able to see the J2EE engine clusters, there the message server port is given as 3601. becoz scs instance number is 1 here. so it is not the problem,
    the error it is giving as,
    Jun 6, 2005 11:37:28 AM /userOut/deploy (com.sap.ide.eclipse.sdm.threading.DeployThreadManager) [Thread[Deploy Thread,5,main]] ERROR:
    [001]Deployment aborted
    Settings
    SDM host : obtdev9
    SDM port : 50018
    URL to deploy : file:/C:/DOCUME1/sireesha.b/LOCALS1/Temp/temp56446MyServletEAR.ear
    Deployment exception : Server obtdev9 did not accept login request as apiadmin on port 50018 - CmdXmlFactory could not find Top Element within String: "null".
    Inner exception was :
    Server obtdev9 did not accept login request as apiadmin on port 50018 - CmdXmlFactory could not find Top Element within String: "null".
    is this may be the problem with port number?
    i am not knowing what is happening here...
    if you know the exact error based on the error messgae please help me,
    thanks to u for helping in this problem,
    Regards,
    sireesha.

  • HT5049 how can i run windows xp with OS X v10.7.3?

    I bought a copy of Windows XP (as recommended by my place of work) to enable me to work from home. The intention was to use boot camp to partition my had drive and install windows in the partitioned area. Unfortunately v10.7.3 doesn't seem to allow me to do this - it only seems to accept Windows7?

    stephenfromcroydon wrote:
    Unfortunately v10.7.3 doesn't seem to allow me to do this - it only seems to accept Windows7?
    that's correct.  With 10.7, only Win 7 can be run under boot camp.  To run XP with Lion, you will need to use a virtual machine such as Parallels or VMware Fusion for example.

  • How can you run a command with elevated rights on a remote server with invoke-command ?

    I am trying to run a script on a remote server with invoke-command.  The script is starting and is running fine, but the problem is that it should be running with elevated rights on the remote server.  On the server where I start the invoke-command, my account has the necessary rights.
    The server were I launch the invoke-command is a W2K8 R2.  The remote box is a W2K3 with powershell v2.0 installed.
    When I launch the script on the remote-box from the command line, I don't get the access denied's.
    Is there a way to do this ?
    Thanks in advance

    The script that I want to run is to install the windows updates.  I get an access denied on the download of the updates.
    When I execute the script on an W2K8 box, (not remotely) and I run it with non-elevated rights, I get the same error.
    The script is running fine when it is launched on W2K3 box locally with a domain account that has local admin rights, or on a W2K8 R2 server with a domain account that has local admin rights, but with elevated rights.
    Thanks in advance for your help.
    #=== start script ====
    param($installOption="TESTINSTALL",$rebootOption="NOREBOOT")
    Function Show-Help
    Write-Host ""
    Write-Host "SCRIPT: $scriptName <installOption> <RebootOption>"
    Write-Host ""
    Write-Host "DESCRIPTION: Installatie van WSUS updates op de lokale server"
    Write-Host ""
    Write-Host "PARAMETERS"
    Write-Host " -installOption <[INSTALL|TESTINSTALL]>"
    Write-Host " -rebootOption <[REBOOT|NOREBOOT|REBOOT_IF_UPDATED]>"
    Write-Host ""
    Write-Host "EXAMPLE:"
    Write-Host "$ScriptName -installOption INSTALL -rebootOption REBOOT_IF_UPDATED"
    Write-Host "$ScriptNAme INSTALL NOREBOOT"
    Write-Host ""
    Write-Host "Indien beide parameter weggelaten worden zijn de defaultwaarden :"
    Write-Host " installOption=TESTINSTALL "
    Write-Host " RebootOption=NOREBOOT"
    Write-Host ""
    Exit
    #Include alle globale variablen
    $CEIF_WIN_PATH = (get-content env:CEIF_WIN_PATH)
    $includeFile=$CEIF_WIN_PATH + "\Scripts\include_win.ps1"
    . $includeFile
    #initialiseer error count
    $errcnt=0
    $scriptName=$MyInvocation.MyCommand.Name
    #argumenten controleren
    $arrInstallOption= "TESTINSTALL", "INSTALL" # Mandatory variable with predefined values
    If (!($arrInstallOption –contains $installOption)){ Show-Help }
    $arrRebootOption = "REBOOT", "NOREBOOT","REBOOT_IF_UPDATED" # Mandatory variable with predefined values
    If (!($arrRebootOption –contains $rebootOption)){ Show-Help }
    #Logfile opbouwen
    $logfile = get-logfileName($MyInvocation.MyCommand.Name)
    Log-scriptStart $MyInvocation.MyCommand.Name $logfile
    function Get-WIAStatusValue($value)
    switch -exact ($value)
    0 {"NotStarted"}
    1 {"InProgress"}
    2 {"Succeeded"}
    3 {"SucceededWithErrors"}
    4 {"Failed"}
    5 {"Aborted"}
    function boot-server()
    if ($installOption -eq "TESTINSTALL")
    logger "TESTINSTALL : - Reboot local Server" $logfile
    else
    logger " - Reboot local Server" $logfile
    $thisServer = gwmi win32_operatingsystem
    $thisServer.psbase.Scope.Options.EnablePrivileges = $true
    $thisServer.Reboot()
    $logmsg="Install option = " + $installOption + ", RebootOption = $rebootOption"
    logger "$logmsg" $logfile
    logger "" $logfile
    logger " - Creating WU COM object" $logfile
    $UpdateSession = New-Object -ComObject Microsoft.Update.Session
    $UpdateSearcher = $UpdateSession.CreateUpdateSearcher()
    logger " - Searching for Updates" $logfile
    $SearchResult = $UpdateSearcher.Search("IsAssigned=1 and IsHidden=0 and IsInstalled=0")
    logger " - Found [$($SearchResult.Updates.count)] Updates to Download and install" $logfile
    $Updates=$($SearchResult.Updates.count)
    logger "" $logfile
    foreach($Update in $SearchResult.Updates)
    if ($Update.EulaAccepted -eq 0)
    $Update.AcceptEula()
    # Add Update to Collection
    $UpdatesCollection = New-Object -ComObject Microsoft.Update.UpdateColl
    $UpdatesCollection.Add($Update) | out-null
    if ($installOption -eq "TESTINSTALL")
    else
    # Download
    logger " + Downloading Update $($Update.Title)" $logfile
    $UpdatesDownloader = $UpdateSession.CreateUpdateDownloader()
    $UpdatesDownloader.Updates = $UpdatesCollection
    $DownloadResult = $UpdatesDownloader.Download()
    $Message = " - Download {0}" -f (Get-WIAStatusValue $DownloadResult.ResultCode)
    if ($DownloadResult.ResultCode -eq 4 )
    { $errcnt = 1 }
    logger $message $logfile
    # Install
    logger " - Installing Update" $logfile
    $UpdatesInstaller = $UpdateSession.CreateUpdateInstaller()
    $UpdatesInstaller.Updates = $UpdatesCollection
    $InstallResult = $UpdatesInstaller.Install()
    $Message = " - Install {0}" -f (Get-WIAStatusValue $InstallResult.ResultCode)
    if ($InstallResult.ResultCode -eq 4 )
    { $errcnt = 1 }
    logger $message $logfile
    logger "" $logfile
    #Indien er een fout gebeurde tijdens download/installatie -> stuur mail naar windowsteam
    if ( $errcnt -gt 0 )
    logger " - Fout tijdens de uitvoering van script -> send mail" $logfile
    $mailSubject=$MyInvocation.MyCommand.Name
    $msg = new-object Net.Mail.MailMessage
    $att = new-object Net.Mail.Attachment($logfile)
    $smtp = new-object Net.Mail.SmtpClient($smtpServer)
    $msg.From = $mailFrom
    $msg.To.Add($mailTo)
    $msg.Subject = $mailSubject
    $msg.Body = “Meer details in attachement”
    $msg.Attachments.Add($att)
    $smtp.Send($msg)
    #Moet de server herstart worden ?
    if ($rebootOption -eq "REBOOT_IF_UPDATED" )
    if ($Updates -gt 0)
    #Reboot the server when updates are installed
    boot-server
    elseif ($rebootOption -eq "REBOOT")
    #reboot the server always
    boot-server
    else
    #Do not reboot the server
    logger "Do not reboot the server" $logfile
    Log-scriptEnd $MyInvocation.MyCommand.Name $logfile
    exit 0

  • How can I run Photoshop Elements4 with Windows7. The operating system will not open and run it.

    My New computer has windows 7 installed, and it will not open and run my photoshop elements 4  programme. Do I need an upgrade, or can it be run in any other format on this computer.

    Did it install and you're just getting errors trying to run it? If so, try clicking on your Start button. Then, go to All Programs, find the entry for Adobe Photoshop Elements 4 and "right click" on it. Select Properties, and in the Properties dialogue click the Compatibility Tab and try running it in XP Compatibility mode and see if it works that way.
    If not, then it is really not compatible. Just buy the latest (Photoshop Elelments 9) while they offer $40 mail-in rebate (Ends January 5, 2011)
    http://www.adobe.com/products/photoshopel/

  • How can we run the Midlet with SIP from diffrent terminals

    Hi All,
    I am able to compile the SIP Based Midlet in the stand alone machine with the address of the localhost.But i am not able to communicate through diffrent terminals(With the IP Address of two diffrent machines).Please let me know the procedure to communicate through diffrent terminals

    You can use Web Dispatcher for multiple systems, in your case one AS ABAP and one AS JAVA. See the documentation, Implement one webdispatcher for multiple systems - Basis Corner - SCN Wiki and Name-based virtual hosts and one SAP Web Dispatcher to access multiple SAP systems.

  • How can i run first servlet satish

    when i am running servlet it's giving 505 error what is that

    ok satish i will give u solution about this
    505 is server does't understand where is u r file ie servlet file

  • How do you run a slideshow with no music in new Photos app

    In the new Photos app I can find no way of running a slideshow without music - either the standard themes or selecting my own music.  How can I run a slideshow with no music at all?  No setting, tab or option seems to be available to achieve this.

    Hit top right arrow for slide show; click on Music, click button next to search; choose Theme songs, click on blue check mark to remove it, then hit PLAY SLIDESHOW.

  • How to run servlet with tomcat

    I have a probrom that how can I run servlet with tomcat?
    I have new a folder classes in webapps\root\WEB-INF\,and put the .class
    programme in it ,but http://localhost:8080/servlet/HelloWorldExample
    can't run ,it give me a error than http:404 not found.
    could you tell me how i can solve the problem.
    Thank u very much.

    Hi,
    Make sure the class is in classpath or in WEB-INF/classes folder and make an entry for servlet tag in web.xml in WEB-INF folder.
    Regards

  • How Can I Run Servlet in tomcat

    Hi My Friends
    Please can any one tell me how can I Run Servlet in tomcat using my own Virtual Directory � my ask about , what is the structure it must be make it in the hierarchy of the sub folder of Virtual Directory , and in watch folder it must be put the servlet files and there is any change it must be make it in any file of the tomcat files and so on
    Please give my full details about this thing
    And thanks

    What version of Tomcat are u using?

  • PLEASE HELP Can't run my servlet url-pattern with Tomcat

    Hi I'm trying to run servlet with Tomcat.
    I have don the servlet with tomcat ide abd its runnig ok with Forte with the internal Tomcat
    When I'm runing it with external Tomacat its not running at the url that I have given in the web.xml
    web.xml file:
    <?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>ClaimsServlet</servlet-name>
    <servlet-class>ild.claims.ClaimsServlet</servlet-class>
    </servlet>
    <servlet>
    <servlet-name>LoginServlet</servlet-name>
    <servlet-class>ild.claims.LoginServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>ClaimsServlet</servlet-name>
    <url-pattern>/ild/claims/claims</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
    <servlet-name>LoginServlet</servlet-name>
    <url-pattern>/ild/claims/LoginServlet</url-pattern>
    </servlet-mapping>
    <session-config>
    <session-timeout>
    90
    </session-timeout>
    </session-config>
    <welcome-file-list>
    <welcome-file>
    default.jsp
    </welcome-file>
    <welcome-file>
    index.html
    </welcome-file>
    <welcome-file>
    index.htm
    </welcome-file>
    </welcome-file-list>
    </web-app>
    if I runnig the url: /ild/servlet/ild/claims/ClaimsServlet
    its running
    but //ild/claims/claims
    I got: The requested resource (/claims/claims) is not available.
    Thanks for help
    Snir

    Do you have to use <url-pattern>/ild/claims/claims</url-pattern>
    or you can use <url-pattern>/claims</url-pattern> ?

  • How to run a servlet in tomcat

    how i can run a servlet in tomcat?

    how i can run a servlet in tomcat?Don't try to do that yet; in your other thread you have shown that your are
    not capable yet of setting up a proper development environment.
    Take my advice, you can't walk or run yet so start with the basics.
    kind regards,
    Jos

Maybe you are looking for

  • What font is my UXterm using?

    I'm using UXterm. This is my .Xresources: UXTerm*eightBitInput: false UXTerm*metaSendsEscape: true UXTerm*reverseVideo: true UXTerm*bellIsUrgent: true UXTerm*faceName: Terminus UXTerm*faceSize: 7 Neither community/terminus-font nor aur/terminus-font-

  • Hardware requirement for Oracle Universal Content Management

    Hi Experts, What are the Hardware requirements for Oracle Universal Content Management ? Regards Nasir

  • Group expansion error

    there seems to be a group expansion issue for the users moved from OCS to Lync. the OCS users are unaffected  ! The error is as follows. Test-CsGroupExpansion : There is no test user assigned for [southlync.contoso.com]. Verify test user configuratio

  • Flash movie looks different in some IE8 browsers

    Hi All, I have a website http://www.pestcontrolonline.com which looks fine in  firefox, safari etc, but in some versions of IE 8 or 9 the flash movie looks wrong or doesn't display.  For example the insect guide vertical scroller on the right hand si

  • Calling CIC0 from SAPPHONE PopUp

    Hi experts, i would like to invoke CIC0 in case of an incoming  telephone (SAPPHONE) call using the customer master data. SAPPHONE works fine, but I could not find the method to call CIC0 using SAPPHONE-PopUp Data.. Any solutions? Thanx in advance Mi