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

NPE in AnnotatedEndpoint with version 2.0.0 when no ServerEndpoint is configured #724

Open
apupier opened this issue Dec 3, 2020 · 1 comment
Labels
enhancement New feature or request Error-Handling

Comments

@apupier
Copy link

apupier commented Dec 3, 2020

I tried to migrate from previous version to 2.0.0, I replaced all javax.websocket to jakarta.websocket and I'm hitting this NPE:

[java.lang.NullPointerException
	at org.glassfish.tyrus.core.AnnotatedEndpoint.<init>(AnnotatedEndpoint.java:166)
	at org.glassfish.tyrus.core.AnnotatedEndpoint.fromClass(AnnotatedEndpoint.java:117)
	at org.glassfish.tyrus.core.TyrusWebSocketEngine.register(TyrusWebSocketEngine.java:647)
	at org.glassfish.tyrus.container.grizzly.server.GrizzlyServerContainer$1.register(GrizzlyServerContainer.java:136)
	at org.glassfish.tyrus.server.TyrusServerContainer.start(TyrusServerContainer.java:116)
	at org.glassfish.tyrus.container.grizzly.server.GrizzlyServerContainer$1.start(GrizzlyServerContainer.java:200)
	at org.glassfish.tyrus.server.Server.start(Server.java:205)
	at com.github.cameltooling.lsp.internal.websocket.WebSocketRunner.runWebSocketServer(WebSocketRunner.java:43)
	at com.github.cameltooling.lsp.internal.Runner.main(Runner.java:63)
	at com.github.cameltooling.lsp.internal.RunnerWebSocketTest$2.run(RunnerWebSocketTest.java:128)
	at java.base/java.lang.Thread.run(Thread.java:834)](url)

Here is the branch that I'm using https:/apupier/camel-language-server/tree/tyrus.version-2.0.0-bugreport

Here is my ServerApplicationConfig class:

package com.github.cameltooling.lsp.internal.websocket;

import java.util.Collections;
import java.util.Set;

import jakarta.websocket.Endpoint;
import jakarta.websocket.server.ServerApplicationConfig;
import jakarta.websocket.server.ServerEndpointConfig;

public class CamelLSPWebSocketServerConfigProvider implements ServerApplicationConfig {

	private static final String WEBSOCKET_CAMEL_SERVER_PATH = "/camel-language-server";

	@Override
	public Set<ServerEndpointConfig> getEndpointConfigs(Set<Class<? extends Endpoint>> endpointClasses) {
		ServerEndpointConfig conf = ServerEndpointConfig.Builder.create(CamelLSPWebSocketEndpoint.class, WEBSOCKET_CAMEL_SERVER_PATH).build();
		return Collections.singleton(conf);
	}

	@Override
	public Set<Class<?>> getAnnotatedEndpointClasses(Set<Class<?>> scanned) {
		return scanned;
	}

}
@apupier apupier changed the title NPE in AnnotatedEndpoint NPE in AnnotatedEndpoint with version 2.0.0 Dec 3, 2020
@apupier
Copy link
Author

apupier commented Dec 3, 2020

the NPE is cause because the creation fo the configuration endpoitnConfig is failing. There is an error because my ServerEndpoint was still using javax.* (but cannot change directly as it is inherited from another library)

SO there is a problem of configuration but it woudl be nice to avoid the NPE so that the ErrorCollector can deliver what the issue is.

@jansupol jansupol added enhancement New feature or request Error-Handling labels Dec 3, 2020
@apupier apupier changed the title NPE in AnnotatedEndpoint with version 2.0.0 NPE in AnnotatedEndpoint with version 2.0.0 when no ServerEndpoint is configured Dec 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Error-Handling
Projects
None yet
Development

No branches or pull requests

2 participants