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

[BUG] NPE in Hilla engine when accidentally trying to start project that has been built for production #2591

Open
mvysny opened this issue Jul 3, 2024 · 2 comments

Comments

@mvysny
Copy link
Member

mvysny commented Jul 3, 2024

Description of the Bug

I built the app using mvn -C clean package -Pproduction, then I tried to run it in my IDE to continue development. A silly mistake on my side, sure, but Hilla could be more forgiving than throwing

Caused by: java.lang.NullPointerException: Cannot invoke "java.nio.file.Path.resolve(String)" because "configDir" is null
	at com.vaadin.hilla.engine.EngineConfiguration.loadDirectory(EngineConfiguration.java:54)

Expected Behavior

Hilla could print "Rebuild the app in dev mode" or similar.

Minimal Reproducible Example

  1. Open the skeleton-starter-flow-spring project in Intellij
  2. Build it in production mode: mvn -C clean package -Pproduction
  3. Run it in dev mode from IDEA: run Application.main(), with hotswap agent enabled as per Copilot's instructions (the hotswap fat jar enabled etc)

The following exception is thrown, preventing Copilot from starting:

HOTSWAP AGENT: 09:47:50.539 ERROR (org.hotswap.agent.command.ReflectionCommand) - Error executin method onHotswap in class com.vaadin.hilla.Hotswapper
java.lang.reflect.InvocationTargetException
	at jdk.internal.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.hotswap.agent.command.ReflectionCommand.doExecuteReflectionCommand(ReflectionCommand.java:207)
	at org.hotswap.agent.command.ReflectionCommand.executeCommand(ReflectionCommand.java:168)
	at org.hotswap.agent.command.impl.CommandExecutor.run(CommandExecutor.java:43)
Caused by: java.lang.NullPointerException: Cannot invoke "java.nio.file.Path.resolve(String)" because "configDir" is null
	at com.vaadin.hilla.engine.EngineConfiguration.loadDirectory(EngineConfiguration.java:54)
	at com.vaadin.hilla.OpenAPIUtil.getCurrentOpenAPIPath(OpenAPIUtil.java:65)
	at com.vaadin.hilla.EndpointCodeGenerator.getClassesUsedInOpenApi(EndpointCodeGenerator.java:127)
	at com.vaadin.hilla.Hotswapper.affectsEndpoints(Hotswapper.java:106)
	at com.vaadin.hilla.Hotswapper.onHotswap(Hotswapper.java:39)
	... 6 more

Versions

  • Vaadin Flow/Hilla Framework Version: 24.4.4
  • Copilot Version: 24.4.3
@Artur-
Copy link
Member

Artur- commented Jul 3, 2024

Is this a Hilla problem or is there any connection to Copilot?

@mvysny
Copy link
Member Author

mvysny commented Jul 3, 2024

Could be pure Hilla problem; I saw Hotswap Agent in the stacktrace and immediately made a (maybe premature) connection to Copilot. Feel free to move the ticket to Hilla github repo if needed.

@Artur- Artur- transferred this issue from vaadin/copilot Jul 3, 2024
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

2 participants