Accessing resources from a WAR file.

Do you guys know how a JSP is supposed to reference resources inside the WAR file? I have some gif files in an images folder at the top root of the WAR directory. I'm tying to access them like n the JSP with -
SRC="./images/update_button.gif"
And it is not working. Any suggestions?
Thanks in advance,
dosteov

Usually "./" at the beginning of a path is unnecessary, since "." means "current directory". Did you mean "../images/update_button.gif" instead?

Similar Messages

  • Problems while creating a project from a war file...

    Hi there, I created a new project in jDev 10.1.3 from a war file that contains a web site that originally ran on TomCat. The problem is that my web.xml file does not contain any information about the servlets that I have in the war file. So when I try running a servlet, I always get an error.
    Is there a way to bypass the need to declare every single servlet I have in the web.xml file? If not, are there tools that exist that I could use to do this automatically?
    Thanks

    Hi,
       You can try the following:
    1. Give the fully qualified domain name of the DTR server host in NWDS Preferences->Development Configuration.
    2. Check if your WAS and JDI are on a higher SP level. If yes then use the corresponding NWDS.
    Regards,
    Satyajit.

  • Referencing utility classes from a war file

    How do you reference a utility class from a war file? I tried adding the class to the deployment plan descriptor, however I still get a ClassNotFoundException.
    Thanks,
    Will

    To use the utility classes from a war you have to place them under the web-inf/classes directory.
    webApplication(WAR directory)--->WEB-INF--> classes (put your utility classes in this directory)

  • WLS 7.0 - util jars being accessed from the war file

    Some of classes in the warfile (servlets) need access to some of the util jars in my ear file. I really don't want to put them in the war file/WEB-INF/lib directory and in the ear file. Is there any way to do this without putting them in the classpath.
    Any info would be appreciated.
    Thanks,
    Ian

    Ian,
    Examine the following link on packaging utility classes and the Weblogic classloader
    architecture
    This link should provide (hopefully :-) ) the answer to your question
    http://e-docs.bea.com/wls/docs70/programming/classloading.html
    Chuck Nelson
    DRE
    BEA Technical Support

  • Access resource from other application using JAAS

    i use JAAS for autenticate and autorizate in my web application, but i need access a resource from the other application , but this application don�t use JAAS.
    How can i acces this resource from other application?
    i know need send the parameters JSESSIONID, but , always redirecto the login page.
    thank you for your help

    your signon url is consists of the following url http://server.domain.com:port/site/signon.html
    Can you ping server.domain.com from your client?
    If you can ping it, then make sure your port is added as a rule in the firewall of the server.
    Also make sure that the proxy setting of the client have an exception to server.domain.com.
    If you cannot ping it, make sure the server and the client are conneted to the same network and make sure the hosts file on the client reflects the ipaddress and the hostname of the server.
    Hakan

  • Can't Open File Explorer -- How can I reset the Quick Access Toolbar from outside of File Explorer?

    First of all, this is not a virus. This is my a bug within windows explorer itself.
    So, I added the properties button to the QAT, and it displayed it as an expandable menu, like this: ";" but with small arrows like this: ">". didn't want this, I wanted to click on it and immediately display the properties of the file
    to me. So, I hovered over it, right-clicked on "Properties" in this menu and added it to the QAT. Of course, this crashes File Explorer. Now whenever I try and open it, it crashes, so I have to assume that the corrupted button has been saved.
    So, my question is: How do I reset the QAT from OUTSIDE of file explorer? Regedit magic? Any ideas?
    Thanks for stopping by,
    Trolleyman.
    Edit: Just so you know, I can navigate through my systems files using the 7-zip file manager. Phew.

    Thanks from me  too, Niki. This first happened with Windows 8.0 File Manager a week ago,, and despite much research I couldn't  discover the cause so eventually I resorted to restoring  the system drive from backup (luckily I make daily backups, 
    so didn't lose   much  work).
    Without  knowing the cause  a  few days later I again tried to alter  the Quick Access  Toolbar  and the problem reappeared.  Should  I again resort to restoring the entire system drive, the thought horrified me. But
    luckily while doing a bit more research prior to resorting to the same drastic recovery, I cane  across this post  of yours and it worked!
    It doesn't  seem  to be  happening with Office 2007's   or  Wordpad's  Quick Access Toolbar,  so presumably it's a File Explorer bug  (a.k.a. Windows Explorer in Windows 7, of course). Have Microsoft recorded this as
    a  bug -- if not,  why not  -- and when  are they coming up with a fix?

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

  • EJB(EAR file) lookup from separate WAR file

    Hi
    I have 2 applications (EAR and WAR) deployed in an OC4J instance using Oracle 10g. All my EJB components are in my EAR file and all my front-end/servlet component are in the WAR file. My lookup in the servlet fails, like:
    05/01/21 13:47:05 javax.naming.NameNotFoundException: SessionEJB not found
    05/01/21 13:47:05 at com.evermind.server.rmi.RMIContext.lookup(RMIContext.java:149)
    05/01/21 13:47:05 at com.evermind.server.ApplicationContext.lookup(ApplicationContext.java:248)
    05/01/21 13:47:05 at com.evermind.server.ApplicationContext.lookup(ApplicationContext.java:119)
    05/01/21 13:47:05 at javax.naming.InitialContext.lookup(InitialContext.java:347)
    05/01/21 13:47:05 at efdw.eap.servlet.SessionEJBAction.execute(SessionEJBAction.java:48)
    05/01/21 13:47:05 at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
    05/01/21 13:47:05 at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
    05/01/21 13:47:05 at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
    05/01/21 13:47:05 at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
    05/01/21 13:47:05 at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    05/01/21 13:47:05 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    05/01/21 13:47:05 at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:765)
    05/01/21 13:47:05 at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:317)
    05/01/21 13:47:05 at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
    05/01/21 13:47:05 at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:208)
    05/01/21 13:47:05 at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:125)
    05/01/21 13:47:05 at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
    05/01/21 13:47:05 at java.lang.Thread.run(Thread.java:534)
    EJB reference in web.xml looks like:
    <ejb-ref>
    <ejb-ref-name>SessionEJB</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <home>com.app.bean.SessionEJBHome</home>
    <remote>com.app.bean.SessionEJB</remote>
    </ejb-ref>
    I've added the "parent" attribute in server.xml, something like:
    <application name="myapp" path="../applications/myapp.ear" auto-start="true" />
    <application name="myweb" path="../applications/myweb.ear" auto-start="true" parent="myapp" />
    but the sever.xml file gets reset and there is no parent attribute in the file
    lookup in my servlet:
    Context ctx = new InitialContext();
    Object objref = ctx.lookup("SessionEJB");
    sessionEJBHome = (SessionEJBHome)PortableRemoteObject.narrow(objref, SessionEJBHome.class);
    beanRemote = sessionEJBHome.create();
    I also tried using the jndi.properties file and by specifying context attributes (PROVIDER_URL,INITIAL_CONTEXT_FACTORY,..) nothing worked.
    Is there a way I can configure the jndi tree like in weblogic? How do I need to configure the lookup?

    Hi Naga,
    You have to lookup the ejb as follows:
    Object objref = ctx.lookup("java:comp/env/ejb/SessionEJB");
    location tag in orion-ejb-jar.xml for the EJB determines where the JNDI-name to which this bean will be bound documented in EJB Guide at http://download-west.oracle.com/docs/cd/B14099_01/web.1012/b15505/dtdxml001.htm#sthref1130
    <ejb-ref-mapping ... > in orion-web.xml :
    This element creates a mapping between an EJB reference, defined in an <ejb-ref> element, and a JNDI location when deploying.
    The <ejb-ref> element can appear within the <web-app> element of orion-web.xml or web.xml and is used to declare a reference to an EJB.
    -Debu

  • Static resources outside a WAR file

    Hi, we have packeged our application/components as a WAR file, but due to the nature of our application we continuously get new images (related to news articles). We want to keep these images outside the WAR file. Does anyone have any suggestions to how we can do that?Eirik
              

    Usually "./" at the beginning of a path is unnecessary, since "." means "current directory". Did you mean "../images/update_button.gif" instead?

  • How to retrieve resources from a jar file ?

    Hello,
    Currently, I have application classes in a jar file, and all other resources (pictures, properties, and so forth..) in my windows folder. I do not have any problem for using them such way. For example to set an icon to a JFrame I have coded :
    f.setIconImage("mypicture.jpg");To make installation easier, I'd like to put my picture into the jar file with the classes. Is it possible ? if so, how should I modify my code to make things work ? Should I specify a special path ?
    Thanks for all
    Gege

    Thanks a lot, I'm going to try both ways.What both ways? Both replies are about the same thing -- using the classpath to find resources.
    The question now is what about if there is the same file
    name in the jar file and also in the directory ? Is
    there a search hierarchy ?It will find the first one it encounters in the classpath. You shouldn't have 2 resources with the same name in the classpath -- that's just like having two classes with the same package and class name.

  • How To Insert Data into a Access Database from a PDF File

    Hi All,
    Could anyone help me to insert PDF form data to an MS Access database.I am new to this and I would appreciate if anyone can help me at the earliest.
    Thanks,
    Deepti

    You can submit your PDF to a server-side script (ASP/PHP), and store the new record in a MS Access database.
    For more information on how to store your PDF submission in a database, please visit:
    http://www.fdftoolkit.net

  • Trying to access methods from a .class file by creating instance of class

    Hey all,
    I'm hoping you can help. I've been given a file "Input.class" with methods such as readInt(), readString(), etc. I have tried creating instances of this class to make use of it, but I receive the error "cannot find symbol : class Input".
    If you could help at all, I would greatly appreciate it.
    Here's my code. The first is the base program, the second is the driver.
    import java.util.*;
    public class CarObject
         private String makeType = "";
         private String modelType = "";
         private int yearOfRelease = 0;
         private double numOfMiles = 0.0;
         public void setFilmTitle(String make)
              makeType = make;
         public void setMediaType(String model)
              modelType = model;
         public void setYearOfRelease(int year)
              yearOfRelease = year;
         public void setNumOfMiles(double miles)
              numOfMiles = miles;
         public String getMakeType()
              return makeType;
         public String getModelType()
              return modelType;
         public int getYearOfRelease()
              return yearOfRelease;
         public double getNumOfMiles()
              return numOfMiles;
    The program is used by a rental car company and the object takes on desired attributes.
    import java.util.*;
    public class TestCarObject
         static Scanner keyboard = new Scanner(System.in);
         public static void main(String[] args)
              System.out.println("Please answer the following questions regarding your rental car order.");
              Input carinput = new Input();
              String makeType = carinput.readString("Enter your desired make of car: ");          
              String modelType = carinput.readString("Enter your desired model of car: ");
              int yearOfRelease = carinput.readInt("Enter the oldest acceptable year of release to rent: ");
              double numOfMiles = carinput.readDouble("Enter the highest acceptable number of miles: ");
              System.out.println("Make: " + makeType);
              System.out.println("Model: " + makeType);
              System.out.println("Year: " + makeType);
              System.out.println("Mileage: " + makeType);
    }

    No, I don't know the package name....Is there a way
    to import the Input.class by itself without importing
    the entire packge?
    I tried extending the driver program too...It didn't
    work either...
    Message was edited by:
    BoxMan56How do you know you have a class called Input.class ?
    You got a jar file which contains it ? or just a simple .class file ?
    You have to set the classpath in either case.
    But for the former, you should also need to explicitly telling which package containing the class file you looking for (i.e. Input.class)
    e.g. java.util.Vector which is a class called Vector inside java.util package.
    You don't have to import the whole package, but you should tell which package this class belongs to.

  • Help.jsp web app war file (how to exclude resources)

    Hi, I am making a jsp/JSF application and now wanted to deploy it on a glassfish server. this is the first time i am deploying so am still learning it as i go.
    I wanted to clear out something before i go ahead.
    My application has tons of resuorce files (mainly huge Picture and videos) which are roughly the size of 1-2 GB. I do not want to add them to my WAR file. is it possible to exclude the resources from the war file?
    How difficult would it be for me to to then link the resources folder to the deployed application?
    I am running against time. i need to clear the above out to make a decision.

    thyscorpion wrote:
    My application has tons of resuorce files (mainly huge Picture and videos) which are roughly the size of 1-2 GB. I do not want to add them to my WAR file. is it possible to exclude the resources from the war file?Yes.
    How difficult would it be for me to to then link the resources folder to the deployed application?Create a servlet which access them by aforeknown file system path, reads the stream from the file and writes it to the response.
    You may find this servlet example useful: [http://balusc.blogspot.com/2007/04/imageservlet.html] (specific for images).

  • Urgent! War File Issue

    Hi! people,
    Can anybody please guide me? I want to know if we can read the contents of a
    folder in a WAR file.
    Here is the scenario:
    I have a folder by the name: myFolder in the web-app directory root.
    (The folder name/location are fixed).
    This folder has an arbitrary number of files.(XML files). (The names are
    also arbitrary).
    I have to parse all of these files in the init() of a servlet.
    What I have already tried:
    String str = getServletContext().getRealPath("") ;
    This gets me the path to the root folder of the Web Application, and I
    read all the files in this folder.
    This only works from a web-app deployed from a directory, not from a WAR
    file.
    For a WAR file web-app, getServletContext().getRealPath("") returns
    null.
    Please help as soon as possible.
    Thanks in advance.

    Thanks very much for your reply.
    The situation is that I need to read a bunch of XML/XSL files and pre-parse
    them for efficiency.
    There could be any number of these in the WAR file in a fixed name folder.
    The other thing that you brought up is reading the contents of the war file.
    How will I know the name/path in which my war file is deployed?
    If I cannot know that, how will I open it?
    Thanks again.
    "Cameron Purdy" <[email protected]> wrote in message
    news:[email protected]...
    I assume by your question that you will not know the names of the XMLfiles?
    For example, all of the XMLs in a typical WAR or JAR or EAR are knownbased
    on the spec and the vendor implementation. In the case of WL 5.1, youhave
    potentially hundreds of XML files, but their names are either specified by
    the standard or the names are referred from XML files whose names are
    specified by the standard.
    AFAIK If you do not know the name you are looking for, you have no choice
    but to open the WAR/JAR/EAR using a zip class (see java.util.jar.JarFile).
    Cameron Purdy
    http://www.tangosol.com
    "Ejb Developer" <[email protected]> wrote in message
    news:[email protected]...
    Thanks for replying.
    getResourceAsStream() lets you read a file - basically provides an
    InputStream.
    What I want to do is read all of the xml files in a folder inside the
    WAR
    file.
    There could be any number of files, with any name. Can you think of away?
    Thanks.....
    "Cameron Purdy" <[email protected]> wrote in message
    news:[email protected]...
    I'm not certain what you are asking, but it is possible to load
    resources
    from the WAR file. I believe that ServletContext.getResourceAsStreamdoes
    that, and I know that I have successfully used the resource loadingmethods
    from the class loader itself.
    Cameron Purdy
    http://www.tangosol.com
    "Ejb Developer" <[email protected]> wrote in message
    news:[email protected]...
    Hi! people,
    Can anybody please guide me? I want to know if we can read the
    contents
    of
    a
    folder in a WAR file.
    Here is the scenario:
    I have a folder by the name: myFolder in the web-app directory
    root.
    (The folder name/location are fixed).
    This folder has an arbitrary number of files.(XML files). (Thenames
    are
    also arbitrary).
    I have to parse all of these files in the init() of a servlet.
    What I have already tried:
    String str = getServletContext().getRealPath("") ;
    This gets me the path to the root folder of the Web Application,
    and
    I
    read all the files in this folder.
    This only works from a web-app deployed from a directory, not
    from
    a
    WAR
    file.
    For a WAR file web-app, getServletContext().getRealPath("")
    returns
    null.
    Please help as soon as possible.
    Thanks in advance.

  • Using web resources in a JAR/WAR file in another project

    Hi,
    I would like to make a core set of .jspx files available to other developers without them having to physically include each of the .jspx files into their JDeveloper projects manually.
    I've tried creating various WAR and JAR files, and then including those into my JDeveloper projects (Project Properties > Libraries > Add Jar/Directory) but the result is always the same:
    javax.faces.FacesException: Problem in renderResponse: /test.jspx Not Found in ExternalContext as a Resource
    In the simplest case, I've created a war file with only a single file in it:
    /test.jspx
    I've also tried a war with:
    /public_html/test.jspx
    Can anybody provide some pointers as to what it is I need to do here? Some things I've read suggest that I need to extend the classpath to include my test.war, but I can't find the appropriate setting for this in JDeveloper.
    I'm using the latest version of JDeveloper 10g, and for the purposes of testing I'm using the embedded OC4J.
    Thanks for any tips!
    Alistair.

    I haven't done this so far, but it should be possible.
    One thing you should have in mind is this:
    Every WAR is a separate Web Application and has its own context as well as context root.
    If you'd like to reuse pages from another WAR file you need to know its context root at the bare minimum to reference to it.
    --olaf                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Maybe you are looking for

  • Vendor Line Items

    Is there any std BAPI or FM to get Vendor Line Items? Is there any database Table which shows all  Vendor line items (open and cleared)? Note : table BSIK shows only open line items. Thanks in advance. Points will be rewarded.

  • How can I create events dynamic for a Group/List?

    Hey, atm I'm programming a little application where i want to add elements to my center-pane. Simpyfied I got: - Center Pane : here shall the elements appear on right click in bottom-pane. This pane shall be used as anything like a playground where y

  • Dumb Question: Where is Ultrabeat in Logic Express?

    Long time GarageBand user here, so I had Logic pre-installed on my iMac... I'm getting familiar with the interface, but I cannot locate Ultrabeat to save my life... Can someone please point me in the right direction??

  • Getting an error - with date prompt

    Hi, I really need a help to resolve this issue - I have created a date prompt As of date with presentation variable name CPG_CASH_DATE. I have use this variable in different number columns - Amount Due Original , Amount Applied , Amount Due Remaining

  • Cluster and Windows Service

    I have three machines running weblogic 6.0 in a cluster. One of the machine is an administration server. I wish to set Weblogic as a Windows service on each machine. The problem is managed servers can't start up until the administration server is ful