开发者社区 问答 正文

关于项目部署到 tomcat ROOT 中的问题?报错

请问 

将publiccms-by-maven 部署到myeclipse以后

右键工程properties  -> MyEclipse -> Web   

想把工程 Web Context-root 改成 "/"

以前这么改了以后  工程会被自动部署到 tomcat webApps ROOT中

现在这么改就报错为什么?

展开
收起
爱吃鱼的程序员 2020-06-08 20:04:05 588 分享 版权
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    报什么错呢这样部署是没问题的它跟其他web工程没什么区别

    启动的时候满屏幕都是这些大概是spring注入bean时候出错了吧

    Causedby:org.springframework.beans.factory.UnsatisfiedDependencyException:Errorcreatingbeanwithname'templateComponent':Unsatisfieddependencyexpressedthroughmethod'setFreeMarkerConfigurer'parameter1:Errorcreatingbeanwithname'publishPageDirective':Unsatisfieddependencyexpressedthroughfield'fileComponent':Errorcreatingbeanwithname'fileComponent'definedinfile[D:\apache-tomcat-7.0.40\webapps\ROOT\WEB-INF\classes\com\publiccms\logic\component\FileComponent.class]:Instantiationofbeanfailed;nestedexceptionisorg.springframework.beans.BeanInstantiationException:Failedtoinstantiate[com.publiccms.logic.component.FileComponent]:Constructorthrewexception;nestedexceptionisjava.lang.Error:Unresolvedcompilationproblems:

       Theimportjava.nio.filecannotberesolved
       Theimportjava.nio.filecannotberesolved
       Theimportjava.nio.filecannotberesolved
       Theimportjava.nio.filecannotberesolved
       Theimportjava.nio.filecannotberesolved
       DirectoryStreamcannotberesolvedtoatype
       Pathcannotberesolvedtoatype
       Filescannotberesolved
       Pathscannotberesolved
       Pathcannotberesolvedtoatype
       Pathcannotberesolvedtoatype
       BasicFileAttributescannotberesolvedtoatype
       Filescannotberesolved
       BasicFileAttributescannotberesolvedtoatype
       BasicFileAttributescannotberesolvedtoatype
    ;nestedexceptionisorg.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'fileComponent'definedinfile[D:\apache-tomcat-7.0.40\webapps\ROOT\WEB-INF\classes\com\publiccms\logic\component\FileComponent.class]:Instantiationofbeanfailed;nestedexceptionisorg.springframework.beans.BeanInstantiationException:Failedtoinstantiate[com.publiccms.logic.component.FileComponent]:Constructorthrewexception;nestedexceptionisjava.lang.Error:Unresolvedcompilationproblems:
       Theimportjava.nio.filecannotberesolved
       Theimportjava.nio.filecannotberesolved
       Theimportjava.nio.filecannotberesolved
       Theimportjava.nio.filecannotberesolved
       Theimportjava.nio.filecannotberesolved
       DirectoryStreamcannotberesolvedtoatype
       Pathcannotberesolvedtoatype
       Filescannotberesolved
       Pathscannotberesolved
       Pathcannotberesolvedtoatype
       Pathcannotberesolvedtoatype
       BasicFileAttributescannotberesolvedtoatype
       Filescannotberesolved
       BasicFileAttributescannotberesolvedtoatype
       BasicFileAttr
    ibutescannotberesolvedtoatype
    ;nestedexceptionisorg.springframework.beans.factory.UnsatisfiedDependencyException:Errorcreatingbeanwithname'publishPageDirective':Unsatisfieddependencyexpressedthroughfield'fileComponent':Errorcreatingbeanwithname'fileComponent'definedinfile[D:\apache-tomcat-7.0.40\webapps\ROOT\WEB-INF\classes\com\publiccms\logic\component\FileComponent.class]:Instantiationofbeanfailed;nestedexceptionisorg.springframework.beans.BeanInstantiationException:Failedtoinstantiate[com.publiccms.logic.component.FileComponent]:Constructorthrewexception;nestedexceptionisjava.lang.Error:Unresolvedcompilationproblems:
       Theimportjava.nio.filecannotberesolved
       Theimportjava.nio.filecannotberesolved
       Theimportjava.nio.filecannotberesolved
       Theimportjava.nio.filecannotberesolved
       Theimportjava.nio.filecannotberesolved
       DirectoryStreamcannotberesolvedtoatype
       Pathcannotberesolvedtoatype
       Filescannotberesolved
       Pathscannotberesolved
       Pathcannotberesolvedtoatype
       Pathcannotberesolvedtoatype
       BasicFileAttributescannotberesolvedtoatype
       Filescannotberesolved
       BasicFileAttributescannotberesolvedtoatype
       BasicFileAttributescannotberesolvedtoatype
    ;nestedexceptionisorg.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'fileComponent'definedinfile[D:\apache-tomcat-7.0.40\webapps\ROOT\WEB-INF\classes\com\publiccms\logic\component\FileComponent.class]:Instantiationofbeanfailed;nestedexceptionisorg.springframework.beans.BeanInstantiationException:Failedtoinstantiate[com.publiccms.logic.component.FileComponent]:Constructorthrewexception;nestedexceptionisjava.lang.Error:Unresolvedcompilationproblems:
       Theimportjava.nio.filecannotberesolved
       Theimportjava.nio.filecannotberesolved
       Theimportjava.nio.filecannotberesolved
       Theimportjava.nio.filecannotberesolved
       Theimportjava.nio.filecannotberesolved
       DirectoryStreamcannotberesolvedtoatype
       Pathcannotberesolvedtoatype
       Filescannotberesolved
       Pathscannotberesolved
       Pathcannotberesolvedtoatype
       Pathcannotberesolvedtoatype
       BasicFileAttributescannotberesolvedtoatype
       Filescannotberesolved
       BasicFileAttributescannotberesolvedtoatype

       BasicFileAttributescannotberesolvedtoatype
    我就简短复制一些。

    我猜测你的项目有飘红的地方吧编译貌似没过啊好了好了是我弄错了才发现JRE版本是1.6的换成1.7的瞬间解决!!是的,是有飘红的地方。。。主要是java.nio.file这个包找不到,但是我如果不更改WebContext-root为"/"而是使用默认的"/cms"程序就不会报错一切正常。。。谢谢 秋痕 kerneler 问题解决!

    2020-06-08 20:04:22
    赞同 展开评论
还有其他疑问?
咨询AI助理