eclipse运行ssh项目出现"HTTP Status 500
来源:互联网 发布:免费手机号码定位软件 编辑:程序博客网 时间:2024/06/14 00:45
1. 在eclipse运行ssh项目出现以下错误信息:
HTTP Status 500 - Unable to instantiate Action.......................
错误信息太多就不写了。
2. 出现以上问题可能是:
在applicationContext.xml配置文件中,把用Repository, Service, Controller注解的bean加到spring容器中, 填写的基包名与项目的基包名不一致。
1. <!-- 把用Repository, Service, Controller注解的bean加到spring容器中 -->
2. <context:component-scan base-package="base"/>
此项目本人采用的是struts2+hibernate4+spring4写的
ApplicationContext.xml
<?xmlversion="1.0"encoding="UTF-8"?>
<beansxmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/txhttp://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/aophttp://www.springframework.org/schema/aop/spring-aop-3.2.xsd">
<!-- 自动扫描扫描指定的包下的所有文件的注解 -->
<context:component-scan base-package="base" />
<beanid="dataSource"
class="com.mchange.v2.c3p0.ComboPooledDataSource">
<propertyname="jdbcUrl"value="jdbc:mysql://localhost:3306/shopstore"></property>
<propertyname="user"value="root"></property>
<propertyname="password"value="root"></property>
<propertyname="driverClass"value="com.mysql.jdbc.Driver"></property>
<propertyname="minPoolSize"value="10"/>
<propertyname="maxPoolSize"value="100"/>
<propertyname="maxIdleTime"value="1800"/>
<propertyname="acquireIncrement"value="3"/>
<propertyname="maxStatements"value="1000"/>
<propertyname="initialPoolSize"value="10"/>
<propertyname="idleConnectionTestPeriod"value="60"/>
<propertyname="acquireRetryAttempts"value="30"/>
<propertyname="breakAfterAcquireFailure"value="true"/>
<propertyname="testConnectionOnCheckout"value="false"/>
</bean>
<!-- spring提供工厂创建sessionfactory -->
<beanid="sessionFactory"
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<!-- 关联dataSource属性 -->
<propertyname="dataSource">
<refbean="dataSource"/>
</property>
<propertyname="hibernateProperties">
<props>
<propkey="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</prop>
<propkey="hibernate.hbm2ddl.auto">update</prop>
<propkey="hibernate.current_session_context_class">
org.springframework.orm.hibernate4.SpringSessionContext</prop>
<propkey="hibernate.show_sql">true</prop>
<propkey="hibernate.format_sql">true</prop>
</props>
</property>
<!-- 映射文件 (也可以写在hibernate.cfg.xml配置文件中) -->
<propertyname="mappingResources">
<list>
<value>base/bean/admin.hbm.xml</value>
</list>
</property>
</bean>
<!-- 配置事务管理 -->
<beanid="transactionManager"
class="org.springframework.orm.hibernate4.HibernateTransactionManager">
<propertyname="sessionFactory"ref="sessionFactory"/>
</bean>
<!--配置事务增强 -->
<tx:adviceid="txAdvice"transaction-manager="transactionManager">
<tx:attributes>
<tx:methodname="select*"propagation="REQUIRED"/>
<tx:methodname="save*"propagation="REQUIRED"/>
<tx:methodname="delete*"propagation="REQUIRED"/>
<tx:methodname="update*"propagation="REQUIRED"/>
<tx:methodname="get*"read-only="true"propagation="REQUIRED"/>
<tx:methodname="*"read-only="true"/>
</tx:attributes>
</tx:advice>
<!--aop配置 -->
<aop:configexpose-proxy="true">
<aop:pointcutid="pt"expression="execution(*base.service.*.*(..))"/>
<aop:advisoradvice-ref="txAdvice"pointcut-ref="pt"/>
</aop:config>
</beans>
Web.xml
<?xmlversion="1.0"encoding="UTF-8"?>
<web-appxmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaeehttp://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID"version="3.0">
<display-name>ShoppingStore</display-name>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
</web-app>
Struts.xml
<?xmlversion="1.0"encoding="UTF-8"?>
<!DOCTYPEstrutsPUBLIC
"-//ApacheSoftware Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
<!-- 修改上传文件的总大小一个表单提交的总大小 -->
<constantname="struts.multipart.maxSize"value="52428800"></constant>
<constantname="struts.objectFactory"value="spring"></constant>
<packagename="admin"extends="struts-default">
<!-- 登录 -->
<actionname="login"class="adminaction"method="login">
<resultname="loginsuccess"type="redirectAction">
home
</result>
<resultname="loginfail">/admin/index.jsp</result>
</action>
这是我遇到的错误,修改后可用,此方案仅供参考。
- eclipse运行ssh项目出现"HTTP Status 500
- eclipse运行ssh项目出现"HTTP Status 500 - Unable to instantiate Action"
- Eclipse运行报错:HTTP Status 500
- Eclipse中运行Servlet出现HTTP Status *** 的若干错误解决
- Tomcat7出现HTTP Status 500
- Tomcat7出现HTTP Status 500
- Eclipse运行报错:HTTP Status 500 - javax.servlet.ServletException: java.lang.UnsupportedClassVersionError
- Flex项目运行,报错 HTTP:status 404
- jsp无法运行,报错HTTP Status 500
- eclipse中运行tomcat访问抛出 HTTP Status 401/404 异常
- HTTP Status 500 -
- HTTP Status 500
- HTTP Status 500 -
- 解决HTTP Status 500
- HTTP Status 500
- HTTP Status 500错误
- 异常 HTTP Status 500
- HTTP Status 500
- sublime 3使用phpfmt美化/格式化php代码(xp下失败)
- 什么是面向对象
- 美食之旅澳门地道特色小吃推荐
- vue-resource + json-server模拟数据 vue-cli配置
- Wifi源码学习(Android5.1)之wifi开关
- eclipse运行ssh项目出现"HTTP Status 500
- JAVA大数高精度
- AI中如何设置用户界面的颜色?
- mysql 查询表结构及备注及导出
- poj 3233 Matrix Power Series
- 写一段程序,比较浮点数和零的值得大小
- 关于winsock2 中boolean于oci中编译冲突问题
- SCOI2005 互不侵犯
- Java内存模型深度解读