AndServer icon indicating copy to clipboard operation
AndServer copied to clipboard

The resource [/xxxxx] is not found.

Open Yooi opened this issue 3 years ago • 9 comments

@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

Yooi avatar Jun 18 '21 06:06 Yooi

Did this error occur when running the sample? If not, you can run the sample to have a try

yanzhenjie avatar Jun 20 '21 05:06 yanzhenjie

我也遇到了类似的情况,之前代码还能正常运行,在我升级了Android Studio4.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"

目前未找到配置文件修改的原因及恢复的方法,需要有解决的同学能提供些方法。

bonepeople avatar Jun 23 '21 06:06 bonepeople

@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 avatar Jun 23 '21 09:06 bonepeople

@bonepeople 添加了这个库

还是

Unable to load class 'javax.activation.MimeTypeParseException'.

This is an unexpected error. Please file a bug containing the idea.log file.

我看这个库里确实也没有这个文件啊。。?

LxzBUG avatar Aug 25 '21 08:08 LxzBUG

@bonepeople 添加了这个库

还是

Unable to load class 'javax.activation.MimeTypeParseException'.

This is an unexpected error. Please file a bug containing the idea.log file.

我看这个库里确实也没有这个文件啊。。?

我们的工程都是可以正常编译过去的,只是应该通过注解生成的代码没有正常生成,看你这个报错应该是编译的时候就终止了,和我们遇到的情况不同,建议你从其他方面查找一下原因。

bonepeople avatar Aug 30 '21 02:08 bonepeople

我是android studio升级到Arctic Fox 2020.3.1出现该问题。有知道解决方案的吗?

tydqcjj avatar Oct 13 '21 03:10 tydqcjj

经过我一上午的尝试,发现Arctic Fox版本有问题,无论我怎么修改jdk为OracleJDK,但实际上是openJDk。 image

希望作者能在:processor的module里依赖下。@yanzhenjie implementation 'javax.activation:javax.activation-api:1.2.0' image

tydqcjj avatar Oct 13 '21 06:10 tydqcjj

遇到了同样的问题,添加了implementation 'javax.activation:javax.activation-api:1.2.0'依然不行 项目用的是jdk11,没法去改变了,什么时候适配一下jdk11?

LiZhuoFan avatar Jan 04 '22 09:01 LiZhuoFan

更新到了2.1.10我还是遇到了这个问题,我写了个demo是没问题的,但是容到项目里网页就显示The resource [/] is not found. 然后不动代码的情况下我把版本退到2.1.9又正常了。

1499320204 avatar Mar 24 '22 06:03 1499320204