Eclipse构建路径嵌套错误 [英] Eclipse Build Path Nesting Errors
问题描述
当我运行应用程序时,我的欢迎文件显示好的,但是当我尝试访问我的servlet时,我得到:
Http 500 SEVERE:为servlet分配异常InitDb
java.lang.ClassNotFoundException。我很确定这是一个构建路径错误。我在构建路径上有最终/ src,但是我收到警告
无法嵌套'final / src / main / webapp / WEB-INF / classes'在'final / src'里面启用嵌套从'final / src'中排除'main /'
我在我的部署程序集中有:
< wb-resource deploy-path =/source-path =/ src / main / webapptag =defaultRootSource/>
当我排除主/ /这个警告消失了,但是它并没有解决这个问题,感谢任何建议,谢谢。
即使我创建了一个新的项目,同样的问题
我正在Eclipse中创建Java项目,然后进行mavenize,然后进入java构建路径属性删除 src /
并添加 src / main / java
和 src / test / java
。当我运行Maven更新时,它用于给出嵌套的路径错误。
然后我终于意识到 - 因为我没有看到这个条目 - 在pom文件中有一个< sourceDirectory> src< / sourceDirectory>
写我的时候,删除后解决。
I'm working on a simple JSP/Servlet/Tomcat webapp for my class. The professor asked us to use a folder structure that is slightly different than the default dynamic web project structure. Rather than using the webcontent folder he wants all of our source code under src/main/java and src/main/webapp.
When I run the app my welcome file displays fine, but when I try to access my servlets I get:
Http 500 SEVERE: Allocate exception for servlet InitDb
java.lang.ClassNotFoundException. I'm pretty sure it's a build path error. I have final/src on the build path but I am receiving the warning
"Cannot nest 'final/src/main/webapp/WEB-INF/classes' inside 'final/src'. To enable the nesting exclude 'main/' from 'final/src'
I have this in my deployment assembly:
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
When I exclude main/ the warning goes away, but it doesn't fix the problem. I would appreciate any advice. Thanks.
I had the same problem even when I created a fresh project.
I was creating the Java project within Eclipse, then mavenize it, then going into java build path properties removing src/
and adding src/main/java
and src/test/java
. When I run Maven update it used to give nested path error.
Then I finally realized -because I had not seen that entry before- there is a <sourceDirectory>src</sourceDirectory>
line in pom file written when I mavenize it. It was resolved after removing it.
这篇关于Eclipse构建路径嵌套错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!