java项目直接从win转到mac,(解决)javaweb项目在window上能运行,转在mac系统上却一直报错...

最近在将一个在windows系统上能正常运行的javaweb项目,从开发平台的windows上转移到Mac平台上进行开发时一直在报Spring的创建bin异常的错误; 如下

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'shiroFilter' defined in file [/Applications/apache-tomcat-8.0.53/webapps/budget_web_war/WEB-INF/classes/spring/applicationContext-shiro.xml]: BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor#0' defined in file [/Applications/apache-tomcat-8.0.53/webapps/budget_web_war/WEB-INF/classes/spring/applicationContext-mvc.xml]: Cannot resolve reference to bean 'securityManager' while setting bean property 'securityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityManager' defined in file [/Applications/apache-tomcat-8.0.53/webapps/budget_web_war/WEB-INF/classes/spring/applicationContext-shiro.xml]: Cannot resolve reference to bean 'shiroDbRealm' while setting bean property 'realm'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'shiroDbRealm': Unsatisfied dependency expressed through field 'shiroUserService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'shiroUserServiceImpl': Unsatisfied dependency expressed through field 'shiroUserMapper'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'shiroUserMapper' defined in URL [jar:file:/Applications/apache-tomcat-8.0.53/webapps/budget_web_war/WEB-INF/lib/budget-business-1.0.0.jar!/com/sunkee/business/admin/mapper/ShiroUserMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in file [/Applications/apache-tomcat-8.0.53/webapps/budget_web_war/WEB-INF/classes/spring/applicationContext-mybatis.xml]: Invocation of init method failed; nested exception is java.lang.AbstractMethodError: org.slf4j.impl.Log4jLoggerAdapter.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)

刚开始已为是jar包出了问题,删除maven仓库里的所有jar包重新下载,还是一样报错,又想也许是jdk版本或环境变量的问题

于是我在mac上重装jdk 重设环境变量,可问题依旧存在,于是又以为可能是哪个同事提交代码时忘记提交某部分代码,于是将试着用maven将项目打成war包,打包确成功了,又将项目放在win7系统上运行,发现没任何问题,这时我心里就纳闷了,这是什么情况,我从来没遇到过,接着又将目光转向有没有可能是maven版跟tomcat版本出了总是,虽然我心里知道不可能是maven跟tomcat的问题。但实在想不出会是哪里出了问题,于是又重新下载了相同版本的maven跟tomcat,配置环境变量等一顿折腾,结果还是报同样的错误,此时想死的心都有了,又重新打成war包去window上运行,发现这个项目的确是可以正常运行的,又叫同事将他工程里面能正常运行的源码发我,导入我我的开发工具里运行,他妈的还是在报错。此时我真的想不出任何可能出现报错原因的所在了。经过一翻考虑之后,我决定将我以前开发好的web项目在mac上运行一下试试。于是又花了个把小时,把以前的项目搞下来,装对应的装数据库和相关的配置之后,开始启动服务,他妈的,报的居然是相同的错误。创建bin的名字失败。此时我大胆的对自已说了一声,这不是项目的问题,这是系统问题,这绝对是系统问题。于是我看了一下我Mac的系统名称发现我的Mac系统是 mac mojova,网上查询了一下,没有找到这个系统是不是会导致java项目运行报错的任何信息,只知道这个是目前Mac最新的系统。但我依然一口咬定这就是系统问题。绝对错不了。于是我二话不说将资料备份,去网上寻找苹果的其它系统,最终选择了一个名为MacOs sierra 10.12.4(16E195)的系统

接着开始了三四个小时的,下载Mac系统 制做成U盘 重装系统的过程。经过半天的折腾系统总算是装好了。于是我又开始装软件 jdk 配置环境变量 数据库等一系列的操作,又经过两个小时后所有的工作都做好了,于是我点击了一下IDEA的启动按钮。

当项目运行完后没有报错,浏览器自动弹出了我项目的首页时,此时别提我心里有多激动了。没错就是他妈的系统问题。为了解决这个问题我花了整整三天时间,周末双休的时间都花在解决这个问题上面了。至于为什么是系统原因,这个问题有点深奥,本人暂时回答不上来。但如果你也是运到跟我同样的情况,在排除了所有可能出错的原因后仍然报这个错。那么恭喜你,你百分之90遇到的问题跟我是一样的。也恭喜你能找到我这篇帖子,因为这个帖子可能会成为你的救命帖, 只有经历过的人才能感受到那种实在无能为力,怎么也找不出哪里出了问题这当中的痛苦与无赖, 谁他妈会想到是系统问题。这种问题我想遇到人的肯定很少,但一遇到就是致命的问题,

在此也将本人排查问题的思路跟解决方式发出来 希望能帮助到预到跟我同样问题的人

最后帖一张重装系统后能正常运行项目的Mac系统版本图片,之前的那个一直报错的是 mac mojova系统, 由于当时没有想到事后会发帖子,所以没有截图

fcb6640acdc69694de1afae3ad94e1de.png

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值