Cannot build war with Spring Beans File included
posted 13 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Hi all,
I'm creating my first web project, and having completed the coding using Java, Spring and Apache Commons , I'm trying to use Ant to build the project.
You can browse the project source tree here.
Simply put, the Spring Beans File (footballamangerroles.xml) resides within a package (com.mcparland.john.footballmanagerroles.config). There are config files one level down from there too ([dev|prod]/footballamangerroles_log4j.properties).
However when I build the project, using Ant, the config directory is completely missing! See the image below.
I would have expected a config dir with all the config files (and subdirectories) in there. I note also that the war itself does not include the config dir.
Here is my build file (also here);
Additionally, when I try to launch my web application, I see the following;
Please let me know if there is a way I can ensure the Spring Beans File is included in the War and the application can launch.
Thanks,
John
I'm creating my first web project, and having completed the coding using Java, Spring and Apache Commons , I'm trying to use Ant to build the project.
You can browse the project source tree here.
Simply put, the Spring Beans File (footballamangerroles.xml) resides within a package (com.mcparland.john.footballmanagerroles.config). There are config files one level down from there too ([dev|prod]/footballamangerroles_log4j.properties).
However when I build the project, using Ant, the config directory is completely missing! See the image below.
I would have expected a config dir with all the config files (and subdirectories) in there. I note also that the war itself does not include the config dir.
Here is my build file (also here);
Additionally, when I try to launch my web application, I see the following;
Please let me know if there is a way I can ensure the Spring Beans File is included in the War and the application can launch.
Thanks,
John
Passed: SCJP 6 (90%), SCJD 6
Other: Spring training, extensive Swing experience
posted 13 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Where are your config files located in your project? If they are in the same location as the .java source files, you will need to copy then over to the classes directory (the <javac> task doesn't copy properties file)
posted 13 years ago
Hi Peter.
The config files are within the packages. E.g.
main/packages is the main SOURCE root.
All packages start with name com.mcpaland.john.footballmanagerroles
Under the directory main/packages/com/mcparlan/john/footballmanagerroles there is the "config" directory, and many other directories. The config directory contains the Spring XML file, while other directories contain Java source code.
I understand what you say about copying the files over - but where exactly should this be? I've tried messing around with it myself, but while that allows the War to contain the Spring XML file, it does not let Tomcat launch it!
John
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Peter Johnson wrote:Where are your config files located in your project? If they are in the same location as the .java source files, you will need to copy then over to the classes directory (the <javac> task doesn't copy properties file)
Hi Peter.
The config files are within the packages. E.g.
main/packages is the main SOURCE root.
All packages start with name com.mcpaland.john.footballmanagerroles
Under the directory main/packages/com/mcparlan/john/footballmanagerroles there is the "config" directory, and many other directories. The config directory contains the Spring XML file, while other directories contain Java source code.
I understand what you say about copying the files over - but where exactly should this be? I've tried messing around with it myself, but while that allows the War to contain the Spring XML file, it does not let Tomcat launch it!
John
Passed: SCJP 6 (90%), SCJD 6
Other: Spring training, extensive Swing experience
posted 13 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
I finally figured this out. Peter was right that I needed a copy. I put this in.
As part of the the copy task and it worked! That said, I did have to simplify the structure, to do away with different mode-controlled directories for the properties files. I'll look to add this back in later.
After this I looked at why the application would not launch. As it turned out, when I looked at the Tomcat logs, I found that because I had already deployed an application with the same name Tomcat wouldn't allow it. The lesson is to clean-up your applications...
More checking of the logs led to uncovering problems with file locations etc but in the end it now works!
Thanks!
As part of the the copy task and it worked! That said, I did have to simplify the structure, to do away with different mode-controlled directories for the properties files. I'll look to add this back in later.
After this I looked at why the application would not launch. As it turned out, when I looked at the Tomcat logs, I found that because I had already deployed an application with the same name Tomcat wouldn't allow it. The lesson is to clean-up your applications...
More checking of the logs led to uncovering problems with file locations etc but in the end it now works!
Thanks!
Passed: SCJP 6 (90%), SCJD 6
Other: Spring training, extensive Swing experience
| If you settle for what they are giving you, you deserve what you get. Fight for this tiny ad! Paul Wheaton's 16th Kickstarter: Gardening playing cards for gardeners and homesteaders https://coderanch.com/t/889615/Paul-Wheaton-Kickstarter-Gardening-playing |








