SSH项目中的一个非常规的404错误!

wolf_in_darkness 2008-04-18 01:46:39
项目部署运行没有任何错误,对于JSP页面文件照常访问,就是以遇到需要表单处理的页面就出现可恶的404错误!我对于可能出错的地方已经进行了检查,结果发现
1.、web.xml文件中配置ActionServlet没问题
2、struts-config.xml文件中配置要访问的Action没问题
3、jsp文件form标记中action属性的路径名称也没问题。
4,察看Tomcat下logs目录下的localhost_log文件,发现好几个错误:

2008-04-18 11:55:34 StandardContext[/balancer]org.apache.webapp.balancer.BalancerFilter: init(): ruleChain: [org.apache.webapp.balancer.RuleChain: [org.apache.webapp.balancer.rules.URLStringMatchRule: Target string: News / Redirect URL: http://www.cnn.com], [org.apache.webapp.balancer.rules.RequestParameterRule: Target param name: paramName / Target param value: paramValue / Redirect URL: http://www.yahoo.com], [org.apache.webapp.balancer.rules.AcceptEverythingRule: Redirect URL: http://jakarta.apache.org]]
2008-04-18 11:55:35 StandardContext[/jsp-examples]ContextListener: contextInitialized()
2008-04-18 11:55:35 StandardContext[/jsp-examples]SessionListener: contextInitialized()
2008-04-18 11:55:36 StandardContext[/servlets-examples]ContextListener: contextInitialized()
2008-04-18 11:55:36 StandardContext[/servlets-examples]SessionListener: contextInitialized()
2008-04-18 11:55:39 StandardContext[/guestbook2]Initializing Spring root WebApplicationContext
2008-04-18 11:55:41 StandardContext[/guestbook2]StandardWrapper.Throwable
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.lang.String] to required type [javax.sql.DataSource] for property 'dataSource'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [java.lang.String] to required type [javax.sql.DataSource] for property 'dataSource': no matching editors or conversion strategy found
Caused by: org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.lang.String] to required type [javax.sql.DataSource] for property 'dataSource'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [java.lang.String] to required type [javax.sql.DataSource] for property 'dataSource': no matching editors or conversion strategy found
Caused by: java.lang.IllegalArgumentException: Cannot convert value of type [java.lang.String] to required type [javax.sql.DataSource] for property 'dataSource': no matching editors or conversion strategy found
...........
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:398)
----- Root Cause -----
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.lang.String] to required type [javax.sql.DataSource] for property 'dataSource'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [java.lang.String] to required type [javax.sql.DataSource] for property 'dataSource': no matching editors or conversion strategy found
Caused by: org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.lang.String] to required type [javax.sql.DataSource] for property 'dataSource'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [java.lang.String] to required type [javax.sql.DataSource] for property 'dataSource': no matching editors or conversion strategy found
Caused by: java.lang.IllegalArgumentException: Cannot convert value of type [java.lang.String] to required type [javax.sql.DataSource] for property 'dataSource': no matching editors or conversion strategy found
.............
2008-04-18 11:55:55 StandardContext[/guestbook2]Initializing WebApplicationContext for Struts ActionServlet 'action', module ''
2008-04-18 11:55:56 StandardContext[/guestbook2]action: null
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.lang.String] to required type [javax.sql.DataSource] for property 'dataSource'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [java.lang.String] to required type [javax.sql.DataSource] for property 'dataSource': no matching editors or conversion strategy found
Caused by: org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.lang.String] to required type [javax.sql.DataSource] for property 'dataSource'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [java.lang.String] to required type [javax.sql.DataSource] for property 'dataSource': no matching editors or conversion strategy found
Caused by: java.lang.IllegalArgumentException: Cannot convert value of type [java.lang.String] to required type [javax.sql.DataSource] for property 'dataSource': no matching editors or conversion strategy found
...........
...全文
824 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
ximietianlai 2008-10-08
  • 打赏
  • 举报
回复
真的是倒包的问题吗?
我都不清楚是咋个回事了...哎,还有人能帮帮忙么?
我倒包是按--hibernate3.1 spring2.0 的顺序也是出一样错误。
wolf_in_darkness 2008-05-26
  • 打赏
  • 举报
回复
谢谢个位朋友了!前段时间出差,一直没空上网,对不住了.这个问题已经解决了,正如6楼的兄弟所说,希望大家以后也吸取教训,我也会及时上来跟大家一起交流的.
一板砖夯死你 2008-04-22
  • 打赏
  • 举报
回复
Cannot convert value of type [java.lang.String] to required type [javax.sql.DataSource] for property 'dataSource': no matching editors or conversion strategy found

数据类型转换错误~~~
NONE9 2008-04-20
  • 打赏
  • 举报
回复
楼主用的是Hibernate3.1的版本吗?如果是的话,那就看你导包的顺序了,
如果是Struts->Spring->Hibernate的话,那你导Spring的时候有个弹出对话框,你点中间那个replace按钮,最后导Hibernate就点第一个按钮

如果你用的是Hibernate3.0的版本,就按Struts->Hibernate->Spring的顺序添加,这里Hibernate和Spring的对话框都点第一个按钮

应该是这个问题吧,我以前也经常出现这个问题的

lihaibo168 2008-04-20
  • 打赏
  • 举报
回复
你把form里面的action的路径写全路径
比如
<form action="/项目名/actionName.do" method="post">
</form>
li_d_s 2008-04-18
  • 打赏
  • 举报
回复
Error creating bean with name 'sessionFactory' defined in ServletContext resource

=========================
'sessionFactory' 这个bean的定义部分
傻根她弟 2008-04-18
  • 打赏
  • 举报
回复
如果配置文件没有问题,那么最大的可能是导入包版本问题
shaokui_pro 2008-04-18
  • 打赏
  • 举报
回复
在spring 里面好好查查.里面有的东西找不到.或者写错都会导致404
wolf_in_darkness 2008-04-18
  • 打赏
  • 举报
回复

为这个问题头疼两天了,请大侠指点迷津!为了节省大家的时间,我附上关键配置信息如下:
web.xml:
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>3</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>3</param-value>
</init-param>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>/input.jsp</welcome-file>
</welcome-file-list>


struts-config.xml:
<action-mappings >
<action
attribute="guestbookForm"
input="/input.jsp"
name="guestbookForm"
parameter="method"
path="/guestbook"
scope="request"
type="org.springframework.web.struts.DelegatingActionProxy"
validate="false" />

</action-mappings>

<message-resources parameter="com.v512.guestbook.web.ApplicationResources" />

<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames" value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml" />
</plug-in>

<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation" value="/WEB-INF/action-servlet.xml" />
</plug-in>


action-servlet.xml:
<bean name="/guestbook"
class="com.v512.guestbook.web.action.GuestbookAction" abstract="false"
lazy-init="default" autowire="default" dependency-check="default" >
<property name="guestbookManager">
<ref bean="guestbookManager" />
</property>
</bean>


applicationContext.xml:
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName">
<value>oracle.jdbc.driver.OracleDriver</value>
</property>
<property name="url">
<value>jdbc:oracle:thin:@localhost:1521:orcl</value>
</property>
<property name="username">
<value>scott</value>
</property>
<property name="password">
<value>yf803015</value>
</property>
</bean>



input.jsp:
<html:form action="guestbook.do" onsubmit="return validateGuestbookForm(this)">
<html:hidden property="method" value="save"/>

67,515

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