Dudley Dawson

Ranch Hand
+ Follow
since Dec 14, 2004
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Dudley Dawson

Tim Holloway wrote:Actually, your definition of "one war" and mine don't seem to be the same. I, too, build only one war, but it's the same war for development, test, and production. Bit-for-bit, byte-for-byte. Build one WAR file and deploy it to whichever server. There's no per-server properties files inside the WAR. And no danger of accidentally deploying a test WAR on the production server, since the test WAR is the production WAR. The attributes that make a WAR a "test" war are all injected from external sources.

I think you actually already know about Maven profiles, but you're mistaken about one thing. You most definitely can specify more than one profile on a build, and that can be useful when you have to do things like say, build a WebSphere WAR for iSeries when you also provide a WebLogic WAR for Linux. Mix and match OS's and server environments using combinations of profiles.

Incidentally, I find this annoying, but profiles do not override mainstream resources. If you want a custom web.xml, for example, you can't provide a default web.xml in the src/main/webapp or it will take precedence over a profile-specific src/tomcat/webapp version of the same file.

Hi Tim
Thanks for your reply.
Sorry if my original post wasn't clear. We actually do have the same deployment scenario - we only compile 1 single binary war, and all environment-specific configuration is kept outside, and referenced or injected at runtime.

I will research the use of multiple profiles more, but it seems contradictory at first. I could see how you can override/cascade properties from multiple profiles into one set of valid properties, but how would the build know to create a different asset for each, rather than just one that has a combination of the overridden properties?

I have also begun to explore using "executions" to bind the resource:resource goal multiple times to the process-resources phase.

