NutzCN Logo
精华 一用debug模式就挂
发布于 3036天前 作者 LuoYY 2792 次浏览 复制 上一个帖子 下一个帖子
标签: issue scans faq

不用debug模式直接跑没问题
但是一用debug模式就出问题
弹框

Server Tomcat v8.0 Server at localhost was unable to start within 45 seconds. If the server requires more time, try increasing the timeout in the server editor.

控制台输出

信息: Initializing Shiro environment
2016-07-31 18:54:12,229 org.apache.shiro.web.env.EnvironmentLoader.initEnvironment(EnvironmentLoader.java:128) INFO  - Starting Shiro environment initialization.
2016-07-31 18:54:12,239 org.apache.shiro.web.env.IniWebEnvironment.init(IniWebEnvironment.java:76) DEBUG - Checking any specified config locations.
2016-07-31 18:54:12,240 org.apache.shiro.web.env.IniWebEnvironment.init(IniWebEnvironment.java:81) DEBUG - No INI instance or config locations specified.  Trying default config locations.
2016-07-31 18:54:12,243 org.apache.shiro.io.ResourceUtils.loadFromClassPath(ResourceUtils.java:159) DEBUG - Opening resource from class path [shiro.ini]
2016-07-31 18:54:12,246 org.apache.shiro.config.Ini.load(Ini.java:342) DEBUG - Parsing [main]
2016-07-31 18:54:12,246 org.apache.shiro.config.Ini.load(Ini.java:342) DEBUG - Parsing [urls]
2016-07-31 18:54:12,247 org.apache.shiro.web.env.IniWebEnvironment.getDefaultIni(IniWebEnvironment.java:136) DEBUG - Discovered non-empty INI configuration at location 'classpath:shiro.ini'.  Using for configuration.
2016-07-31 18:54:12,249 org.apache.shiro.config.IniFactorySupport.createInstance(IniFactorySupport.java:122) DEBUG - Creating instance from Ini [sections=urls]
2016-07-31 18:54:12,409 org.apache.shiro.config.IniFactorySupport.createInstance(IniFactorySupport.java:122) DEBUG - Creating instance from Ini [sections=urls]
2016-07-31 18:54:12,412 org.apache.shiro.web.filter.mgt.DefaultFilterChainManager.createChain(DefaultFilterChainManager.java:127) DEBUG - Creating chain [/*] from String definition [anon]
2016-07-31 18:54:12,412 org.apache.shiro.web.filter.mgt.DefaultFilterChainManager.applyChainConfig(DefaultFilterChainManager.java:278) DEBUG - Attempting to apply path [/*] to filter [anon] with config [null]
2016-07-31 18:54:12,413 org.apache.shiro.web.env.EnvironmentLoader.initEnvironment(EnvironmentLoader.java:136) DEBUG - Published WebEnvironment as ServletContext attribute with name [org.apache.shiro.web.env.EnvironmentLoader.ENVIRONMENT_ATTRIBUTE_KEY]
2016-07-31 18:54:12,413 org.apache.shiro.web.env.EnvironmentLoader.initEnvironment(EnvironmentLoader.java:141) INFO  - Shiro environment initialized in 182 ms.
2016-07-31 18:54:12,441 org.nutz.mvc.NutFilter._init(NutFilter.java:81) INFO  - NutFilter[da] starting ...
18 回复

不用debug跑的时候,下一句日志是什么

来自炫酷的 NutzCN

@wendal

2016-07-31 19:12:57,725 org.nutz.resource.Scans.<init>(Scans.java:486) DEBUG - Locations for Scans:

所以,debug一下Scans类,看看什么原因

来自炫酷的 NutzCN

@wendal 我在Scans类的init方法的第一行就设断点,但是没有用,debug报错依旧,根本还没到这个点来

那就只能从NutFilter开始跟踪了

@wendal 对了,点击debug,Eclipse就直接进入Debug模式,编辑器弹出一个选项卡,选项卡标题:Handler.parseAbsoluteSpec(String)line:not avaliable

@wendal 不知道这信息有用没

@luoyy 其实是进断点了?

来自炫酷的 NutzCN

@wendal 对,然后我去Eclipse的断点里去找,发现了一个东西,在我的断点之前有个空指针异常的断点,去掉这个断点就可以正常启动了,但是不知道这个断点是在哪里触发的
QQ图片20160731222307_png

@luoyy 进断点之后,不是应该有堆栈吗

来自炫酷的 NutzCN

我试出来了

Daemon Thread [localhost-startStop-1] (Suspended (exception NullPointerException))	
	owns: HashMap<K,V>  (id=58)	
	owns: StandardContext  (id=59)	
	Handler.parseAbsoluteSpec(String) line: 171	
	Handler.parseURL(URL, String, int, int) line: 151	
	URL.<init>(URL, String, URLStreamHandler) line: 622	
	URL.<init>(URL, String) line: 490	
	URL.<init>(String) line: 439	
	Scans.<init>() line: 459	
	Scans.<clinit>() line: 432	
	FilterNutConfig(AbstractNutConfig).<init>(ServletContext) line: 43	
	FilterNutConfig.<init>(FilterConfig) line: 15	
	NutFilter._init(FilterConfig) line: 85	
	NutFilter.init(FilterConfig) line: 65	
	ApplicationFilterConfig.initFilter() line: 279	
	ApplicationFilterConfig.getFilter() line: 260	
	ApplicationFilterConfig.<init>(Context, FilterDef) line: 105	
	StandardContext.filterStart() line: 4583	
	StandardContext.startInternal() line: 5207	
	StandardContext(LifecycleBase).start() line: 150	
	ContainerBase$StartChild.call() line: 1408	
	ContainerBase$StartChild.call() line: 1398	
	FutureTask<V>.run() line: 266	
	ThreadPoolExecutor.runWorker(ThreadPoolExecutor$Worker) line: 1142	
	ThreadPoolExecutor$Worker.run() line: 617	
	Thread.run() line: 745	

@wendal 好像是在tomcat启动的时候出错了
QQ图片20160731223226_png

用代码重现了一下

    @Test
    public void test_tomcat_jar_npe() throws MalformedURLException {
        new URL("jar:file:/D:/nutzbook/apache-tomcat-8.0.28/bin/bootstrap.jar");
    }

java.net.MalformedURLException: no !/ in spec
	at java.net.URL.<init>(URL.java:627)
	at java.net.URL.<init>(URL.java:490)
	at java.net.URL.<init>(URL.java:439)
	at net.wendal.nutzbook.SimpleTest.test_tomcat_jar_npe(SimpleTest.java:729)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: java.lang.NullPointerException: no !/ in spec
	at sun.net.www.protocol.jar.Handler.parseAbsoluteSpec(Handler.java:171)
	at sun.net.www.protocol.jar.Handler.parseURL(Handler.java:151)
	at java.net.URL.<init>(URL.java:622)
	... 28 more


@wendal 这种情况要怎么处理呢,把那个空指针断点去掉?

已提交, thx

@wendal 我找到了

url = new URL(url_str.substring(0, url_str.length()- referPath.length()- 2))

这是要新版本才会修复是吧?我自己不能修改现在只能先停用空指针断点是吧?

@luoyy yes,简单跳过去也可以嘛

来自炫酷的 NutzCN

添加回复
请先登陆
回到顶部