I want to reference a local file for web-app_2_3.dtd in my web.xml file, but can't find a way to use a relative path. Since this file is used on multiple machines the relative path is important.
I put the dtd file I want to use in the WEB-INF directory (with web.xml) and have tried to reference it with things like "web-app_2_3.dtd" and "war/WEB-INF/web-app_2_3.dtd" and every permutation and depth of things like that I can think of.
Is there a variable I can use to reference the war directory, or something?
I have found that in the web.xml paths are relative to the webroot, so if its in the WEB-INF, the relative path would be something like /WEB-INF/web-app_2_3.dtd with no need for the war/ in front of it
Related
I have the installer project with all the resources it uses added in my Gradle project (in path project_folder_path/install). But for some sql operations (which will run during the installation), I need to add some files located in other modules of my gradle project (for example in path project_folder_path/sql) to its distribution tree. So, is there any way to somehow get the file path of the .install4j file( or is there any variable existing) that I can manipulate later for finding the files required?
Relative files are resolve relatively to the .install4j project file. So you don't need a variable for that location, just add relative paths to the distribution tree.
Hi I have an eclipse application which has MANIFEST.MF in which I am trying to set classpath like
Class-Path:
./lib/*
where . is current directory and lib is the location where I have all my jars kept that are needed by the application.
But it doesn't pick the jars.
But if I specify ./lib/library1.jar, it does pick the library1.jar
I also tried .lib/library1.jar;./lib/library2.jar; etc. It doesn't work this way too.
How do I specify multiple jars in a classpath in MANIFEST.MF
I found the answer , the MANIFEST.MF is very picky in white spaces and lines
The entry should be like this -( may be useful for someone ):
Class-Path: ./lib/library1.jar ./lib/library2.jar
no extra lines, only white spaces in between
In jar manifest files, you don't use ';' to specify multiple files, you simply use whitespace. In addition you also don't want to use . to specify the current directory. The file paths should be specified to run from the current directory by not using any non-whitespace syntax at the start of the path.
Try modifying your Class-path entry to be
Class-Path: lib/library1.jar lib/library2.jar
I am having big issues deploying my web app to Tomcat 5.5
My server side code must access files found under a directory parallel to my WEB-INF folder.
When on developement mode, a simple relative path (mydirectory/myfile) works prefectly.
When deployed, the sayed path does not work anymore I dont know why.
Is there a way to make it work without using any absolute path?
Here is my War directory
War
WEB-INF
Mydirectory
Myfile
Mywebbapp.html
Obtain your root folder relative to contextRoot by calling javax.servlet.ServletContext.getRealPath("/"). Then proceed with this path...
Using relative path will work, but you need to be aware of what the containers considers to be the root directory and base your relative path from there. If you specify your directory structure better, I can help you with the path - Basically try using the .. operator to move from the container root to the needed directory
I'm working on an embedded Jetty + Wicket app and I'm using buildr. Right now, Buildr isn't including the HTML files (which are in the main source folder, alongside my *.java files) in the jar. How can I tell buildr to include them in the compilation/package step?
Thanks for the suggestions, I think I'm close. Maybe the question I should be asking is how to get the .HTML files into the right place in the target/classes/ subdirectory? I've confirmed that if I can get the .html files in the target/classes folder, package(:jar) archives them. I'm going to start looking at that.
Thanks for the suggestions, I think I'm close. Maybe the question I should be asking is how to get the .HTML files into the right place in the target/classes/ subdirectory? I've confirmed that if I can get the .html files in the target/classes folder, package(:jar) archives them. I'm going to start looking at that.
It sounds like what you want to do, then, is treat the java source paths as resource paths. Here's how I do that in a project I converted to buildr after it was already pretty large:
# Uses before_define to default all projects to including their resources from
# src/main/java instead of src/main/resources (& similar for test) if
# those source directories exist
module InlineResources
include Buildr::Extension
before_define do |p|
[
[p.resources, p._("src/main/java")],
[p.test.resources, p._("src/test/java")]
].each do |res, path|
if File.exist?(path)
res.from(path).exclude("**/*.java")
end
end
end
end
class Buildr::Project
include InlineResources
end
This will put the *.html files in target/resources and from there they will be added to the package.
Buildr take contents in src/main/webapp folder for war file contents. You need to keep the html files inside that.
It depends on where in the WAR they need to go, but generally you can do something like this:
package(:war).include(_(:source, :main, :java, "**/*.html"))
The :war package is a specialization of the :jar package, which is a specialization of the :zip package, so you can use any of the documented methods for :jar or :zip on a :war, too.
When the jars are packaged within EAR/lib, all works fine, but I cannot use this
approach and need to refer to them from the filesystem (maybe using absolute/relative paths)
Also adding the jars to the system classpath (using conf/jboss-service.xml) is not an option.
I have already defined a scoped classloading using loader-repository for the app in jboss-app.xml
Is there a way the scoped classloader for the app can access libraries from outside the EAR structure?
Technically, yes, at least with JBoss 4.2, and with luck it'll work in 5 as well.
This takes advantage of the fact that when JBoss's EARDeployer reads the path of each library in the application.xml file, it resolves the path relative to the base directory of the exploded EAR. If you put in relative paths with the appropriate number of ../ entries, then the path will resolve to anywhere on the filesystem you like, as long as it's navigable as a path relative to where the EAR is deployed (i.e. on windows, it has to be on the same drive).
Be aware, though, this is not standard behaviour, and isn't even guaranteed to work between different versions of JBoss.