This is almost working except for 2 things:
1. the build still executes the default "default-resources" execution, which copies all of the resources to target/classes. (minor, i'm sure there is a way to turn this off)
2. None of the properties in dev.properties are being resolved in the resulting resource after it's copied. Seems like this may be a bug in maven: http://jira.codehaus.org/browse/MRESOURCES-77
13 years ago
I'm new to maven. Trying to ports some existing ant builds to maven, as well as establish some new standards for our build process.

It is our policy to only build 1 deployable war. all environment-specific configurations are kept separate, and we build them all together at once. so under our current Ant process, we have a properties file for each environment, loop over them, and create a set of config files with a replacefilterfile.
So, in our source, we have dev.properties, test.properties, and prod.properties. In the resulting build, we have:

and so on...

it seems like maven can almost do this with its resources plugin, but by default, everything in the resources dir gets copied to the WAR classpath (i'm guessing this is configurable)
but more importantly: it seems you can only build 1 profile at a time, which is specified at the time maven is executed. This is going to cause problems for our deployment process.

Is there a way to do what i've described with maven?
13 years ago
Yeah. I know. Sounds messy.

It's hard to explain. Basically, I'll be piecing together bits of content and model data from various sources in a servlet (most likely a Spring controller, if that makes any difference) into an xhtml document. That resulting document may contain JSP code that needs to be executed after it's cobbled together.
I checked out the implementation of apache's jasper servlet (org.apache.jasper.servlet.JspServlet). Looks like the streaming, compilation, and processing of the jsp page is left up to each vendor, done in the service() method. So - there's doesn't seem way to uniformly pipe in jsp code and have it compile & execute.

I *may* be able to whittle the requirement down to not support scriptlets, and only process XML jsp tags and other JSTL tags. Is there a way i could parse the document, and kick off each tag as i bit it? But i guess there would be all kind of contexts that I would not have available.
14 years ago
I would like to generate JSP source code on-the-fly. Is there any way I can pass this source dynamically to the jsp servlet using the spec? Rather than forwarding/including a request through requestdispatcher that loads the jsp source from the filesystem.

Is there any way to do this?

14 years ago

Campbell Ritchie wrote:Please tell us some more details, eg your classpath, how you are setting it, and the contents of your manifest file.

well, i'm not setting any specific classpath outside of the manifest. here it is:

I'm using the <manifest> element of ant's <jar> task to create it. 2 strange things i'm noticing are
1. the hard line breaks. Why would it do that? I'm specifying them all in one attribute of the <attibute> node:
2. the non-system friendly paths (slashes wrong way, etc)
I would imagine both of these would cause classpath problems, but, regardless; i would think it would be tbe IMPORTED classes that can't be found. Why would this have any effect on my main class?
14 years ago
I'm trying to package an application in a jar file which uses some external libs.
When I specify a Class-Path in the manifest, i get a NoClassDefFoundError exception for my Main-Class. When I remove the Class-Path header, of course, I get a NoClassDefFoundError exception for one of the classes I've imported in that main class.

It seems as though if I specify a Class-Path, ONLY the jars listed there are on the classpath - no longer the packages in the jar itself.
What am i doing wrong? (I tried adding "." to the Class-Path - still doesn't work)

FYI - my package is at the root of the jar:
14 years ago

Christophe Verré wrote:Which handler are you using for this logger ? If you are using the ConsoleHandler, its default level is INFO. So even if you change the level of your root logger to FINEST, messages below INFO won't be printed to the console. You have to use the following in your logging.properties :

Then, if you change the level of your root logger to FINEST, the "child" logger should also have the same level.

yup - that was it. wonderful. thank you very much!
14 years ago
I'm trying to dynamically set the level of the root logger so that all other loggers will use the new level. According to the documentation (http://java.sun.com/j2se/1.4.2/docs/guide/util/logging/overview.html#1.3):

Loggers keep track of their parent loggers in the logging namespace. A logger's parent is its nearest extant ancestor in the logging namespace. The root Logger (named "") has no parent. Anonymous loggers are all given the root logger as their parent. Loggers may inherit various attributes from their parents in the logger namespace. In particular, a logger may inherit:

* Logging level. If a Logger's level is set to be null then the Logger will use an effective Level that will be obtained by walking up the parent tree and using the first non-null Level.
* Handlers. By default a Logger will log any output messages to its parent's handlers, and so on recursively up the tree.
* Resource bundle names. If a logger has a null resource bundle name, then it will inherit any resource bundle name defined for its parent, and so on recursively up the tree

What I'm doing:

and the output:

I don't know why my logger is not inheriting level FINEST from the root logger

14 years ago
This is something that I've struggled with for a while, and never really knew the best practice is.
If you are using ant to build a web app with the WAR task, how do you structure your directory layout in version control?
the WAR task prefers that there is no existing WEB-INF dir. It will pull in all the assets you specify (DD, web libs) and create the entire nested thing for you.
This works fine in creating a war, but makes for a difficult development environment setup. Since there exists no deployable directory on the filesystem, a new build is required with every single change, even to static html/js/images. This is very frustrating, esp. to the front-end folks who are afraid of build tools like ant ;)

What does everyone else do?

I have been using a workaround - I create a target named "explode" which will manually create a WEB-INF dir, but this seems like a bit of a kludge. It also introduces the possibility of a file mistakenly being added to version control.
15 years ago
I think this can be solved with a servlet filter.

i'll kick the tires on this and reply...
15 years ago

Originally posted by Darrin Holst:
I'm trying to solve the exact same problem, pretty frustrating how limiting the servlet mapping is. Anyway, I tried


which stops sending it to my dispatcher, but I'm still getting a 404 on any image I request.

Well, you are getting the 404 becasue you have no servlet named "default" in your DD. I guess what we're both looking for is a way to invoke the default handler, either programmatically or declaratively.
[ September 30, 2008: Message edited by: Dudley Dawson ]
15 years ago

Originally posted by William Brogden:

But thats what the default request handler does - one way or another it has to be done.

Essentially handling all /* means you are replacing the default handler - if this was my problem, and I was working with Tomcat, I would remove the default handler mapping and just forward all requests that did not require custom handling to it.


If I understanding you correctly, I think that's what I want to do, I just don't know how. BTW - I am using tomcat

How can i say: /images/*, /css/*, /flash/*, etc, use the default handler, while everything else use my front controller?
15 years ago

Originally posted by Bear Bibeault:
Mapping /* is going to cause a lot of headaches, including the static resource issue. Why is it a requirement? What's wrong with having a reasonable servlet path? (E.g. /something/*).

believe me, i said the same thing - marketing folks, ya know?
15 years ago
I'm putting together a little mini-framework for a project I'm doing. I'm using a front controller servlet to process all requests (<url-pattern>/*</url-pattern> ) . Is there an easy way to serve static assets (images, css, some html). Basically, I just want to be able to identify the request as a static asset, and say "just do what you normally would do". I want to avoid having to actually open the file on the filesystem and stream it to the response. If i use request dispatcher, it will endlessly loop right back into the front controller, correct?

Also- it is a requirement that the browser-visible urls for this application are at the top level folder under the domain and have no file extension. ie- www.myapp.com/page1 so I can't do something like: <url-pattern>/app/*</url-pattern> or <url-pattern>*.do</url-pattern>


[ September 29, 2008: Message edited by: Dudley Dawson ]
[ September 29, 2008: Message edited by: Dudley Dawson ]
15 years ago

Originally posted by Tim Holloway:
Did you define public double getMaximum() and getMinimum methods on your backing bean? What do they return when called?

Thanks Tim.
yes, I've defined them in the bean. If I put the following code on the page:
<h:outputText value="#{beanlist}"/>
I've defined bean.toString() to call getMaximum() and getMinimum(), and I can see the that values are not null by accessing them in this fashion. Is there possible some problem with the rendering order? ie- validators are set before the bean values are populated, etc?
[ September 05, 2007: Message edited by: Dudley Dawson ]
16 years ago