Servlet definition outside war filr

Hello
I am having question related to packaging servlets. I have ear file, which contains war wile , which contains html files and servlet definition and all needed stuff.
And it is fine for me.
My question is:
is it possible to have ear file with separate war and jar files, where servlet definition is being stored within jar file (as on picture below ) ?
ear--
|
---war
---jar
Regards
Marcin

"maybe", but then in a jar which is present in the WEB-INF/lib of the war, not in a jar that is part of the ear.
Of course nothing can stop you from trying it out, but I'm pretty sure you'll be met with incredibly nasty deployment error messages.

Similar Messages

  • How to run a Servlet Project's .war from Command Line??

    Hi there,,
    Can anybody help me with how to run a Servlet Project's .war file from command line??In fact I tried it using the following command,
    java -jar TestServProj.war
    but I get the following error,,,
    Failed to load Main-Class manifest attribute
    I can't find the project''s manifest file in the META-INF folder.
    Moreover,plz help me about know how to execute a single servlet class from command line...
    Thanks in advance...

    you cant run a .war file from command prompt
    .war files should be executed in a server
    how to execute a single servlet class
    do you mean to run the servlet or compile the servlet?
    any way you need a server and if you are a beginner Apache tocat will be the best server to start with you can down load it from
    http://tomcat.apache.org/

  • Response Already commited exception while displaying Image outside WAR File

    My application contains a JSF page, which is bound to a Spring bean. The UI components state of the JSF page is provided by the Spring bean properties (This means the Spring bean is the backing bean of the JSF page) . My problem is the JSF page also contains a graphicImage meant to display image stored outside the WAR file.
    I tried using the ImageServlet that streams the image to the HttpServletResponse as suggested in:
    http://balusc.blogspot.com/2007/04/imageservlet.html However, I receive a Response Already commited exception. I guess this is because the Faces servlet has already sent back a response based on the other UI component values and the ImageServlet is then trying to repeat that. Please suggest how to handle this

    First thanks for your prompt reply but I am still stuck. Let me get into details. My JSF page is:
    <f:view>
      <h:form id="MyForm" >
        <h:graphicImage value="image?file=#{springDaoRef.imageName}&url=#{springDaoRef.imageUrl}"  width="100" 
           height="100"/>
       Category: <h:outputText value="#{springDaoRef.categoryName}"/>
       Image Title: <h:outputText value="#{springDaoRef.imageTitle}"/>
      </h:form>
    </f:view>The ImageServlet is receiving the file and url parameter values and reading quite fine from the image present in the file system. The problem occurs at the following statement in ImageServlet:
    output = new BufferedOutputStream(response.getOutputStream());Im using Glassfish and it reports the following stack:
    ApplicationDispatcher[/OnlinePhotoSharingApp_1] PWC1231: Servlet.service() for servlet ImageServlet threw exception
    java.lang.NullPointerException
            at net.time2know.classes.ImageServlet.processRequest(ImageServlet.java:106)
            at net.time2know.classes.ImageServlet.doGet(ImageServlet.java:123)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:718)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
            at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
            at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
            at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:853)
            at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:703)
            at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:542)
            at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:474)
            at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:366)
            at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:408)
            at com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:442)
            at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:115)
            at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
            at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
            at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
            at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
            at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
            at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:301)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
            at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:288)
            at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
            at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
            at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
            at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
            at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
            at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
            at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
            at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
            at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
            at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
            at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272)
            at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
            at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
            at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
            at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
            at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
            at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
            at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
            at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
    executePhase(RENDER_RESPONSE 6,com.sun.faces.context.FacesContextImpl@f801ef) threw exceptionI am assuming that the image request is going through the FacesServlet. But now my question is how to inform JSF that the response is complete (via FacesContext.responseComplete()) which will enable the ImageServlet to send the image response?

  • Pre-load servlets from a war-file

    Hello,
              is there a way to pre-load a servlet (or execute any other code)
              at server startup, when the application is deployed as a .war-file?
              I know how to use the weblogic.servlet.utils.ServletStartup and
              the weblogic.system.startupClass... property, but these two
              seem to require that the servlet (or application class, respectively)
              are found in the servlet classpath (or the weblogic.class.path,
              respectively), so these mechanisms cannot peek into war-files to find
              the class, am I right?
              The page http://www.weblogic.com/docs51/classdocs/webappguide.html#dtprops
              says:
              <load-on-startup>load_order</load-on-startup>
              (Optional) This property is not honored by WebLogic Server in this release.
              Is this still valid?
              Is there a workaround?
              When will this element be supported?
              Concerning a possible workaround, I have read:
              > Subject: Re: Pre-load
              > Date: Fri, 19 Nov 1999 14:38:41 -0500
              > From: Jeff Martin <[email protected]>
              > Newsgroups: weblogic.developer.interest.servlet
              > Tom Gerber wrote:
              > >
              > > How do you get your startup class to start? Do you have a
              > > script which calls your startup class via a URL? Or is
              > > there a setting in the weblogic properties file for it?
              > Starting WebLogic in unix is a shell script. Just add a line to run your
              > preload program (e.g. java Preload).
              > Some unixes have utilities to get a web page from the command line (to
              > do shell parsing on it); create a series of calls, one per page.
              That sounds like a possibility, but I do not understand exactly.
              1) Where do I have to put the line into the shell script?
              2) Which line is it?
              3) What is the UNIX utility?
              I am using WL 5.1 (evaluation) under Solaris.
              Any help appreciated,
                   Oliver Matz
              | _ \ / \ | __)( ) Oliver Matz, Engineer
              | _/( () )| __) | | fon: +49(0)40/60990-0
              |_| \__/ |___) |_| fax: +49(0)40/60990-113
              

    Yes you can load a java applet form a jar file.
    Here is the code for internet explorer.
    <body>
         <table align="center" border="1">
              <tr>
                   <td>
                        <object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" width="10" height="10" codebase="/plugin/">
                        <param name="code" value="XXX.class">
                        <param name="archive" value="XXX.jar">
                        </object>
                   </td>
              </tr>
         </table>
    </body>
    </html>
    Just replace the XXX.class with the class containing the init() method and XXX.jar with the jar file.

  • Completing jsp using web pages from outside war

    I have a .jsp called Welcome Page. On it, I wish to include the content of another web page that is located outside of the context root. I know the file's location on the server and I know the real URL of the file (it's an html file).
    Before I go through any heartache of reinventing the wheel, what, if any, method can I use to accomplsh this? I have already tried
    jsp:include...
    pageContext.include...
    getResourceAsStream...Your help is appreciated.

    I am using webSphere server, so this does not directly relate to what I need, but it did offer me a line of thought. Even after reading this, though, I noticed that it was only good for web apps running within the same virtual host.
    To give an example, say I have a web page at www.mycompany.com and wish to include the page www.someothercompletelydifferentcompnay.com/info.html
    Is there a way to do this?

  • Different execute queues with different thread priorities

    We are running WebLogic 6.1, SP2 on Solaris 2.8 and I have a question related to the
    use of Execute queues
    I'm aware that the administration console servlets, and the rest of requests given
    to the server run in separate execution queues each with their own pool of threads.
    There is an <executequeue> element in the config.xml that allows you to change the
    parameters of the default execute queue that most requests are handled in.
    My question is is it possible to create new execute queues, each with a given number
    of threads running at a different priority. Then one could assign a particular WAR
    deployment to a queue and hence control the priority that certain requests run at
    governed by the deployment that received the initial request.
    Essentially the problem that I'm trying to address is that I have a JAR with MDBs
    in it. I also have JARs with Entity and Session EJBs and WARs. They are all using
    the same pool of threads to execute. I want to be able to throttle the MDBs as they
    receive messages so they don't take over the machine and interfere with interactive
    use. Now I can limit the number of MDBs in the MDB pool, but then if the machine
    is not being used by users, then the machine resources are wasted only allowing one
    MDB to be active at a time when there are a lot of messages in the queue.
    What I want to be able to do is to have as many MDBs run as I can, up to a certain
    limit, say 15 for example, but not to pull from the same thread pool/execute queue
    as the requests for URLs in the WAR. Also I want the MDB threads to run at a much
    lower priority and always give preference to interactive requests.
    So interactive threads will always win and grab the processors if interactive use
    is high, but if it's not, the MDBs can run instead.
    Regs,
    Paul

    Hi,
    I had a chat with BEA support about my issue. You can create multiple ExecuteQueues
    and assign them to servlet definitions in WARs in the web.xml, and with an option
    to the EJBC compiler, you can assign a particular class of EJB to an ExecuteQeueue.
    For details see http://e-docs.bea.com/wls/docs61/perform/AppTuning.html#1106284
    Presumably it's the thread of the initial request that counts, i.e. if a WAR calls
    an EJB, then it's the thread in the execute queue of the WAR that will be used right
    the way through the request, not that of the EJB being called, assuming they are
    both deployed in the same WebLogic instance. If they were in different instances,
    you would obviously have a thread from the WAR queue on one instance, and a thread
    from the EJB queue on another instance.
    If a plain Java command-line client connected directly to an EJB, then it would be
    the thread from the ExecuteQueue of the EJB that would get used.
    I've been told that MDBs always run in the default queue, so it seems that the way
    for me to do what I want is just to create an ExecuteQueue, set the priority of the
    threads in this queue to be higher than that of the default queue, and assign this
    queue to my WARs. I can leave my EJBs running in the default queue.
    Regs,
    Paul
    "Dimitri I. Rakitine" <[email protected]> wrote:
    Don't know about 6.1 (One can find out very easily what the possible config
    parameters
    are by deploting
    http://dima.dhs.org/misc/listMBeans.jsp and
    http://dima.dhs.org/misc/showMBean.jsp
    abd looking at the XXXConfig mbeans), but in 7.0 there are quite a few
    things which
    can be tuned in the executequeue config (and priority is one of them. also
    interesting
    is that it is possible to configure it to increase number of execute threads
    when queue
    length exceeds some specified threshold) :
    QueueLength
    Returns the maximum length of this queue.
    ThreadPriority
    Returns the priority of the threads associated with this queue.
    ThreadCount
    Returns the number of threads assigned to this queue.
    QueueLengthThresholdPercent
    Returns the threshold percent for length of this queue, set in QueueLength.
    ThreadsIncrease
    Returns the number of threads to grow when a queue is within QueueLengthThresholdPercent
    of the set QueueLength.
    ThreadsMaximum
    Returns the maximum number of threads in the pool.
    ThreadsMinimum
    Returns the minimum number of threads in the pool.
    Dimitri

  • Calling servlets in another jar/war

    I am working on an integration project.
    I have a war file that has many of the components that I need.
    In my new project (Sun Studio IDE), I am trying to call up a servlet that exists in this other war file.
    I can mount the war file as a directory, just like mounting a jar for use like classes12.zip whatever or similar to including a jar in your classpath.
    Can I call a servlet in another jar, war, or zip file from my existing code?
    How will the existing code or jsp know where to find this servlet outside the project?
    Usually you have to either map the servlet or set this info in the web.xml, I think.
    If the servlet mappings are in the web.xml, does that mean that if I access a servlet in another war, with it's own web.xml, does that mean that I have to map that servlet in my current projects web.xml also?
    Thanks

    Can I call a servlet in another jar, war, or zip file
    from my existing code?
    How will the existing code or jsp know where to find
    this servlet outside the project?When you say 'call' I assume you mean forward. Yes, you can forward to servlets in other contexts/wars.
    If the other context is say 'appB' you can forward the request to a servlet mapped as say '/test' in web.xml of appB in the following way:
    getServletContext().getContext("/appB").getRequestDispatcher("/test").forward(request,response);
    Usually you have to either map the servlet or set this
    info in the web.xml, I think.
    If the servlet mappings are in the web.xml, does that
    mean that if I access a servlet in another war, with
    it's own web.xml, does that mean that I have to map
    that servlet in my current projects web.xml also?No. You don't need to map it again. However as you might have noticed, you do need to know the url pattern of the other servlet, so that you can forward properly.
    But beware - Session info will not be shared in cross-context forwarding

  • Unable to deploy a simple servlet using WAR file on Oracle9iAS v9.0.3

    Hi All,
    I am facing problem while deploying a simple servlet using WAR file on Oracle 9i App Server.
    I have installed Oracle9iAS J2EE and Web Cache v9.0.3 on Windows 2000 server.
    It includes:
         - Oracle HTTP Server
         - Oracle9iAS Containers for J2EE
         - Oracle9iAS Web Cache
         - Oracle Enterprise Manager
    The release of installed Oracle9iAS is Release 2 (9.0.3)      
    I referred following link to Deploy Applications Using WAR file:
         http://otn.oracle.com/products/ias/daily/sept12.html
    As mentioned in this documentation I have followed following steps to deploy WAR file:
    1] I have created a war file by name SimpleServlet.war. In SimpleServlet.war, there is a servlet by name Simple which prints time at which servlet was accessed.
    2] I have modified <ora9ias_home>\j2ee\home\config\application.xml and added following web module entry:
         <web-module id="SimpleServlet" path="../../home/applications/SimpleServlet.war" />
    3] To make this module accessible from over the web, I have modified file
         <ora9ias_home>\j2ee\home\config\default-web-site.xml and added following entry:
         <web-app application="SimpleServlet" name="SimpleServlet" root="/SimpleServlet"/>
    4] I saved both the files and started Oracle HTTP Server and accessed page as below:
              http://<server>:7777/SimpleServlet/Simple
    where Simple is servlet in SimpleServlet.war file.          
    In the browser, The page cannot be found is shown to user. I have verified that SimpleServlet.war is extracted to SimpleServlet folder under <ora9ias_home>\j2ee\home\applications folder. I found that Simple.class is stored under WEB-INF/classes folder and web.xml contains correct entry for url pattern for servlet Simple.
    What else could be the problem? Am I placing the war file in wrong place or modifying application.xml or default-web-site.xml in a wrong directory?
    This is very urgent. Please help me with your valuable comments on this.
    Thanks in advance.
    Regards,
    Sandesh

    Hi All,
    I am facing problem while deploying a simple servlet
    using WAR file on Oracle 9i App Server.
    I have installed Oracle9iAS J2EE and Web Cache v9.0.3
    on Windows 2000 server.
    It includes:
         - Oracle HTTP Server
         - Oracle9iAS Containers for J2EE
         - Oracle9iAS Web Cache
         - Oracle Enterprise Manager
    The release of installed Oracle9iAS is Release 2
    (9.0.3)      
    I referred following link to Deploy Applications
    Using WAR file:
         http://otn.oracle.com/products/ias/daily/sept12.html
    As mentioned in this documentation I have followed
    following steps to deploy WAR file:
    1] I have created a war file by name
    SimpleServlet.war. In SimpleServlet.war, there is a
    servlet by name Simple which prints time at which
    servlet was accessed.
    2] I have modified
    <ora9ias_home>\j2ee\home\config\application.xml and
    added following web module entry:
    <web-module id="SimpleServlet"
    path="../../home/applications/SimpleServlet.war" />
    3] To make this module accessible from over the web,
    I have modified file
    <ora9ias_home>\j2ee\home\config\default-web-site.xml
    and added following entry:
    <web-app application="SimpleServlet"
    name="SimpleServlet" root="/SimpleServlet"/>
    4] I saved both the files and started Oracle HTTP
    Server and accessed page as below:
              http://<server>:7777/SimpleServlet/Simple
    where Simple is servlet in SimpleServlet.war file.          
    In the browser, The page cannot be found is shown to
    user. I have verified that SimpleServlet.war is
    extracted to SimpleServlet folder under
    <ora9ias_home>\j2ee\home\applications folder. I found
    that Simple.class is stored under WEB-INF/classes
    folder and web.xml contains correct entry for url
    pattern for servlet Simple.
    What else could be the problem? Am I placing the war
    file in wrong place or modifying application.xml or
    default-web-site.xml in a wrong directory?
    This is very urgent. Please help me with your
    valuable comments on this.
    Thanks in advance.
    Regards,
    SandeshHave you restarted you http server and then tried to load it again? Are you using the right port; maybe you have to use port 7778? Check you server settings in the http server instance. Also check your url binding of you application at Farm > Application Server: infrastructurehost > OC4J_instance > Application: appname > Web Module: modulename
    Good luck!
    rgds Thomas

  • Unable to deploy a simple servlet using WAR file

    Hi All,
    I am facing problem while deploying a simple servlet using WAR file on Oracle 9i App Server.
    I have installed Oracle 9i App Server. I referred following link to Deploy Applications Using WAR file:
         http://otn.oracle.com/products/ias/daily/sept12.html
    As mentioned in this documentation I have followed following steps to deploy WAR file:
    1] I have created a war file by name SimpleServlet.war. In SimpleServlet.war, there is a servlet by name Simple which prints time at which servlet was accessed.
    2] I have modified <ora9ias_home>\j2ee\home\config\application.xml and added following web module entry:
         <web-module id="SimpleServlet" path="../../home/applications/SimpleServlet.war" />
    3] To make this module accessible from over the web, I have modified file
         <ora9ias_home>\j2ee\home\config\default-web-site.xml and added following entry:
         <web-app application="SimpleServlet" name="SimpleServlet" root="/SimpleServlet"/>
    4] I saved both the files and started Oracle HTTP Server and accessed page as below:
              http://<server>:7777/SimpleServlet/Simple
    where Simple is servlet in SimpleServlet.war file.          
    In the browser, The page cannot be found is shown to user. I have verified that SimpleServlet.war is extracted to SimpleServlet folder under <ora9ias_home>\j2ee\home\applications folder. I found that Simple.class is stored under WEB-INF/classes folder and web.xml contains correct entry for url pattern for servlet Simple.
    What else could be the problem? Am I placing the war file in wrong place or modfiying application.xml or default-web-site.xml in a wrong directory?
    This is very urgent. Please help me with your valuable comments on this.
    Thanks in advance.
    Regards,
    Sandesh

    Hi Juliana,
    Thanks a lot for your suggestion.
    I am sorry if I have posted this message to a wrong forum. This is first time I am posting a message to OTN. I will resend message to J2EE forum as per you suggestion.
    Meanwhile, please note information you asked for is as below:
    I installed Oracle9iAS J2EE and Web Cache v9.0.3 on Windows 2000 server.
    It includes:
         - Oracle HTTP Server
         - Oracle9iAS Containers for J2EE
         - Oracle9iAS Web Cache
         - Oracle Enterprise Manager
    The release of installed Oracle9iAS is Release 2 (9.0.3)      
    Please do reply at the earliest.
    Once again thanks and look forward to hear from you.
    Regards,
    Sandesh

  • Oddities when serving images via NES from a servlet that is part of a WAR

    Just wanted to confirm that the following behavior is normal:
              Environment:
              NT 4.0 SP5
              NES 3.6 SP3
              WLS 5.1 SP3
              jdk 1.2.2
              Goal: When constructing a page that has images embedded in it from my
              servlet, I would like NES to serve the images.
              I've found out that I've to refer to my images with an absolute URL that
              maps to the images directory under Netscape's document root. If I refer to
              my image with a relative URL (request.getContextPath() +
              "/images/cookie.jpg"), then WebLogic tries to retrieve the image from the
              WAR. What is interesting is if I use relative references to images within my
              servlet (minus the WAR, i.e. with the servlet registered in
              weblogic.properties), I see that the image is being served by Netscape.
              Why does the WAR require absolute references to images and the previous
              mechanism does not? Is this behavior consistent with the spec? How are you
              guys handling this (are you using absolute references to static content when
              using WAR?)?
              I'm really baffled by this and wanted to see how others view this. Any
              comments/feedback will be much appreciated.
              Thanks,
              Sanjiv
              

    Hi Cameron,
              You are right but see my "Goal" below. I want to serve my images from my web
              server and NOT by WebLogic. Anyway, I spent too much time on this and found
              out that I was getting inconsistent results during testing different
              approaches because I was not restarting my web server. Once I became
              consistent in restarting my web server and closing all browser windows
              before each test, I got consistent results. So, here's what works for me:
              If I want to have my JSPs/servlets running in WLS to serve images that are
              included in their output from my web server, then I've to use absolute URLs.
              An example would be:
              img src="/images/a.gif"
              On the other hand if I use relative paths like img src="images/a.gif", then
              the browser request for the image is sent to WebLogic, which then looks for
              the image in the WAR (as it should).
              All of this might be common knowledge to most folks but not me.
              Thanks,
              Sanjiv
              Cameron Purdy <[email protected]> wrote in message
              news:[email protected]...
              > The WAR does not require absolute paths. Your JSP must be served from a
              URL
              > that, when combined with a relative path, actually specifies an image in
              the
              > WAR.
              >
              > Cameron Purdy, LiveWater
              >
              > "Sanjiv Gulati" <[email protected]> wrote in message
              > news:[email protected]...
              > > Just wanted to confirm that the following behavior is normal:
              > >
              > > Environment:
              > > NT 4.0 SP5
              > > NES 3.6 SP3
              > > WLS 5.1 SP3
              > > jdk 1.2.2
              > >
              > > Goal: When constructing a page that has images embedded in it from my
              > > servlet, I would like NES to serve the images.
              > >
              > > I've found out that I've to refer to my images with an absolute URL that
              > > maps to the images directory under Netscape's document root. If I refer
              to
              > > my image with a relative URL (request.getContextPath() +
              > > "/images/cookie.jpg"), then WebLogic tries to retrieve the image from
              the
              > > WAR. What is interesting is if I use relative references to images
              within
              > my
              > > servlet (minus the WAR, i.e. with the servlet registered in
              > > weblogic.properties), I see that the image is being served by Netscape.
              > >
              > > Why does the WAR require absolute references to images and the previous
              > > mechanism does not? Is this behavior consistent with the spec? How are
              you
              > > guys handling this (are you using absolute references to static content
              > when
              > > using WAR?)?
              > >
              > > I'm really baffled by this and wanted to see how others view this. Any
              > > comments/feedback will be much appreciated.
              > >
              > > Thanks,
              > > Sanjiv
              > >
              > >
              >
              >
              

  • War file not loading - Offending class: javax/servlet/Servlet.class

    Hello;
    I've got a war file for an app that I've been building for the past several weeks. I created a new version and uploaded it to the server and received a 404 error when trying to call a servlet in the war. The catalina.out file had the following message:
    WebappClassLoader: validateJarFile(/usr/local/apache/tomcat/webapps/optintelligence/WEB-INF/lib/j2ee.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
    I've not changed my libraries at all and I don't see any conflict with another appliacation. The war file works on my local windows machine but has this error on a RedHat server. Both are running tomcat 4.x
    I would appreciate any information on this problem.
    Thanks;
    Marshall

    You might still get the warning when you start Tomcat:
    WebappClassLoader: validateJarFile(/usr/local/apache/tomcat/webapps/optintelligence/WEB-INF/lib/j2ee.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
    That's because you have the j2ee.jar as part of the web application. The servlet specficiation forbids a web application trying to override core java, j2ee classes. Thererfore Tomcat prints the warning message that the particular jar could not be loaded as it is trying to override a core java-j2ee class.
    If you remove the j2ee.jar from the web app WEB-INF/lib folder, the warning will disappear.

  • Problems loading Servlet in WAR deployment

    I'm deploying a servlet using a war file. I am able to deploy the war under
              both WebLogic 6.0 sp2 and WebLogic 6.1 beta. However, when I try to access
              the servlet from a browser I get the following error:
              [java] <Aug 7, 2001 2:49:13 PM CDT> <Error> <HTTP>
              <[WebAppServletContext(1
              287677,Alert-weblogic60,/Alert-weblogic60)] Error loading servlet:
              'AlertEventLi
              stenerServlet'
              [java] java.lang.NoClassDefFoundError: org/apache/log4j/Category
              [java] at
              com.agea.alert.servlet.AlertEventListenerServlet.<init>(Alert
              EventListenerServlet.java:25)
              [java] at java.lang.Class.newInstance0(Native Method)
              [java] at java.lang.Class.newInstance(Class.java:237)
              [java] at
              weblogic.servlet.internal.ServletStubImpl.createServlet(Servl
              etStubImpl.java:641)
              [java] at
              weblogic.servlet.internal.ServletStubImpl.createInstances(Ser
              vletStubImpl.java:619)
              [java] at
              weblogic.servlet.internal.ServletStubImpl.prepareServlet(Serv
              letStubImpl.java:564)
              [java] at
              weblogic.servlet.internal.ServletStubImpl.getServlet(ServletS
              tubImpl.java:344)
              [java] at
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(Servl
              etStubImpl.java:240)
              [java] at
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(Servl
              etStubImpl.java:200)
              [java] at
              weblogic.servlet.internal.WebAppServletContext.invokeServlet(
              WebAppServletContext.java:2279)
              [java] at
              weblogic.servlet.internal.ServletRequestImpl.execute(ServletR
              equestImpl.java:1923)
              [java] at
              weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
              [java] at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              [java] >
              Obviously the problem is that the servlet can't load the
              org.apache.log4j.Category class. However, I have included the log4j.jar
              file (which contains the org.apache.log4j.Category class) in the war under
              WEB-INF/lib. Why isn't the classloader picking it up?
              Thanks for the help,
              Tim
              

    Did you make sure that:
              org/apache/log4j/Category
              is in the server's classpath?
              "Timothy O'Hara" <[email protected]> wrote in message
              news:[email protected]...
              > I'm deploying a servlet using a war file. I am able to deploy the war
              under
              > both WebLogic 6.0 sp2 and WebLogic 6.1 beta. However, when I try to
              access
              > the servlet from a browser I get the following error:
              >
              > [java] <Aug 7, 2001 2:49:13 PM CDT> <Error> <HTTP>
              > <[WebAppServletContext(1
              > 287677,Alert-weblogic60,/Alert-weblogic60)] Error loading servlet:
              > 'AlertEventLi
              > stenerServlet'
              > [java] java.lang.NoClassDefFoundError: org/apache/log4j/Category
              > [java] at
              > com.agea.alert.servlet.AlertEventListenerServlet.<init>(Alert
              > EventListenerServlet.java:25)
              > [java] at java.lang.Class.newInstance0(Native Method)
              > [java] at java.lang.Class.newInstance(Class.java:237)
              > [java] at
              > weblogic.servlet.internal.ServletStubImpl.createServlet(Servl
              > etStubImpl.java:641)
              > [java] at
              > weblogic.servlet.internal.ServletStubImpl.createInstances(Ser
              > vletStubImpl.java:619)
              > [java] at
              > weblogic.servlet.internal.ServletStubImpl.prepareServlet(Serv
              > letStubImpl.java:564)
              > [java] at
              > weblogic.servlet.internal.ServletStubImpl.getServlet(ServletS
              > tubImpl.java:344)
              > [java] at
              > weblogic.servlet.internal.ServletStubImpl.invokeServlet(Servl
              > etStubImpl.java:240)
              > [java] at
              > weblogic.servlet.internal.ServletStubImpl.invokeServlet(Servl
              > etStubImpl.java:200)
              > [java] at
              > weblogic.servlet.internal.WebAppServletContext.invokeServlet(
              > WebAppServletContext.java:2279)
              > [java] at
              > weblogic.servlet.internal.ServletRequestImpl.execute(ServletR
              > equestImpl.java:1923)
              > [java] at
              > weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
              >
              > [java] at
              weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              > [java] >
              >
              > Obviously the problem is that the servlet can't load the
              > org.apache.log4j.Category class. However, I have included the log4j.jar
              > file (which contains the org.apache.log4j.Category class) in the war under
              > WEB-INF/lib. Why isn't the classloader picking it up?
              >
              > Thanks for the help,
              > Tim
              >
              >
              

  • Form Authentication Servlet  and MD5

    Dear forum,
    I have the following servlet to authenticate a user via form. If you go to the root url you get the login html and the authentication works fine but if the user knows the url of a specific html just by typing the url gives access to the page without going through the authentication. The website is composed of htmls and servlets. How can I force the authentication for the htmls and the servlets. I included at the bottom how I added the Login servlet to the web.xml. I suspect that the servlet definition in the web.xml is the problem.
    Also I would like to use MD5 encryption, would someone suggest how this can be accomplished.
    Thanks.
    This is the code:
    import java.io.*;
    import java.util.*;
    import javax.servlet.http.*;
    import javax.servlet.*;
    import java.sql.*;
    import javax.sql.*;
    public class LoginServlet extends HttpServlet {
      public void doPost (
         HttpServletRequest     request,
         HttpServletResponse     response
        ) throws ServletException, IOException
      String item = request.getParameter("account");  
      doGet(request,response);
      public void doGet (
         HttpServletRequest     request,
         HttpServletResponse     response
        ) throws ServletException, IOException
       HttpSession session = request.getSession(true);
       PrintWriter out = response.getWriter();
         try {
              String driverName="sun.jdbc.odbc.JdbcOdbcDriver";
              String dbUrl="jdbc:odbc:Virtual_Library_DB";
              Class.forName(driverName);
              Connection db =DriverManager.getConnection(dbUrl,"","");
              if ((session.getAttribute("user") == null) || (!session.getAttribute("ip").equals(request.getRemoteAddr()))){
                   PreparedStatement pStmt = db.prepareStatement("SELECT * FROM Login WHERE Login.account =? AND Login.password=? ");
                   pStmt.setString(1, request.getParameter("account"));
                   pStmt.setString(2, request.getParameter("password"));
                            pStmt.setString(3, request.getParameter("level"));
                   ResultSet rs = pStmt.executeQuery();
                    System.out.println("hello");
                   if(!rs.next()){
                        System.out.println("Account is not valid.");
                        request.setAttribute("msg", "Account is not valid.");
                        RequestDispatcher rd = request.getRequestDispatcher("LoginInvalid.html");
                        rd.forward(request, response);
                   else do {
                        int id = rs.getInt(1);
                        String account = rs.getString(2);
                        session.setAttribute("user", new Integer(id));
                        session.setAttribute("account", account);
                        session.setAttribute("ip", request.getRemoteAddr());
                        System.out.println("User " + session.getAttribute("user") +" has logged on.");
                        request.setAttribute("msg", "User has logged on.");
                        RequestDispatcher rd = request.getRequestDispatcher("index.html");
                        rd.forward(request, response);
                   } while(rs.next());
                   rs.close();
              else {
                   System.out.println("User has already logged on.");
                        request.setAttribute("msg", "User has already logged on.");
                        RequestDispatcher rd = request.getRequestDispatcher("index.html");
                        rd.forward(request, response);
              db.close();
         catch(Exception exp){
              System.out.println("Exception: "+ exp);
       out.close();
    web.xml
    <servlet>
        <servlet-name>LoginServlet</servlet-name>
        <servlet-class>LoginServlet</servlet-class>
      </servlet>
    <servlet-mapping>
        <servlet-name>LoginServlet</servlet-name>
        <url-pattern>/LoginServlet</url-pattern>
      </servlet-mapping>

    Check the session in the servlets that are allowed only for logged-in users.
    public class ServletUtils
        public static boolean checkLogin(HttpServletRequest request, HttpServletResponse response)
            HttpSession session = request.getSession(false); // false = don't create a new session if not logged in
            if (session != null)
                return true;
            Logging.log("tried to access page without login, redirecting to login");
            ...redirect to login.html...
            return false;
        // At the start of your doGet()'s:
        if (!checkLogin(request, response))
            return;Do you really need static documents to be authenticated? dot.gif's and all? Someone can make a zip file of them anyway and post it to their own web site or Kazaa.
    If you have a couple of html pages you want authenticated, easiest is to write them as servlets (+ maybe JSP's) and do the login check there.
    Ok, let's say you have ...what, an "image database" (heh) that you want available to logged-in users only. Write a servlet that serves those pages. That servlet checks the session, and then copies the appropriate file to the user (remember to set content type; consider caching the files if hit rate is very high.) The servlet would be called like /images/show?id=gerbilsex/closeup.gif to fetch the named file. Put the files outside the web server's document directory so they are not accessible except through the servlet. Perform strict checks on the file name to disallow nastiness like id=../../../etc/passwd. A similar database solution is also possible. Another variant is to map a servlet to a "virtual directory name" and get the actual file name from the URL path -- similar to the ?id= solution, except the URLs don't have parameters.
    About md5: md5 isn't an encryption algorithm, it is a hash algorithm (aka "message digest" or "fingerprint"). It can't be decrypted. What do you really want to accomplish - encryption or hashing?

  • Questions about deploying compressed WAR

    I've been having issues when trying to deploy a compressed
    Flex application into my Weblogic Server. I read in the
    Installation Guide (
    http://www.adobe.com/support/documentation/en/flex/2/install.html)
    that you need to some "hacking" to make it work but i have a big
    question:
    The guide says:
    Locate the servlet definition for MessageBrokerServlet, and
    update the flex.write.path init-param element to specify an
    existing, writeable, directory path:
    <init-param>
    <param-name>flex.write.path</param-name>
    <param-value>C:/bea/flex</param-value>
    </init-param>
    I have no clue about this, i mean what is supposed to be in
    the path C:/bea/flex??? Can anyone explain what the
    "flex.write.path" means or referrers to?
    Diego

    I tried setting the write path to any folder like the example
    and i got this during the server startup:
    [Flex] [WARN] The watch-file,
    /WEB-INF/flex/services-config.xml, could not be resolved to a path
    and will be ignored.
    [Flex] [WARN] The watch-file, /WEB-INF/flex/proxy-config.xml,
    could not be resolved to a path and will be ignored.
    [Flex] [WARN] The watch-file,
    /WEB-INF/flex/remoting-config.xml, could not be resolved to a path
    and will be ignored.
    [Flex] [WARN] The watch-file,
    /WEB-INF/flex/messaging-config.xml, could not be resolved to a path
    and will be ignored.
    [Flex] [WARN] The watch-file,
    /WEB-INF/flex/data-management-config.xml, could not be resolved to
    a path and will be ignored.
    [Flex] [WARN] The touch-file, /WEB-INF/web.xml, could not be
    resolved to a path and will be ignored.
    And then when i tried to run the sample application CRM
    (which is included in the samples war when you install flex 2) i
    get this error:
    java.sql.SQLException: The url cannot be null
    so what's wrong?

  • Servlet configuration in Weblogic 5.1.. web.xml vs weblogic.properties..

    Can someone please tell me how the <servlet> entry differs from
              weblogic.httpd.register.snoop=examples.servlets.SnoopServlet
              in weblogic properties?
              Do these perform identical functions?
              

    Yes this is the source of my confusiong. It seems to be that WL can be told
              about servlets
              two ways. Firstly through the web.xml file and also via weblogic.properties.
              I don't understand
              why the second one exists.
              "Cameron Purdy" <[email protected]> wrote in message
              news:[email protected]...
              > I only work with WAR files, so I cannot speak to non-WARd servlets with
              any
              > confidence. I know that WL could use web.xml for non-WARd servlets in
              order
              > to obtain the other information associated with the servlet:
              >
              > <!ELEMENT servlet (icon?, servlet-name, display-name?, description?,
              > (servlet-class|jsp-file), init-param*, load-on-startup?,
              > security-role-ref*)>
              >
              > --
              >
              > Cameron Purdy
              > http://www.tangosol.com
              >
              >
              > "Robert Nicholson" <[email protected]> wrote in message
              > news:[email protected]...
              > > If what you say is true then why is there the need to also tell WL about
              > the
              > > servlets themselves?
              > >
              > > Presumably this is for when the servlets exist outside of a WAR then?
              > >
              > > "Cameron Purdy" <[email protected]> wrote in message
              > > news:[email protected]...
              > > > The weblogic.properties tells WL to load a WAR or specific servlet.
              The
              > > > <servlet> entry (I assume you refer to
              > > > http://java.sun.com/j2ee/dtds/web-app_2_2.dtd) defines the presence of
              a
              > > > servlet within a WAR (a deployment unit):
              > > >
              > > > >
              > > > The servlet element contains the declarative data of a
              > > > servlet. If a jsp-file is specified and the load-on-startup element is
              > > > present, then the JSP should be precompiled and loaded.
              > > > [end-quote]
              > > >
              > > > In the case of a WAR deployment, you have to tell WL that the WAR
              > exists,
              > > > then it will look in the WAR and figure out what servlets are there
              from
              > > the
              > > > <servlet> tags in your web.xml. You set up a WAR in the
              > > weblogic.properties
              > > > as such:
              > > >
              > > > weblogic.httpd.webApp.<http-path>=<os-path>
              > > >
              > > > For example:
              > > > weblogic.httpd.webApp.website=c:/weblogic/website.war
              > > >
              > > > --
              > > >
              > > > Cameron Purdy
              > > > http://www.tangosol.com
              > > >
              > > >
              > > > "Robert Nicholson" <[email protected]> wrote in message
              > > > news:[email protected]...
              > > > > Can someone please tell me how the <servlet> entry differs from
              > > > >
              > > > > weblogic.httpd.register.snoop=examples.servlets.SnoopServlet
              > > > >
              > > > > in weblogic properties?
              > > > >
              > > > > Do these perform identical functions?
              > > > >
              > > > >
              > > >
              > > >
              > >
              > >
              >
              >
              

Maybe you are looking for

  • No network on reboot - Connection Details for Adapter Blank/Empty

    I've been dealing with this issue for over a week now, and while extensive Internet searches have found similar situations, none exactly matched my situation, and none of the suggested fixes had any positive effects. Here's my exact situation: 1.) Sy

  • Application Launch/Quit Oddities

    I'm having an odd, re-occurring problem with Mac OS X on my MacBook Pro. Every once in a while (maybe once every month), it'll get into this weird state in which no applications will launch (they just bounce for a while, then stop; but never actually

  • Why is the download "Not applicable" for my online purchase of Adobe Captivate 8 Student and Teacher Edition for Mac?

    I purchased "Adobe Captivate 8 Student and Teacher Edition" for Mac on 7/31/14 and it is now 12/17/14 (only 5 months later) but it is showing as "Not applicable" when I go to download (maybe re-download) the program. I understood that I would be able

  • Print back to tape FCP & Z1...how?

    I need to print back to tape from my edited footage using Final Cut Pro 5.0.4 and my Sony Z1...cant work out how to do it can anyone tell me there workflow to do this? Should the camera be in VCR mode??? and how do you record? Thanks...

  • Webauction and jbuilder6

    Has anyone tried (successfully) to import the learnweblogic webauction source code into jbuilder6? I don't think it should be difficult but I don't seem to be able to get it right. I am using weblogic6.1.1 and the new webauction source code. My direc