Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

examples中的tars-spring-boot-server运行时报错 #54

Closed
deepzliu opened this issue Dec 1, 2019 · 4 comments
Closed

examples中的tars-spring-boot-server运行时报错 #54

deepzliu opened this issue Dec 1, 2019 · 4 comments

Comments

@deepzliu
Copy link

deepzliu commented Dec 1, 2019

各位大佬,tars-spring-boot-server运行时报错。看起来像是按tars协议处理了,应该是走非tars协议才对。求帮忙看下,谢谢!

代码:
`package com.qq.tars.quickstart.server;
import com.qq.tars.server.core.ContextManager;
import com.qq.tars.spring.annotation.EnableTarsServer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import com.qq.tars.spring.annotation.TarsHttpService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
@EnableTarsServer
@TarsHttpService("HttpObj")
@RestController
public class QuickStartApplication {
public static void main(String[] args) {
SpringApplication.run(QuickStartApplication.class, args);
}
@RequestMapping(path = "/test")
public String test() {
return "hello world";
}
}`

启动时有报这个错,但能正常启动,端口监听也正常。
Exception in thread "ServantThreadPool-exec-null-1" java.lang.NoClassDefFoundError: com/qq/tars/server/core/ContextManager at com.qq.tars.server.core.TarsServantProcessor.process(TarsServantProcessor.java:180) at com.qq.tars.net.core.nio.WorkThread.run(WorkThread.java:80) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.ClassNotFoundException: com.qq.tars.server.core.ContextManager at java.net.URLClassLoader.findClass(URLClassLoader.java:382) at java.lang.ClassLoader.loadClass(ClassLoader.java:418) at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:92) at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ... 5 more

收到http请求后,服务报的错如下。看起来像是按tars协议处理了,应该是走非tars协议才对。
com.qq.tars.net.protocol.ProtocolException: the length header of the package must be between 0~10M bytes. data length:504f5350 at com.qq.tars.rpc.protocol.tars.TarsCodec.decodeRequest(TarsCodec.java:254) at com.qq.tars.net.core.nio.TCPSession.readRequest(TCPSession.java:119) at com.qq.tars.net.core.nio.TCPSession.read(TCPSession.java:97) at com.qq.tars.net.core.nio.TCPAcceptor.handleReadEvent(TCPAcceptor.java:77) at com.qq.tars.net.core.nio.Reactor.dispatchEvent(Reactor.java:183) at com.qq.tars.net.core.nio.Reactor.run(Reactor.java:104)

@TimmyYu
Copy link
Contributor

TimmyYu commented Dec 16, 2019

这个需要理提供一下平台上面servant的配置。平台上HttpObj的配置类型是否你正常。再提供一下tras的版本

@deepzliu
Copy link
Author

deepzliu commented Dec 17, 2019

版本应该是:1.7.0-SNAPSHOT,我把commit记下来了:

  1. https://github.com/TarsCloud/Tars.git: commit dc25e1e84d9fab4c2329882302c2d9ba05af0386
  2. https://github.com/TarsCloud/TarsFramework.git: commit 66016df55aae0513b2aa92f77b7f8060449926c6
  3. https://github.com/TarsCloud/TarsWeb.git: commit c73db149314a1a8fd9f2e7250f54a94c7888dbfd

另外,项目的pom.xml里有个parent的tars-examples版本必须是1.6.1才能编译通过,其它依赖的tars库都是1.7.0-SNAPSHOT,不知道是否有影响。

详细配置如下:

微信图片_20191217081506
微信图片_20191217081513
democgi-conf

@TimmyYu
Copy link
Contributor

TimmyYu commented Jan 9, 2020

依赖需要都使用1.7.0。里面的日志库两个版本中并不通用。所以依赖需要使用新版本的依赖库才可以

@TimmyYu TimmyYu closed this as completed Sep 8, 2020
@duanyongyao
Copy link

遇到同样问题
tars框架版本是1.0.1
tars-spring-boot-starter的版本是1.7.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants