lishunli / nutz

Automatically exported from code.google.com/p/nutz
0 stars 0 forks source link

Nutz项目名称包含“.”的问题 #159

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
问题产生的条件:
  项目名称:hello.nutz
  MainModule所在的包名:hello.nutz.MainModule
  web.xml中的配置:
        <servlet>
        <servlet-name>nutz</servlet-name>
        <servlet-class>org.nutz.mvc.NutServlet</servlet-class>
        <init-param>
            <param-name>modules</param-name>
            <param-value>hello.nutz.mvc.MainModule</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>nutz</servlet-name>
        <url-pattern>*.jsp</url-pattern>
    </servlet-mapping>

发生问题的调用代码:
  启动tomcat时报以下错误:
Error happend during start serivce!
java.lang.ClassNotFoundException: hello.nutz.MainModule
    at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:13
87)
    at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:12
33)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:169)
    at org.nutz.mvc.NutServlet.init(NutServlet.java:60)
    at javax.servlet.GenericServlet.init(GenericServlet.java:212)
    at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993)
    at
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4149
)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4458)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
    at org.apache.catalina.core.StandardService.start(StandardService.java:516)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.jav
a:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
2010-4-19 20:56:06 org.apache.catalina.core.StandardContext loadOnStartup
严重: Servlet /hello threw load() exception
java.lang.ClassNotFoundException: hello.nutz.MainModule
    at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:13
87)
    at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:12
33)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:169)
    at org.nutz.mvc.NutServlet.init(NutServlet.java:60)
    at javax.servlet.GenericServlet.init(GenericServlet.java:212)
    at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993)
    at
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4149
)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4458)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
    at org.apache.catalina.core.StandardService.start(StandardService.java:516)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.jav
a:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
2010-4-19 20:56:06 org.apache.coyote.http11.Http11Protocol start
...

异常堆栈:

相关日志:

Original issue reported on code.google.com by cityyokel on 19 Apr 2010 at 1:37

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
唯一的代码就是这个MainModule,其他的代码就是一个index.jsp了�
��

package hello.nutz;
import org.nutz.mvc.annotation.Modules;
@Modules({})
public class MainModule { }

Original comment by cityyokel on 19 Apr 2010 at 1:39

GoogleCodeExporter commented 9 years ago
在 Eclipse 里建立这个项目,在 Servlet.init() 中使用 Class.forName 
随便一个类名,都
是ClassNotFoundException

Original comment by zozoh...@gmail.com on 20 Apr 2010 at 2:37

GoogleCodeExporter commented 9 years ago

Original comment by wendal1985@gmail.com on 22 Apr 2010 at 3:51

GoogleCodeExporter commented 9 years ago
why wontfix?
and then you will tell Nutz users not to create projects with a "."?

Original comment by cityyokel on 22 Apr 2010 at 5:23

GoogleCodeExporter commented 9 years ago
这是tomcat的问题. 不是nutz的bug.

Original comment by wendal1985@gmail.com on 22 Apr 2010 at 6:09

GoogleCodeExporter commented 9 years ago

Original comment by wendal1985@gmail.com on 13 May 2010 at 11:13