2011-11-19 47 views
0

这是一个错误时编译我的项目时,NetBeans上获得:Java的编译错误的NetBeans

Exception while loading the app : java.lang.Exception: java.lang.IllegalStateException: 
ContainerBase.addChild: start: org.apache.catalina.LifecycleException: 
org.apache.catalina.LifecycleException: java.lang.ClassCastException: 
core.smd.classes.FormData 
cannot be cast to javax.servlet.Servlet 

D:\Users\GHAMKS1C\Documents\NetBeansProjects\SMDApp\nbproject\build-impl.xml:728: 
The module has not been deployed. 
at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy 
    (Deployment.java:210) 
at org.netbeans.modules.j2ee.ant.Deploy.execute(Deploy.java:106) 
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) 
at sun.reflect.GeneratedMethodAccessor45.invoke(Unknown Source) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
at java.lang.reflect.Method.invoke(Method.java:601) 
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) 
at org.apache.tools.ant.Task.perform(Task.java:348) 

任何想法? 谢谢

+3

我们应该猜测没有看到代码? – skaffman

+0

以及它是为所有类工作,我能够启动该网站..不知道发生了什么。所以我认为这很容易弄清楚,因为它可能是在构建xml中的常见错误:( –

+2

'core.smd.classes.FormData不能转换为javax.servlet.Servlet' ..我想你应该再次检查你的代码。这里有错误的转换,通常你会在错误中看到'由...引发:'这应该告诉你确切的原因。 –

回答

0

例外说core.smd.classes.FormData cannot be cast to javax.servlet.Servlet。所以我推测你在使用Servlet的地方使用FormData类。也许你错误地配置了你的web.xml。

+0

好的,我应该把它发布在这里吗?因为我不确定...我几乎没有碰到任何东西:( –

0

还行吧: 在servlet下的netbeans中,在servlet类中,我有一个错误的值。正确的一般价值是有默认为:

javax.faces.webapp.FacesServlet

我不得不重新创建项目,但是这是新老之间的唯一区别。因此它是问题的原因。

希望这可以帮助未来的人:)