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

AppJoint.service 报错,routersMap是空的 #43

Open
tianyingzhong opened this issue Nov 2, 2021 · 0 comments
Open

AppJoint.service 报错,routersMap是空的 #43

tianyingzhong opened this issue Nov 2, 2021 · 0 comments

Comments

@tianyingzhong
Copy link

W/System.err:java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object java.lang.Class.newInstance()' on a null object reference
W/System.err: at io.github.prototypez.appjoint.AppJoint.service(AppJoint.java:86)
W/System.err: at io.github.prototypez.appjoint.AppJoint.service(AppJoint.java:79)
debug发现routersMap是空的

public static synchronized <T> T service(Class<T> routerType, String name) {
    T requiredRouter = (T) get().getRouterInstanceMap().get(routerType, name);
    if (requiredRouter == null) {
        try {
            requiredRouter = (T) get().routersMap.get(routerType, name).newInstance();
            get().getRouterInstanceMap().put(routerType, name, requiredRouter);
        } catch (Throwable throwable) {
            throwable.printStackTrace();
        }
    }
    return requiredRouter;
}
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

1 participant