Deploying Servlet

my directory structure:
/myweb
/myweb/WEB-INF
/myweb/WEB-INF/classes
/myweb/WEB-INF/classes/mypackage
/myweb/WEB-INF/lib
I have developed my servlet classes under /myweb/WEB-INF/classes and everything works well. Now I want to deploy my application using package, jar and war:
1. pack all .java and .class files in a package in order to facilate distribution and javadoc creation
2. compact all packaged .class files into a jar
3. compact the whole /myweb directory into a war file for deployment
what I did:
1. added a line "package mypackage;" in every .java files under /myweb/WEB-INF/classes
2. compiled all .java into .class files
3. moved all .java and .class files into /myweb/WEB-INF/classes/mypackage
the web is still working fine at this point.
then:
4. under /classes/mypackage directory, run "jar cfv mypackage.jar *.*" to created a jar file
5. move the jar file to /myweb/WEB-INF/lib and delete all stuff under /myweb/WEB-INF/classes
here, the web server cannot find the desired servlet classes anymore
I repeated step 4 in this way:
4. under /classes directory, run "jar cfv mypackage.jar mypackage" to created a jar file
files added into jar, but still failed to access the desired servlet classes
my questions:
1. what's the problem after step 4 & 5?
2. is that a must to use ant, build.xml, etc. to deploy myweb? Can I simply use jar command to do so?
Thanks a lot.

Few things,
1. You need to make an entry in web.xml for each and every servlet in your package.
It looks like this,
<servlet><servlet-name>MyServlet</servlet-name><servlet-class>mypackage.MyServlet</servlet-class></servlet>
<servlet-mapping><servlet-name>MyServlet</servlet-name><url-pattern>/servlet/LoginServlet</url-pattern></servlet-mapping>
You can find this web.xml file in the web-inf dir.
2. Go to classes dir, use 'jar cvf mypackage.jar mypackage\*.*' and put that mypackage.jar in web-inf\lib dir.
Now your servlet will work. While deploying your app, you need to include web.xml too in the war / jar file.
Sudha

Similar Messages

  • Deploy Servlet to OAS 4

    hiye guys,
    Need help here, development environment = Oracle Jdeveloper 3.1 try to deploy servlet to OAS 4 (remote) ....how can it be done ?
    I have tried deploy servlet locally ...OAS on my local machine and set physical path and so on ...thats easy
    what if my developers doesnt have OAS installed and my OAS is on Solaris ? they wanted to deploy servlets remotely from their machine to OAS @ solaris server ...
    needed help asap
    from
    kenneth

    Hi Kenneth,
    I'd recommend the developers simply deploy locally and copy the files over to your server.
    Have they tried this? Have you run into any problems?
    Is it a DBServlet? If so, have you seen the following documentation?:
    CHoose Help | Help Topics
    Then navigate to
    User Guides
    --Developing Applications
    ----Developing Web Applications
    ------Developing Java Servlets
    --------Deploying Java Servlets
    ----------Deploying a Database Servlet to OAS
    Hope this helps.
    Best,
    Avrom
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by kenken64:
    hiye guys,
    Need help here, development environment = Oracle Jdeveloper 3.1 try to deploy servlet to OAS 4 (remote) ....how can it be done ?
    I have tried deploy servlet locally ...OAS on my local machine and set physical path and so on ...thats easy
    what if my developers doesnt have OAS installed and my OAS is on Solaris ? they wanted to deploy servlets remotely from their machine to OAS @ solaris server ...
    needed help asap
    from
    kenneth<HR></BLOCKQUOTE>
    null

  • Deploying servlets in the Sun One Web Server 6.1

    Friends, Please let me know how to deploy servlets in the Sun One Web Server 6.1.
    Thanks in advance,
    Madan.

    You cannot get that behavior.
    When an SSL client and server negotiate the connection, the client sends a list of all the cipher suites it supports. From that list the server will pick the most secure cipher suite which it also supports (if the server doesn't support any of the cipher suites proposed by the client, the connection establishment will fail).
    RC4 (128bit) is more secure than 3DES (112 bit). Thus, a server will never pick 3DES above RC4_128 if both are valid options (i.e. when both client and server support both). If you really wanted to force use of 3DES you need to disable RC4_128 in the server (or all the clients; or both).

  • Hot Deploy Servlet in JAR file problem

    I've been playing with hot deploying servlets in WLS 5.1. I have SP2
              installed. I have things working fine with individual servlet class files. I
              decided to try hot deploying with jar files.
              I created a servlet, added it to a jar file, and then added the jar file to
              the 'weblogic.http.servlet.classpath'. I then restarted the server. I
              started the console and was able to hot deploy the servlet. So far so good.
              My next test is what failed. I modified the servlet, and rebuilt the jar
              file. I went back to the console, selected the servlet and hit the redeploy
              button. I went back to the browser and hit refresh - nothing, still the old
              servlet.
              It appears that WLS isn't reloading the jar file and the updated servlet.
              Everything works with individual class files.
              Does anyone know how I can cause the reload of updated servlets embedded
              within a jar file?
              Weblogic group - If there is no way now, will support be added soon?
              Thanks,
              Rick
              

    Hi,
              If I use weblogic.servlet.ServletServlet to try just the servlet , It
              works correctly.But When I develop it in a web application , there is a lot
              of hypelink to this servlet,thus I can't use the relative path reference to
              that servlet.I try to set the name of weblogic.servlet.ServletServlet same
              as the webapp,It doesn't work,how do I solve this problem?
              Thank you
              Pan
              Subject: Re: Hot deploy Servlet in webapp
              > http://www.weblogic.com/docs51/classdocs/API_servlet.html#134798
              >
              > It even explains why you shouldn't use it in production environment.
              >
              > Dimitri
              

  • Wat are all needed to be impoted to run ,deploy servlet,jsp in eclipse

    i want to know what are all needed to be impoted
    to run ,deploy servlet,jsp in eclipse
    reply me
    regards
    saravanakumar

    http://www.eclipse.org/webtools/

  • Can i deploy servlet to iis server..?

    Can i deploy servlet to iis server..?
    if yes.. how..?

    to deploy servlets into IIS you need to use some connector which connects IIS to tomcat. Still you have to use servlet contrainer from tomcat only (as IIS serves you only web server functionality but not servlet contrainer ). use JK Connector for this bride.

  • Hot deploy Servlet in webapp

    Can I hot deploy a servlet within a web application ?How should I do it?
              (When I compile my servlet into MyApp/web-inf/classes,user this URI -
              http://localhost:7001/MyApp/mypackage.myclass to invocate it ,It does not
              work correctly(error 404))
              

    Hi,
              If I use weblogic.servlet.ServletServlet to try just the servlet , It
              works correctly.But When I develop it in a web application , there is a lot
              of hypelink to this servlet,thus I can't use the relative path reference to
              that servlet.I try to set the name of weblogic.servlet.ServletServlet same
              as the webapp,It doesn't work,how do I solve this problem?
              Thank you
              Pan
              Subject: Re: Hot deploy Servlet in webapp
              > http://www.weblogic.com/docs51/classdocs/API_servlet.html#134798
              >
              > It even explains why you shouldn't use it in production environment.
              >
              > Dimitri
              

  • Deploying Servlets in Weblogic 8.1

    Hi,
    I have deployed servlets in Weblogic 8.1 server. The deployment was successful, but when I try to access the servlet it gives me java.lang.UnsupportedClassVersionError. It also says that it is unable to find the servlet class.
    Can anyone help me with this?
    Regards
    Usha

    hi
    can u check your supported configuration
    this might because of incompatable JDK
    a method writeObject(ObjectOutputStream) must be implemented in UTCDate to cover the JDK implementation difference of java.util.TimeZone between jdk 1.3.x and jdk 1.4.x. This is required to cover the member 'localeTimeZone' in UTCDate. Please refer to the source code of java.util.Calendar.writeObject(ObjectOutputStream) for an equivalent implementation for the member 'zone'.
    Prasanna Yalam

  • Deploying servlets (not in jar/war/ear!) to OC4J?

    I must be missing some very tiny but crucial issue....
    For over 2 days now (shame) I have been trying but not
    succeeding to deploy servlets to OC4J behind Apache. The 'behind
    Apache'-part is easy. Just set up a proxy. This is because
    Apache configuration is easy and well documented. But here is my
    real problem. I am using JDev 3.2 (9i too large) and this is
    what I want:
    I want to code a servlet in Jdeveloper, compile it to a class-
    file, not a jar, war, ear or whatever-r. Then I want to set up
    OC4J in such a way that I can access my servlets from the
    directory where the class files are. I do NOT want to use the
    default-web-app subdirectory for obvious reasons. Please, how do
    I set up OC4J to just look in my own classes-directory with my
    own servlets???? No jar, no war, no ear.
    I have been reading all sorts of information on this and tried
    everything, but am not succeeding and getting all sorts of
    error/not found messages.
    Extra info:
    I am using OC4J on windows. To start I use java -jar orion.jar,
    to restart I use ^C and repeat the start command. Is that ok or
    do I need to restart in a different way? I tried to setup OC4J
    as a service but the link to runexecsvc went astray to judosoft
    Any help will be greatly appreciated!

    Avi,
    Thanks for your swift reply. I have indeed read the docs, but
    the exploded directory format does not seem to work for one
    reason or another (got some error messages on file not found or
    something). Have you succeeded in deployment using exploded
    directories? If so, I would be greatly interested in your xml-
    files and directory structure!
    But, please do not spend too much time on this, because I have
    now decided that I will deploy using a war. I have written a
    small script to make a war out of my whole project and copy it
    to de OC4J file system. This works and everybody is happy.
    Thanks again,
    Martijn

  • Deploy servlet with WAR file

    Has anyone successfully deployed servlets using WAR file?I think I did everything right. The WAR file was deployed. But I can't accesss it.
              

    I use .war files for deploying servlets in WLS 6.0 - they are much easier
              than exploded dirs...
              Usually, when I have a problem accessing the servlet once deployed, it's
              almost always the deployment descriptor.
              "Randy" <[email protected]> wrote in message
              news:3b311258$[email protected]..
              > Has anyone successfully deployed servlets using WAR file?I think I did
              everything right. The WAR file was deployed. But I can't accesss it.
              

  • Deploying Servlets in NetWeaver

    hi,
    i m new to SAP NetWeaver.Please tell me how can i deploy Servlets in NWDS.
    Thank u.

    hi,
    Firstly preapare a War file of the servlet class and its corresponding web.xml.Then select a Enterprise Project and add the web application project to the Enterprise project.Then configure the context url and prepare an "ear" file.Then deploy it to the J2ee server.
    This shd solve ur problem.

  • Deploying Servlets

    JDeveloper 3.2 Documentation for deploying servlets says the generated files should be placed in webserver and the classpath is to be set.
    I am using Apache HTTP web server. In which folder should I place the generated files and what should be the class path?
    Later what should be the URL to access the servlet from the browser?
    How can access this deployed Servlet from a JSP?
    Thanks in advance,
    Regards.
    Kavita.
    null

    Kavita,
    You should first check the Apache documentation for specific information about Apache.
    In general, you should place the servlet in a directory that is under the root directory for the server. For Apache, I believe it is htdocs under the installation directory (usually Apache/Apache/).
    You would then add this directory to the jserv.properties file as a wrapper.classpath entry. This will then point Apache to that directory.
    To access the servlet from a browser the general format is htttp://webserver:port/YourDirectoryName/servletName
    This should get you started.

  • Deploying Servlets / EJB

    Hi,
    I have Oracle 9i installed. It comes bundled with Apache web server minus documentation. Can I deploy Servlets/ EJBs. on this. Where can i get hold of documentation.
    Arun

    Are you using the SunONE portal server in your architecture? If your question is related to the Application server, you would find a greater chance of obtaining a solution through the web/app server forum.

  • Deploying servlets on the J2EE platform.

    Hello all,
    I have a pretty simple question. Does the J2EE platform have a web server for deploying servlets or do I need to download something to add to the platform to be able to run servlets? I have completed going through the tutorial for developing Dukes Bookstore Servlet. I got it to run and everything is fine. I have developed an HTTP Servlet that I need to run for an application to communicate with. I went through the steps I needed to be able to deploy this servlet through deploytool but I am getting an HTTP 404 error telling me the servlet is not available. Am I getting this error because the J2EE platform is only designed to run it's own example programs, meaning that I need to add a web server to the platform to get non J2EE examples to run through deploytool? Or is there some other reason for this error? If you need to see my HTTP servlet source code let me know and I will post it? Thanks, in advance, for any information you can give me concerning this issue.
    Sincerely,
    Michael Sucena

    Sorry, I should have said "shell variables". They set a number of them in that catalina.bat file. The actual call to java has a line:
    %_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% -Xrunjdwp:transport=%JPDA_TRANSPORT%,address=%JPDA_ADDRESS%,server=y,suspend=n %DEBUG_OPTS% -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Djava.security.manager -Djava.security.policy=="%SECURITY_POLICY_FILE%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%
    Comment this out. And place an "echo" command in front of %_EXEC_JAVA%. That should output the command the script is trying to run instead of running it (you may have to enclose or escape some of the above in quotes, my DOS scripting has been unused for a while). You should be able to see a typo in the command line being executed.
    Other than that, I am not sure what the problem might be. There is no reason to load a file starting with "-D", as this is a command-line argument for the java executable.
    - Saish
    "My karma ran over your dogma." - Anon

  • Hot deploying servlets without the admin tool

              Hey, all! I was wondering if there is a way to hot-deploy
              servlets without using the weblogic admin console.
              With ejbs, this is done through weblogic.deploy
              standalone. Thanks for your help!
              Alex Kagan
              

    WMarks,
    We've done something similar for one or two low-profile apps.
    You can use a tool such as wget ( Wget for Windows ) to download the installer to a known location on the user's workstation, and then run that installer as either a dynamic administrator or the system account in order to perform the installation.
    As others have mentioned, there will always be applications you'll need to find workarounds for if the vendor didn't code their application to be launched as a non-administrative user.
    Along with the least privilege solutions (mostly AD-based), you could investigate options such as VMware ThinApp or ZENworks Application Virtualization for apps that you absolutely have to have run as a non-admin, but remember there is always overhead introduced into the management and deployment process by re-packaging.
    pitcherj

  • How to deploy Servlet Application in Weblogic 8.1

    Hi,
    I am new to BEA Weblogic 8.1 .
    I was trying to create a sample application using InelliJ IDea 5.1 , and IntelliJIdea 10.5 . i configured weblogic with IDE , but now i do not know how to deploy my application in weblogic .
    I am new in IntelliJ also .
    So Can anyone tell me how can i deploy a servlet application in any IDE like i also have eclipse indigo.
    Thanks & Regards
    Komi

    Hi Komi
    Basically you deploy your Servlet as a WAR File. I am not familiar with IntellJ IDE. But it should have a provision to export/create a WAR file that has your Servlet. Also I hope you already have web.xml file with 2 sections like this: First you mention full package of your servlet and give it a name. Then enter a mapping url. You will use this url to run your servlet like http://weblogichost:weblogicport/yourWebappcontextroot/myservlet
    <servlet>
         <servlet-name>MyServlet</servlet-name>
         <servlet-class>com.abd.def.MyServlet</servlet-class>
    </servlet>
    <servlet-mapping>
         <servlet-name>MyServlet</servlet-name>
         <url-pattern>/myservlet</url-pattern>
    </servlet-mapping>
    Coming to deployment, I hope you already created a Weblogic Domain and have admin username/password. Start your domain. Login into weblogic console like http://host:port/console and use admin username/password. Then from Deployments section, deploy the above WAR file. In Weblogic you can deploy JAR (EJBs, java files), WAR (web jsp, html, webservices, servlets) or EAR (JAR + WAR). In your case its just a WAR file.
    Refer the online docs for more details on Deployments in Weblogic.
    http://docs.oracle.com/cd/E13196_01/platform/docs81/deploy/deploy.html
    Thanks
    Ravi Jegga

Maybe you are looking for

  • Manual AP Credit Memo- Need to change Withholind tax Liable to YES

    Hi ALL We created Manual AP Invoice for a supplier  ( Service Type) and there should be a witholding tax involve. When we tried to change the withholding tax from NO to YES, we cannot seem to edit the Field. We already check the Business partner Mast

  • Inserting pdf in word

    While inserting pdf file in word document, quality (resolution) of pdf is decreased. Before while using Win XP and office 2003 the same was not happening. Now using Win 7 and office 2010

  • Is anyone else having a weird bug in MobileMe gallery with volume on iOS 5

    Is anyone else having a weird bug in MobileMe gallery with volume on iOS 5? I am having a weird problem, where if I view a video I have uploaded and change the volume, I used the on-screen slider and It changed the volume but it also popped up like I

  • How to disable Quick Launch on Pavilion dv8t-1100

    The Treble keeps fluctuating, and the wireless connection keeps randomly turning off. I've already tried disabling it through msconfig, and uninstalling the drivers. No dice. I'm pretty sure this is a hardware issue. I honestly don't care if my warra

  • "The document contains multiple page sizes"

    I am using ID 2014.1 on Windows 7. I have a 60-page document, and whenever I want to print a page on my desktop printer, I get this message: I have not changed the size of any of the pages, and I can't see anything unusual when I go through the whole