Instantiation of bean failed; nested exception is org.springframework.beans.Bean

zhangxuli 2014-05-14 09:29:47
String index out of range: -1
Could not instantiate bean class [com.runfine.wd.action.LoginAction]: Constructor threw exception; nested exception is java.lang.StringIndexOutOfBoundsException: String index out of range: -1
Error creating bean with name 'loginAction' defined in file [/usr/apache-tomcat-7.0.53/webapps/wd/WEB-INF/classes/applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.runfine.wd.action.LoginAction]: Constructor threw exception; nested exception is java.lang.StringIndexOutOfBoundsException: String index out of range: -1
Unable to instantiate Action, loginAction, defined for 'LoginAction' in namespace '/'Error creating bean with name 'loginAction' defined in file [/usr/apache-tomcat-7.0.53/webapps/wd/WEB-INF/classes/applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.runfine.wd.action.LoginAction]: Constructor threw exception; nested exception is java.lang.StringIndexOutOfBoundsException: String index out of range: -1

本人将windows下部署好的项目发布到linux下登陆时报的错(在win下正常运行),求高手指点
...全文
14587 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhangxuli 2014-05-16
  • 打赏
  • 举报
回复
谢谢你们的回答,问题找到了,是linux与windows下的路径不一样,action extends ActionSupportStruts2 ,ActionSupportStruts2 extends ActionSupportStrut,而ActionSupportStruts2中变量的文件路径没改。
tony4geek 2014-05-16
  • 打赏
  • 举报
回复
你看看这个文件找找看看。 [/usr/apache-tomcat-7.0.53/webapps/wd/WEB-INF/classes/applicationContext.xml]: 另外 linux 路径和window 不一样
zhangxuli 2014-05-16
  • 打赏
  • 举报
回复
项目中的所有bean都不能被实例化
zhangxuli 2014-05-16
  • 打赏
  • 举报
回复
可是配置都好着呢呀,在windows下都能运行正常,
tony4geek 2014-05-16
  • 打赏
  • 举报
回复
应该配置 问题 找不到 Unable to instantiate Action, loginAction, defined for 'LoginAction' in namespace '/'Error creating bean with name 'loginAction' defined in file [/usr/apache-tomcat-7.0.53/webapps/wd/WEB-INF/classes/applicationContext.xml]:
zhangxuli 2014-05-16
  • 打赏
  • 举报
回复
项目在windows下运行正常,在linux下我也试过其他的模块存在同样的问题,不能实例化bean,
点滴寸土 2014-05-15
  • 打赏
  • 举报
回复
配置文件里loginAction这一块配置有问题吧
在搭建spring项目时通常需要这些jar包 commons-logging-1.1.3.jar spring-aop-4.0.6.RELEASE.jar spring-beans-4.0.6.RELEASE.jar spring-context-4.0.6.RELEASE.jar spring-core-4.0.6.RELEASE.jar spring-expression-4.0.6.RELEASE.jar 在使用spring额外功能时 1 需要在xml文件中加入命名空间 可以在spring-framework-4.0.6.RELEASE\docs\spring-framework-reference\html 中搜索关键字查找配置 2 加入需要的jar包(依赖包) 由于没有引入 spring-aop-4.0.6.RELEASE.jar 引起的错误 org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/aop] Offending resource: class path resource [beans.xml] at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:70) 由于缺少依赖包 aspectjweaver-1.6.12.jar http://search.maven.org/remotecontent?filepath=org/aspectj/aspectjweaver/1.6.12/aspectjweaver-1.6.12.jar org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.aop.config.internalAutoProxyCreator': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/aspectj/lang/annotation/Around 由于缺少依赖包 aopalliance-1.0.jar org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.aop.config.internalAutoProxyCreator': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/aopalliance/intercept/MethodInterceptor
【资源说明】 1、基于springboot+mybatis实现的外卖订餐系统源码+项目说明(毕设).zip 2、该资源包括项目的全部源码,下载可以直接使用! 3、本项目适合作为计算机、数学、电子信息等专业的课程设计、期末大作业和毕设项目,作为参考资料学习借鉴。 4、本资源作为“参考资料”如果需要实现其他功能,需要能看懂代码,并且热爱钻研,自行调试。 ### 项目概述 首先来了解项目需求。 项目分为客户端和后台管理系统两个界面,客户端针对普通用户,功能包括用户登陆、用户退出、菜品订购、我的订单。 后台管理系统针对管理员,功能包括管理员登陆、管理员退出、添加菜品、查询菜品、修改菜品、删除菜品、订单处理、添加用户、查询用户、删除用户。 需求了解完之后,接下来设计系统,首先分配出4个服务提供者,account、menu、order、user。 - account - 提供账户服务:用户和管理员登陆。 - menu - 提供菜品服务:添加菜品、查询菜品、修改菜品、删除菜品。 - order - 提供订单服务:添加订单、查询订单、删除订单、处理订单。 - user - 提供用户服务:添加用户、查询用户、删除用户、用户修改。 ## 异常 - org.springframework.beans.factory.UnsatisfiedDependencyException 不满足依赖异常 - org.springframework.beans.factory.BeanCreationException - org.springframework.beans.BeanInstantiationException - org.springframework.core.NestedIOException - org.apache.ibatis.builder.BuilderException - java.lang.IllegalArgumentException ``` Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [C:\Users\GUSHI\IdeaProjects\springboot2\target\classes\mapping\UserRepository.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for com.m.dao.AdminDao.login at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType (AbstractAutowireCapableBeanFactory.java:1431)

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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