| Author |
Missing CharacterEncodingFilter, UrlRewriteFilter?
|
Mimi Tam
Ranch Hand
Joined: Mar 05, 2010
Posts: 121
|
|
Hi,
I am simply trying to get the Spring 3.0 sample App "mvc-basic" to run in Tomcat from Eclipse with Maven2.
At boot time, I got HTTP 404 with ClassNotFoundException on org.springframework.web.filter.CharacterEncodingFilter and org.tuckey.web.filters.urlrewrite.UrlRewriteFilter. I have these 2 classes on my Build Path, in my App, in Tomcat and no where else. Their versions are the same.
Any suggestions will be greatly appreciated.
THANK YOU
THA
|
 |
Christophe Verré
Marshal
Joined: Nov 24, 2005
Posts: 14361
|
|
|
Did you put the org.springframework.web-X.X.X.jar in the lib directory of your web application ? Please post the full path of where you put that jar file.
|
[SCBCD Wall of Fame] [My Blog]
All roads lead to JavaRanch
Help Japan. Make a donation.
|
 |
Mimi Tam
Ranch Hand
Joined: Mar 05, 2010
Posts: 121
|
|
My org.springframework.web.3.0.0.RELEASE jar file is under my maven dependencies lib, in my Java Build Path for the project and in Apache Tomcat's lib.
Here's is a picture of my maven directory viewed in Eclipse:
Looking forward to knowing what I did wrong. THANK YOU!
|
| Filename |
mavendir.png |
Download
|
| Description |
|
| Filesize |
33 Kbytes
|
| Downloaded: |
8 time(s) |
|
 |
Christophe Verré
Marshal
Joined: Nov 24, 2005
Posts: 14361
|
|
and in Apache Tomcat's lib.
Instead, put it under your web application's WEB-INF/lib.
|
 |
Mimi Tam
Ranch Hand
Joined: Mar 05, 2010
Posts: 121
|
|
Unfortunately, they are in the App lib. The picture above is from the Eclipse project dir. Those files are definitely in the App dir.
p.s. Sorry I was not clear enough when explaining the problem.
|
 |
Christophe Verré
Marshal
Joined: Nov 24, 2005
Posts: 14361
|
|
|
You are making a web application, aren't you ? Where is the root of your web application ? You must have a directory (maybe somewhere under Tomcat's webapps directory ?) where your web application lives, with a WEB-INF directory in it.
|
 |
Mimi Tam
Ranch Hand
Joined: Mar 05, 2010
Posts: 121
|
|
Hi,
Yes, I am making a web application.
I am having terrible trouble locating files at runtime. Using Maven2 seemed to have made it worse (all due to my own wrong doing, or course....but only if I knew and how I wish to know what I'd done wrong.... ).
I am now facing this problem - applicationContext-dataSource.xml is not finding my jdbc.properties file.
This is the exception I am getting:
Here's my web.xml showing where my webAppRootKey is:
This is my applicationContext.dataSource.xml file where "${jdbc.driverClassName} is not found:
But my jdbc.properties file is in "<webAppRoot: petclinic>src/main/resources" as specified in the classpath and within the Eclipse project. Here is where my "jdbc.properties" file is - <webAppRoot>/src/main/resoureces (please see picture below).
I tried manipulating the classpath with absolute and relative paths but nothing worked. I am really at a loss ....
Any help will be greatly appreciated.
Many Thanks
|
| Filename |
jdbcProperties.png |
Download
|
| Description |
|
| Filesize |
15 Kbytes
|
| Downloaded: |
5 time(s) |
|
 |
Christophe Verré
Marshal
Joined: Nov 24, 2005
Posts: 14361
|
|
|
When you run a web application, the root of the application is not in the classpath. You can make a "classes" directory under WEB-INF, and put your properties file in there.
|
 |
Mimi Tam
Ranch Hand
Joined: Mar 05, 2010
Posts: 121
|
|
Hi Christophe,e.
Thank you so much for the advice! My "jdbc.properties" error went away and I got another error. I searched for info and solution for it but so far came up with nothing. I don't mean to post every problem that I encountered on this forum but only the ones that I really could not find a clue. I think I need help on this one as well...
"...
Mar 18, 2010 8:04:30 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/48 config=null
Mar 18, 2010 8:04:30 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 5004 ms
Mar 18, 2010 8:06:24 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet default threw exception
java.lang.IndexOutOfBoundsException: No group 1
at java.util.regex.Matcher.group(Unknown Source)
at java.util.regex.Matcher.appendReplacement(Unknown Source)
at java.util.regex.Matcher.replaceAll(Unknown Source)
at org.tuckey.web.filters.urlrewrite.RuleBase.executeBase(RuleBase.java:191)
at org.tuckey.web.filters.urlrewrite.Rule.execute(Rule.java:85)
at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:144)
at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:338)
...
Here's my welcome.jsp
My include.jsp:
My header.jsp:
I am really hoping to get this petclinic sample running and not to sit on it for days....after all it is a sample program that I am using for my learning curve...
Your help is greatly appreciated.
Many Sincere Thanks...
|
 |
Christophe Verré
Marshal
Joined: Nov 24, 2005
Posts: 14361
|
|
Are you following a tutorial ? I may not be able to help on that one. It looks like there might be problem with tuckey's urlrewriting configuration. Do you have a urlrewrite.xml file somewhere ? If so, what does it look like ?
|
 |
Mimi Tam
Ranch Hand
Joined: Mar 05, 2010
Posts: 121
|
|
Hi Chmristophe,
I don't have an urlrewrite.xml file. I am following the tutorial in https://src.springframework.org/svn/spring-samples/petclinic/ but haven't been able to make it run. I tried this simpler one sample https://src.springframework.org/svn/spring-samples/mvc-basic/ and encountering the same problems.
My "jdbc.properties" file does not exist Exception came back after I restarted Eclipse
I keep getting this error at runtime again when trying to run the Spring 3.0 petclinic or the mvc-basic sample project from within Eclipse:
In my applicationContext-DataSource.xml:
I had tried my classpath to be:
- WEB-INF/jdbc.properties
- /WEB-INF/jdbc.properties
- WEB-INF/classes/jdbc.properties
- /WEB-INF/classes/jdbc.properties
- jdbc.properties
- /jdbc.properties
And, tried placing my jdbc.properties file under either WEB-INF or WEB-INF/classes, etc. Nothing worked. I got "file does not exist" everytime and in both sample projects.
Am I doing something atrociously wrong somewhere? How should my "classpath=" look like in the applicationContext.dataSource.xml file and where exactly should I put the properties file to have them found?
Many Thanks...
|
 |
Mimi Tam
Ranch Hand
Joined: Mar 05, 2010
Posts: 121
|
|
I do have urlrewrite.xml:
This gave me the error in the mvc-basic sample project:
SEVERE: Servlet.service() for servlet default threw exception
java.lang.IndexOutOfBoundsException: No group 1
Could it be somehow complaining about the "$" sign? If so, how shall I fix it?
For the "file does not exist" problem, it happened in the petclinic project.
Many Thanks
|
 |
 |
|
|
subject: Missing CharacterEncodingFilter, UrlRewriteFilter?
|
|
|