错误一:
[2020-02-13 13:49:16 下午]:DEBUG org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver.getHandlerMappings(DefaultNamespaceHandlerResolver.java:157)Loaded NamespaceHandler mappings: {http://code.alibabatech.com/schema/dubbo=org.apache.dubbo.config.spring.schema.DubboNamespaceHandler, http://dubbo.apache.org/schema/dubbo=org.apache.dubbo.config.spring.schema.DubboNamespaceHandler}
[2020-02-13 13:49:16 下午]:WARN io.netty.channel.ChannelInitializer.exceptionCaught(ChannelInitializer.java:97)Failed to initialize a channel. Closing: [id: 0xe5580ae0, L:/127.0.0.1:54000 - R:/127.0.0.1:52912]
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/context]
Offending resource: class path resource [spring/spring.xml]
at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:70)
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:118)
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:110)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.error(BeanDefinitionParserDelegate.java:301)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1407)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1400)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:172)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:142)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:94)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:508)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:392)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:181)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:217)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:252)
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:127)
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:93)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129)
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:614)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:515)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
at com.genlot.web.server.core.service.DubboConsumer.init(DubboConsumer.java:72)
at com.genlot.web.server.core.BaseServerInitializer.initChannel(BaseServerInitializer.java:59)
at com.genlot.web.server.core.BaseServerInitializer.initChannel(BaseServerInitializer.java:26)
at io.netty.channel.ChannelInitializer.initChannel(ChannelInitializer.java:129)
at io.netty.channel.ChannelInitializer.handlerAdded(ChannelInitializer.java:112)
at io.netty.channel.AbstractChannelHandlerContext.callHandlerAdded(AbstractChannelHandlerContext.java:969)
at io.netty.channel.DefaultChannelPipeline.callHandlerAdded0(DefaultChannelPipeline.java:610)
at io.netty.channel.DefaultChannelPipeline.access$100(DefaultChannelPipeline.java:46)
at io.netty.channel.DefaultChannelPipeline$PendingHandlerAddedTask.execute(DefaultChannelPipeline.java:1461)
at io.netty.channel.DefaultChannelPipeline.callHandlerAddedForAllHandlers(DefaultChannelPipeline.java:1126)
at io.netty.channel.DefaultChannelPipeline.invokeHandlerAddedIfNeeded(DefaultChannelPipeline.java:651)
at io.netty.channel.AbstractChannel$AbstractUnsafe.register0(AbstractChannel.java:515)
at io.netty.channel.AbstractChannel$AbstractUnsafe.access$200(AbstractChannel.java:428)
at io.netty.channel.AbstractChannel$AbstractUnsafe$1.run(AbstractChannel.java:487)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:405)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:906)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
[2020-02-13 13:49:16 下午]:ERROR com.genlot.common.utils.Logger.e(Logger.java:83)ERROR > Request URL[ Request{method=GET, url=http://127.0.0.1:54000/, tags={}} ] Cost[2192791301]
[2020-02-13 13:49:16 下午]:ERROR com.genlot.common.utils.Logger.e(Logger.java:85)java.io.IOException: unexpected end of stream on http://127.0.0.1:54000/...
java.io.IOException: unexpected end of stream on http://127.0.0.1:54000/...
at okhttp3.internal.http1.Http1ExchangeCodec.readResponseHeaders(Http1ExchangeCodec.java:233)
at okhttp3.internal.connection.Exchange.readResponseHeaders(Exchange.java:115)
at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:94)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:43)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:94)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:88)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:221)
at okhttp3.RealCall.execute(RealCall.java:81)
at com.genlot.common.utils.HTTPUtil.execute(HTTPUtil.java:61)
at com.genlot.web.server.core.BaseServer.start(BaseServer.java:96)
at cn.gov.cwl.vlt.channel.app.ChannelServerStarter.main(ChannelServerStarter.java:63)
Caused by: java.io.EOFException: \n not found: limit=0 content=…
at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:240)
at okhttp3.internal.http1.Http1ExchangeCodec.readHeaderLine(Http1ExchangeCodec.java:238)
at okhttp3.internal.http1.Http1ExchangeCodec.readResponseHeaders(Http1ExchangeCodec.java:213)
... 19 more
这个错误是跟打包方式有关,以Artifacts打成的jar,运行会出现这个错误。 这个工程需要用maven-assembly-plugin的方式打包。
改了打包方式后,运到了另外一个问题。
错误二:
2020-02-13 14:02:07 PM [Thread: epollEventLoopGroup-3-1][ Class:io.netty.channel.ChannelInitializer >> Method: io.netty.channel.ChannelInitializer.exceptionCaught(ChannelInitializer.java:97) ]
WARN:Failed to initialize a channel. Closing: [id: 0x07d55f5c, L:/127.0.0.1:54000 - R:/127.0.0.1:31466]
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.ProcessEnvironment$Variable
at java.lang.ProcessEnvironment$StringEntry.getKey(ProcessEnvironment.java:307)
at java.lang.ProcessEnvironment$StringEntry.getKey(ProcessEnvironment.java:302)
at java.util.AbstractMap.toString(AbstractMap.java:532)
at java.util.Collections$UnmodifiableMap.toString(Collections.java:1493)
at java.lang.String.valueOf(String.java:2994)
at java.lang.StringBuilder.append(StringBuilder.java:131)
at org.springframework.core.env.PropertySource.toString(PropertySource.java:158)
at java.lang.String.valueOf(String.java:2994)
at java.util.Arrays.toString(Arrays.java:4571)
at java.util.concurrent.CopyOnWriteArrayList.toString(CopyOnWriteArrayList.java:1011)
at org.springframework.core.env.MutablePropertySources.toString(MutablePropertySources.java:185)
at java.lang.String.valueOf(String.java:2994)
at java.lang.StringBuilder.append(StringBuilder.java:131)
at org.springframework.core.env.AbstractEnvironment.<init>(AbstractEnvironment.java:124)
at org.springframework.core.env.StandardEnvironment.<init>(StandardEnvironment.java:54)
at org.springframework.context.support.AbstractApplicationContext.createEnvironment(AbstractApplicationContext.java:316)
at org.springframework.context.support.AbstractApplicationContext.getEnvironment(AbstractApplicationContext.java:305)
at org.springframework.context.support.AbstractRefreshableConfigApplicationContext.resolvePath(AbstractRefreshableConfigApplicationContext.java:122)
at org.springframework.context.support.AbstractRefreshableConfigApplicationContext.setConfigLocations(AbstractRefreshableConfigApplicationContext.java:80)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:137)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
at com.genlot.web.server.core.service.DubboConsumer.init(DubboConsumer.java:72)
at com.genlot.web.server.core.BaseServerInitializer.initChannel(BaseServerInitializer.java:59)
at com.genlot.web.server.core.BaseServerInitializer.initChannel(BaseServerInitializer.java:26)
at io.netty.channel.ChannelInitializer.initChannel(ChannelInitializer.java:129)
at io.netty.channel.ChannelInitializer.handlerAdded(ChannelInitializer.java:112)
at io.netty.channel.AbstractChannelHandlerContext.callHandlerAdded(AbstractChannelHandlerContext.java:969)
at io.netty.channel.DefaultChannelPipeline.callHandlerAdded0(DefaultChannelPipeline.java:610)
at io.netty.channel.DefaultChannelPipeline.access$100(DefaultChannelPipeline.java:46)
at io.netty.channel.DefaultChannelPipeline$PendingHandlerAddedTask.execute(DefaultChannelPipeline.java:1461)
at io.netty.channel.DefaultChannelPipeline.callHandlerAddedForAllHandlers(DefaultChannelPipeline.java:1126)
at io.netty.channel.DefaultChannelPipeline.invokeHandlerAddedIfNeeded(DefaultChannelPipeline.java:651)
at io.netty.channel.AbstractChannel$AbstractUnsafe.register0(AbstractChannel.java:515)
at io.netty.channel.AbstractChannel$AbstractUnsafe.access$200(AbstractChannel.java:428)
at io.netty.channel.AbstractChannel$AbstractUnsafe$1.run(AbstractChannel.java:487)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:405)
at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:338)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:906)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:745)
2020-02-13 14:02:07 PM [Thread: main][ Class:com.genlot.common.utils.HTTPUtil >> Method: com.genlot.common.utils.Logger.e(Logger.java:83) ]
ERROR:ERROR > Request URL[ Request{method=GET, url=http://127.0.0.1:54000/, tags={}} ] Cost[142222570]
2020-02-13 14:02:07 PM [Thread: main][ Class:com.genlot.common.utils.HTTPUtil >> Method: com.genlot.common.utils.Logger.e(Logger.java:85) ]
ERROR:java.net.SocketException: Connection reset
最后解决这个问题是:删除了本地所有的依赖包,重新拉去一次,就可以了。
猜测是某个依赖jar版本不一致导致的。
现在问题已经解决了,能正常运行,和成功启动dubbo了。