AndServer
AndServer copied to clipboard
The resource [/xxxxx] is not found.
@Controller
class Controller {
@RequestMapping(
path = "/connection",
method = {RequestMethod.GET},
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
Object getConnection(HttpRequest request) {
Map<String, Object> map = new HashMap<>();
map.put("getLocalAddr", request.getLocalAddr());
map.put("getLocalName", request.getLocalName());
map.put("getLocalPort", request.getLocalPort());
map.put("getRemoteAddr", request.getRemoteAddr());
map.put("getRemoteHost", request.getRemoteHost());
map.put("getRemotePort", request.getRemotePort());
//Logger.i(JSON.toJSONString(map));
return map;
}
}
http://192.168.0.100:8899/connection return
The resource [/connection] is not found.
anything i missed?thx
INFO: andserver 2.1.9 jdk-1.8.0_292
Did this error occur when running the sample? If not, you can run the sample to have a try
我也遇到了类似的情况,之前代码还能正常运行,在我升级了Android Studio
至4.2.1
版本后注解编译器就无法正常生成代码了。
> Task :app:kaptDebugKotlin
[WARN] Can't find annotation processor class com.yanzhenjie.andserver.processor.ControllerProcessor: javax/activation/MimeTypeParseException
经过反复排查,发现.idea/misc.xml
中的配置自动改为了languageLevel="JDK_11"
,.idea/compiler.xml
中的配置自动改为了<bytecodeTargetLevel target="11" />
。
但同样的环境下android-Room库是可以正常生成代码的kapt "androidx.room:room-compiler:2.3.0"
目前未找到配置文件修改的原因及恢复的方法,需要有解决的同学能提供些方法。
@Yooi
问题已解决,这个问题应该是Andserver没有适配jdk11而导致的,jdk11中没有MimeTypeParseException
类,所以com.yanzhenjie.andserver.processor.ControllerProcessor
无法正常生成Controller的代码,最终导致我们写的接口没有添加到服务器中。
在配置文件中添加以下代码后可以正常使用
implementation 'javax.activation:javax.activation-api:1.2.0'
You should include javax.activation:javax.activation-api:1.2.0 as an external dependency to your project to explicitly access the class javax.activation.DataSource.
javax.activation:javax.activation-api:1.2.0 is not a module, so requires java.activation has no meaning. In Java 9 and 10, you can use requires java.activation or --add-modules java.activation instead of including the dependency. In Java 11+ the module doesn't exist in the JDK anymore, so requires java.activation won't work there.
https://stackoverflow.com/questions/52921879/migration-to-jdk-11-has-error-occure-java-lang-noclassdeffounderror-javax-acti
@bonepeople 添加了这个库
还是
Unable to load class 'javax.activation.MimeTypeParseException'.
This is an unexpected error. Please file a bug containing the idea.log file.
我看这个库里确实也没有这个文件啊。。?
@bonepeople 添加了这个库
还是
Unable to load class 'javax.activation.MimeTypeParseException'.
This is an unexpected error. Please file a bug containing the idea.log file.
我看这个库里确实也没有这个文件啊。。?
我们的工程都是可以正常编译过去的,只是应该通过注解生成的代码没有正常生成,看你这个报错应该是编译的时候就终止了,和我们遇到的情况不同,建议你从其他方面查找一下原因。
我是android studio升级到Arctic Fox 2020.3.1出现该问题。有知道解决方案的吗?
经过我一上午的尝试,发现Arctic Fox版本有问题,无论我怎么修改jdk为OracleJDK,但实际上是openJDk。
希望作者能在:processor的module里依赖下。@yanzhenjie
implementation 'javax.activation:javax.activation-api:1.2.0'
遇到了同样的问题,添加了implementation 'javax.activation:javax.activation-api:1.2.0'依然不行 项目用的是jdk11,没法去改变了,什么时候适配一下jdk11?
更新到了2.1.10我还是遇到了这个问题,我写了个demo是没问题的,但是容到项目里网页就显示The resource [/] is not found. 然后不动代码的情况下我把版本退到2.1.9又正常了。