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.

Similar Messages

  • Servlet deployment on iAS

    Hi all,
    I have been trying to deploy a servlet to iAS. I have done following steps:
    1) Created jar with the class files of http servlet/ dbservlet
    2) copied it to ..\iAS\Apache\Jserv\servlets
    3) Tried to call the simple http servlet http://koivu.fincosta.com/servlets/test1.Servlet1 or http://koivu.fincosta.com/servlet/test1.Servlet1
    and get http 404 error (page not found)
    I have tried also to define a wrapper.classpath in the jserv.properties for the jar.
    The JD's on-line manual is really confusing on this matter and haven't seen any example on OTN either.
    I would be very gratefull if somebody could tell me the steps for correct servlet deployment for iAS.
    Best regards,
    null

    sigh
    google: "eclipse war". First result:
    http://www.java-tips.org/other-api-tips/eclipse/how-to-make-war-file-in-eclipse.html
    I don't know if this applies to your version of Eclipse, but I hope you get the idea that a knowledge problem is not a valid reason to post in a forum; you do a google query in stead. It is the difference between being lazy and passing the problem to someone else, or being a proper developer and doing some research.

  • How to access contextRoot in Servlet deployed in an ear in Weblogic 81

    Hi,
    I need to access the contextRoot or webapp name from a startup servlet deployed in WebLogic. I've tried the following;
    getServletContext().getRealPath("/") return null.
    getServletContext().getServerInfo() returns Weblogic 8.1 service pack 3...
    getServletContext().getServletContextName() display the <display-name> value from my web.xml.
    What I want is the <context-root> value in the EARs application.xml.
    I tried the following JNDI lookup and the lookup failed but the error message contained the contextRoot.
    String name = (String) jndiContext.lookup("java:/comp/env/namespace");
    log.info("jndiContextlookup namespace = "+name);
    Any help would be GREATLY appreciated. This should be easy!!
    Shane

    Hi VR
    From Weblogic Admin Console, Deployments, on right side click on the link named with your EAR Application. It opens detailed page with more tabs. Click on the tab named Targets. Here select your WebService module and click on Change Targets button. Uncheck the server where it is targetted (Deployed), click on Yes. And activate the changes.
    Thanks
    Ravi Jegga

  • Whats the best way to get the server name in a servlet deployed to a cluster?

              Hi,
              I have a servlet in a web application that is deployed to a cluster, just
              wondering what is the best way to get the name of the node that the server is
              running on at run time??
              Thanks
              

              Please try to modify the following code and test for your purpose: (check Weblogic
              class document for detail)
              import javax.naming.*;
              import weblogic.jndi.*;
              import weblogic.management.*;
              import weblogic.management.configuration.*;
              import weblogic.management.runtime.*;
              MBeanHome home = null;
                   try{
                        //The Environment class represents the properties used to create
                             //an initial Context. DEfault constructor constructs an Environment
                             //with default properties, that is, with a WebLogic initial context.
                             //If unset, the properties for principal and credentials default to
                             //guest/guest, and the provider URL defaults to "t3://localhost:7001".
                             Environment env = new Environment();
                             //Sets the Context.PROVIDER_URL property value to the value of
                             //the argument url.
                             if(admin_url!=null){
                                  env.setProviderUrl(admin_url);
                                  //Sets the Context.SECURITY_PRINCIPAL property to the value of
                                  //the argument principal.
                                  env.setSecurityPrincipal(username);
                                  //Sets the value of the Context.SECURITY_CREDENTIAL property to
                                  //the value of the argument cedentials
                                  env.setSecurityCredentials(password);
                                  //Returns an initial context based on the properties in an Environment.
                                  ctx = env.getInitialContext();
                             }else ctx = new InitialContext();
                             home = (MBeanHome) ctx.lookup(MBeanHome.ADMIN_JNDI_NAME);
                             ctx.close(); //free resource
                             // or if looking up a specific MBeanHome
                             //home = (MBeanHome) ctx.lookup(MBeanHome.JNDI_NAME + "." + serverName);
                             DomainMBean dmb = home.getActiveDomain(); //Get Active Domain
                             ServerMBean[] sbeans = dmb.getServers(); //Get all servers
                             if(sbeans!=null){
                                  for(int s1=0; s1<sbeans.length; s1++){
                                       String privip = sbeans[s1].getListenAddress();
                                  sbeans[s1].getName();
                             sbeans[s1].getListenPort();
                                                 WebServerMBean wmb = sbeans[s1].getWebServer();
                   }catch(Exception ex){
              "Gao Jun" <[email protected]> wrote:
              >Is there any sample code? Thanks
              >
              >Best Regards,
              >Jun Gao
              >
              >"Xiang Rao" <[email protected]> wrote in message
              >news:[email protected]...
              >>
              >> Sure. You can use the Weblogic management APIs to query ServerBean.
              >>
              >>
              >> "Me" <[email protected]> wrote:
              >> >
              >> >Thanks for your reply, i was hoping to find a better way for example
              >> >a class in
              >> >weblogic API.
              >> >
              >> >Thanks
              >> >
              >> >"Xiang Rao" <[email protected]> wrote:
              >> >>
              >> >>Physical: InetAddress.getLocalHost().getHostName()
              >> >>Weblogic: System.getProperty("weblogic.Name");
              >> >>
              >> >>
              >> >>"Me" <[email protected]> wrote:
              >> >>>
              >> >>>Hi,
              >> >>> I have a servlet in a web application that is deployed to a
              >cluster,
              >> >>>just
              >> >>>wondering what is the best way to get the name of the node that
              >the
              >> >>server
              >> >>>is
              >> >>>running on at run time??
              >> >>>
              >> >>>Thanks
              >> >>
              >> >
              >>
              >
              >
              

  • Servlet deployment in Weblogic

    Hi,
    Its a very simple thing but somehow its not working.Saw many sites ,but the solution is the same.But its still not working..can anyone help.
    Well..I have written a simple servlet that prints Hello.I am trying to deploy it in Weblogic 6.1.But when i invoke it thru the brwser the web server simply cannot find the servlet..i mean therez no error etc..its just 'Error 404--Not Found
    From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
    10.4.5 404 Not Found
    The server has not found anything matching the Request....'
    I have modified the web.xml file and added this..
    <servlet>
         <servlet-name>DataFetchServlet</servlet-name>
         <servlet-class>DataFetchServlet.class</servlet-class>
         <servlet-mapping>
         <servlet-name>DataFetchServlet</servlet-name>
         <url-pattern>quickStartServlet</url-pattern>
         </servlet-mapping>
    </servlet>
    i am calling the servlet like this
    http://localhost:7001/quikStartServlet
    but in vain..am i missing somehting?
    I have put the class into classes directory of the WEB-INF directory as specified by BEA Weblogic docs.
    thanx in advance

    What context is the servlet in? Did you put in
    the "default web application" (either the one
    furnished by the WLS install or one that you so
    designated in the configuration)? If not, then that
    part of your URL is missing. E. g.
    http://localhost:7001/webappname/nameFromWebXml
    That right.
    But the user is also missing a '/' before the url pattern.
    <servlet-mapping>
    <servlet-name>DataFetchServlet</servlet-name>
    <url-pattern>/quickStartServlet</url-pattern>
    </servlet-mapping>
    Try that.

  • Error: java.lang.NullPointerException in servlet deployment

    Hi!!!
    Im trying to deploy a servlet created in Jdeveloper on OC4J, but got the Error: java.lang.NullPointerException when the Jdeveloper is deploying the servlet.
    The containers are running, so I don't know what is the problem....
    Thanks

    If you could give a little more info it would help. The web.xml for example, if your mapping it correctly, etc...

  • Servlet deployment problem

    hi all,
    i first post in java fundamental then i realize it should be in servlet sorry if u ppl suppose it repeated.
    i have a problem about which i search lot but didnt find any answer.
    i made an servlet and deploy it in tomcat.
    My directory structure is according to standard under midp folder. In my web.xml under WEB-INF/classes
    i wrote
    <web-app>
    <servlet>
    <servlet-name>bob</servlet-name>
    <servlet-class>HitServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>bob</servlet-name>
    <url-pattern>/hits</url-pattern>
    </servlet-mapping>
    </web-app>
    and acces it with http://localhost:8080/midp/hits
    it says hits not avaiable
    but when i change this section
    <servlet-mapping>
    <servlet-name>bob</servlet-name>
    <url-pattern>/servlet/HitServlet</url-pattern>
    </servlet-mapping>
    and access http://localhost:8080/midp/servlet/HitServlet
    it works.
    i cant understand y this happen bcz i wanna access it like
    http://localhost:8080/midp/hits
    what should i have to do?
    plz help me.

    Uh, you said that your web.xml is under /WEB-INF/classes? That's not the right place, it goes under /WEB-INF/.
    But...to answer your question, I see nothing wrong with your servlet and servlet mapping entries. A test on one of my apps worked perfectly.
    What App Server are you running? Did you stop it, redeploy, then restart it and then access the page?
    There's something else going on, because there's nothing wrong with your mapping.

  • How to get the Application name/fullpath in a servlet deployed in WebLogic

    Hi ,
    Just like we can get the domain root directory from weblogic.management.DomainDir
    String root = DomainDir.getRootDir() ;and domain name from weblogic.management.configuration.DomainMBean
    DomainMBean domainMBean = MBeanUtils.getDomainMBean();
    String domainName = domainMBean.getName() ;How can i get , the application name in which the servlet is deployed from inside the same servlet ? Which API from weblogic provides that information ?
    for eg : application path = Middleware/user_projects/domains/Domain_1/servers/AdminServer/upload/webapp1.war
    and application name = webapp1.war
    Edited by: Tom on Mar 31, 2011 9:32 PM

    Not sure about Weblogic Specific API however you can use Java API.
    public void init(ServletConfig config) throws ServletException {
              // TODO Auto-generated method stub
              System.out.println(config.getServletContext().getRealPath(""));
              System.out.println(config.getServletContext().getContextPath());
    output:
    C:\Documents and Settings\user\KEDB\KEDBRISKIT\WebContent --- Application Path
    /KEDBRISKIT --- Application Name
    -Akshay

  • Servlet deployment in oc4j

    How do you define system property with OC4J. OAS versions allow you to do that. I have servlet 2.1 compatible application that I want to deploy into oc4j without code changes. Any ideas?

    Or if you don't want to use property files you can use the ServletContext class which has two methods:
    public String ServletContext.getInitParameter(String name)
    public Enumaration ServletContext.getInitParameterNames()
    The init parameters for a context are specified in the web.xml deployment descriptor for the context using the <context-param> tag. Example:
    <web-app>
    <context-param>
    <param-name>rmihost</param-name>
    <param-value>localhost</param-value>
    </context-param>
    <context-param>
    <param-name>rmiport</param-name>
    <param-value>1099</param-value>
    </context-param>
    </web-app>
    To find the context init parameters in a servlet you can do:
    try {
    ServletContext context = getServletContext();
    String rmihost = context.getInitParameters("rmihost");
    int rmiport = Integer.parseInt(context.getInitParameter("rmiport"));
    } catch (Exception e) {
    }

  • Weblogic server 7.0 sp2 - servlet deployment

    Hi,
    Is there any way that i can delpoy a servlet with out context root name ?
    I am using weblogic 7.0 sp2.
    for eg. if i deply a war say "example.war"
    then it works only if i refer http://hostname:7001/example/servletClass. I need
    to refer like
    http://hostname:7001/servletClass.
    Is there any to deploy as a root servlet with out contxt root name ?
    Thanks

    "Bala" <[email protected]> wrote:
    >
    Hi Govind,
    To add what Selva said, you can also configure <context-root>/</context-root>
    parameter in weblogic.xml DD file. But you can have only one application
    as the
    default application for every WLS instance.
    Bala
    "Selvamohan Neethiraj" <[email protected]> wrote:
    Make the example application as the default Web application in the server.
    Thanks,
    Selva-
    "Govind" <[email protected]> wrote in message
    news:3f96e951$[email protected]..
    Hi,
    Is there any way that i can delpoy a servlet with out context rootname ?
    I am using weblogic 7.0 sp2.
    for eg. if i deply a war say "example.war"
    then it works only if i refer http://hostname:7001/example/servletClass.
    I need
    to refer like
    http://hostname:7001/servletClass.
    Is there any to deploy as a root servlet with out contxt root name?
    Thanks

  • Weblogic 7.0 servlets deployment and clustering

              I am unable to deploy servlet application in WL 7.0 cluster configuration. I am
              using Iplanet NES 4.0 as my web server. I have deployed the weblogic proxy successfully
              in iplanet.
              The servlet application has class files in exploded form and are present under
              bin/applications/DefaultWebApp/WEB-INF/classes folder
              web.xml also exists in the above folder.
              I receive the following exception.
              <Apr 23, 2003 2:26:44 PM EDT> <Error> <socket> <000405> <Uncaught Throwable in
              processSockets
              java.lang.NullPointerException
              java.lang.NullPointerException
              at weblogic.servlet.internal.ServletResponseImpl.writeHeaders(ServletResponseImpl.java:968)
              at weblogic.servlet.internal.ServletOutputStreamImpl.sendHeaders(ServletOutputStreamImpl.java:239)
              at weblogic.servlet.internal.ServletOutputStreamImpl.flush(ServletOutputStreamImpl.java:121)
              at weblogic.servlet.internal.ServletOutputStreamImpl.commit(ServletOutputStreamImpl.java:481)
              at weblogic.servlet.internal.ChunkOutput.commit(ChunkOutput.java:259)
              at weblogic.servlet.internal.ChunkOutputWrapper.write(ChunkOutputWrapper.java:91)
              at weblogic.servlet.internal.ChunkWriter.write(ChunkWriter.java:37)
              at java.io.Writer.write(Writer.java:148)
              at java.io.PrintWriter.write(PrintWriter.java:208)
              Please help.
              

    This might be a known bug, please contact support and reference CR100572 to
              see if it is also a bug in WLS7.0
              sree
              "Manju" <[email protected]> wrote in message
              news:[email protected]...
              >
              > I am unable to deploy servlet application in WL 7.0 cluster configuration.
              I am
              > using Iplanet NES 4.0 as my web server. I have deployed the weblogic proxy
              successfully
              > in iplanet.
              > The servlet application has class files in exploded form and are present
              under
              > bin/applications/DefaultWebApp/WEB-INF/classes folder
              > web.xml also exists in the above folder.
              > I receive the following exception.
              > <Apr 23, 2003 2:26:44 PM EDT> <Error> <socket> <000405> <Uncaught
              Throwable in
              > processSockets
              > java.lang.NullPointerException
              > java.lang.NullPointerException
              > at
              weblogic.servlet.internal.ServletResponseImpl.writeHeaders(ServletResponseIm
              pl.java:968)
              > at
              weblogic.servlet.internal.ServletOutputStreamImpl.sendHeaders(ServletOutputS
              treamImpl.java:239)
              > at
              weblogic.servlet.internal.ServletOutputStreamImpl.flush(ServletOutputStreamI
              mpl.java:121)
              > at
              weblogic.servlet.internal.ServletOutputStreamImpl.commit(ServletOutputStream
              Impl.java:481)
              > at
              weblogic.servlet.internal.ChunkOutput.commit(ChunkOutput.java:259)
              > at
              weblogic.servlet.internal.ChunkOutputWrapper.write(ChunkOutputWrapper.java:9
              1)
              > at
              weblogic.servlet.internal.ChunkWriter.write(ChunkWriter.java:37)
              > at java.io.Writer.write(Writer.java:148)
              > at java.io.PrintWriter.write(PrintWriter.java:208)
              >
              >
              > Please help.
              >
              

  • 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!

  • Servlet deploy

    hi iam new to servlet technology.
    iam trying to deploy servlet .
    directory structure is :
    myweb-->jsp files,html files
    -->WEB-INF-->classes-->myservlet
    -->web.xml
    i made a war file and copied in webapps directory.iam using tomcat 5.0 server.
    i deployed war file. it is saying myservlet not available. do i have make url-mapping. i thought it not a mandatory. i have only servlet name & servlet-class entries in web.xml.
    please let me know what are the entries in web.xml & with what name i have to deploy.
    thanks

    hi,
    Please read the following tutorial
    http://java.sun.com/j2ee/1.4/docs/tutorial/doc/
    or
    http://www.coreservlets.com/Apache-Tomcat-Tutorial/
    and the
    most simple tut
    http://www.caucho.com/resin-3.0/servlet/tutorial/helloworld/index.xtp
    use
    <web-app >
    instead of
    <web-app xmlns="http://caucho.com/ns/resin">

  • Servlet deploy to 9ias

    Hi oracle team,
    I have a servlet in jdev903 run is OK but to deploy 9iAS
    903 ocour 500 Internal Server Error
    java.lang.UnsupportedClassVersionError: request/Servlet2 (Unsupported major.minor version 48.0)
         at java.lang.ClassLoader.defineClass0(Native Method)
         at java.lang.ClassLoader.defineClass(ClassLoader.java:488)
    is 9ias bug?
    package request;
    import javax.servlet.ServletException;
    import javax.servlet.http.*;
    import java.io.PrintWriter;
    import java.io.IOException;
    public class Servlet1 extends HttpServlet
    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    out.println("<html>");
    out.println("<head><title>Servlet1</title></head>");
    out.println("<body>");
    out.println("<p>The servlet has received a GET. This is the reply.</p>");
    out.println("</body></html>");
    out.close();

    You should recompile your servlet against JDK 1.3, not JDK 1.4 (or upgrade your iAS to 9.0.4)
    [JDK 1.4 uses class file version 48.0]
    Rob
    Team JDev

  • Servlet deploy via command line

    Is there a way to deploy Servlets like EJB. I mean, is there a command line
              you can use under Unix to hot-deploy a servlet without using the Console nor
              to restart the server?
              

    You have to set the servlet classpath in weblogic.properties file to a
              specific directory. Now If all your servlets are present in this specific
              directory then you dont have to restart the server.
              Parikshit
              "UAI" <[email protected]> wrote in message
              news:8e3foa$7ij$[email protected]..
              > Is there a way to deploy Servlets like EJB. I mean, is there a command
              line
              > you can use under Unix to hot-deploy a servlet without using the Console
              nor
              > to restart the server?
              >
              >
              >
              >
              

  • EJB & Servlet deployment in Clustered Env.

              Hi,
              I have made a cluster of 3 weblogic servers. I would like to send a request to one
              server (e.g. http://myserver1:7001/TestServlet). The servlet utilizes an EJB which
              is not located and not deployed on myserver1 , but on other 2 servers in the cluster.
              The algorithm is round-robin. It gives me a lot of errors (Impl... classes not found
              etc etc).
              Do I have to deploy everything on all the servers?
              If I do that, the request is not routed to other servers. Since the servlet finds
              the EJB locally, it never goes to the other servers, regardless of the algorithm.
              I have set up the "home-is-clusterable" and all other relevant properties for EJB
              deployment.
              Any ideas??
              Sharad
              

    If the ejb is deployed on the server that is looking for the ejb, then it
              won't go network to use the ejb. That is a "big" WL optimization, and helps
              quite a bit for most apps.
              If you want to segregate the ejb and web functionality, you should probably
              consider running two distinct clusters (in 5.1 parlance).
              I suggest putting web and ejb together though and clustering that. Latency
              is lower. Scalability is not particularly affected. Configuration is much
              simpler.
              Peace,
              Cameron Purdy
              Tangosol, Inc.
              http://www.tangosol.com
              +1.617.623.5782
              WebLogic Consulting Available
              "Sharad Joshi" <[email protected]> wrote in message
              news:[email protected]...
              >
              > Hi,
              >
              > I have made a cluster of 3 weblogic servers. I would like to send a
              request to one
              > server (e.g. http://myserver1:7001/TestServlet). The servlet utilizes an
              EJB which
              > is not located and not deployed on myserver1 , but on other 2 servers in
              the cluster.
              > The algorithm is round-robin. It gives me a lot of errors (Impl... classes
              not found
              > etc etc).
              >
              > Do I have to deploy everything on all the servers?
              > If I do that, the request is not routed to other servers. Since the
              servlet finds
              > the EJB locally, it never goes to the other servers, regardless of the
              algorithm.
              > I have set up the "home-is-clusterable" and all other relevant properties
              for EJB
              > deployment.
              >
              > Any ideas??
              >
              > Sharad
              

Maybe you are looking for

  • Regarding ABAP HR

    hi experts, i'm getting small problem in creation of infotype i have created one custom infotype in PA by using table control problem is i have entered  5 rows data for one duration when i'm checking data in overview it showing 5 records for single d

  • Problem with variables declared as private?

    Hi all, I am currently having a very weird problem when i am running one of the JSP application deployed using weblogic. I have a variable x and is declared as private. By looking at the log file of every transaction done by the users, i can't trace

  • File Permission and HttpClient

    I'm trying to use HttpClient to upload files with my applet. I'm signing my applet and can read files directly, but when I go to upload using HttpClient I get access denied errors: ERROR: java.security.AccessControlException access denied (java.io.Fi

  • Need suggestion regarding File compression and splititng

    Hi, I want to split and compress the big files into small chucks. On later any standard zip utility i.e. winzip, 7z etc can merge(extract) all the chunks to generate the original file. I am looking for any java library which provide the split and com

  • Deleting texts and call log

    i have had my bb pearl 8100 for about 8 months and until now it's been great.  the past few days it's been automatically deleting my texts and mms as well as my call log.  i removed the battery for a few minutes to hopefully reset it.  i also double