Getting jakarta.servlet.ServletException: com.vaadin.flow.server.ServiceException: elemental.json.JsonException: Invalid literal: "? on @

hi, when attempting to use @JsModule("@vaadin/vaadin-lumo-styles/presets/compact.js") , on any layout i keep getting the below exceptions:
i’ve initially copy-pasted this from other sources , but i’ve also tried to re-type in manually , but i still get the same problem.

jakarta.servlet.ServletException: com.vaadin.flow.server.ServiceException: elemental.json.JsonException: Invalid literal: "?"
	at com.vaadin.flow.server.VaadinServlet.service(VaadinServlet.java:400)
	at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:587)
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:764)
	at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1665)
	at org.eclipse.jetty.websocket.servlet.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:170)
	at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
	at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:527)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:131)
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:578)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:223)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1570)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:221)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1382)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:176)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:484)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1543)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:174)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1304)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:129)
	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:149)
	at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:51)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
	at org.eclipse.jetty.server.Server.handle(Server.java:563)
	at org.eclipse.jetty.server.HttpChannel.lambda$handle$0(HttpChannel.java:505)
	at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:762)
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:497)
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:282)
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:314)
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:100)
	at org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:53)
	at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.runTask(AdaptiveExecutionStrategy.java:416)
	at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:385)
	at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:272)
	at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.lambda$new$0(AdaptiveExecutionStrategy.java:140)
	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:411)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:936)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1080)
	at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: com.vaadin.flow.server.ServiceException: elemental.json.JsonException: Invalid literal: "?"
	at com.vaadin.flow.server.VaadinService.handleExceptionDuringRequest(VaadinService.java:1635)
	at com.vaadin.flow.server.VaadinService.handleRequest(VaadinService.java:1586)
	at com.vaadin.flow.server.VaadinServlet.service(VaadinServlet.java:398)
	... 39 more
Caused by: elemental.json.JsonException: Invalid literal: "?"
	at elemental.json.impl.JsonTokenizer.getValueForLiteral(JsonTokenizer.java:312)
	at elemental.json.impl.JsonTokenizer.nextValue(JsonTokenizer.java:177)
	at elemental.json.impl.JreJsonFactory.parse(JreJsonFactory.java:64)
	at elemental.json.Json.parse(Json.java:53)
	at com.vaadin.flow.server.frontend.TaskInstallFrontendBuildPlugins.generatePluginFiles(TaskInstallFrontendBuildPlugins.java:94)
	at com.vaadin.flow.server.frontend.TaskInstallFrontendBuildPlugins.lambda$execute$0(TaskInstallFrontendBuildPlugins.java:65)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at com.vaadin.flow.server.frontend.TaskInstallFrontendBuildPlugins.execute(TaskInstallFrontendBuildPlugins.java:63)
	at com.vaadin.flow.server.frontend.NodeTasks.execute(NodeTasks.java:342)
	at com.vaadin.base.devserver.startup.DevModeInitializer.runNodeTasks(DevModeInitializer.java:354)
	at com.vaadin.base.devserver.startup.DevModeInitializer.lambda$initDevModeHandler$0(DevModeInitializer.java:295)
	at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run$$$capture(CompletableFuture.java:1804)
	at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java)
	at java.base/java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1796)
	at java.base/java.util.concurrent.ForkJoinTask.doExec$$$capture(ForkJoinTask.java:373)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)

For me it just works: https://v-herd.eu/tatulund-addons/beantable

You may have @Theme missing, that must be defined as compact mode is building on top of Lumo theme.

@SpringBootApplication
@Theme(value = "myapp")
@JsModule("@vaadin/vaadin-lumo-styles/presets/compact.js")
public class Application extends SpringBootServletInitializer
        implements AppShellConfigurator {

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
}
1 Like

That particular code tries to read a package.json file from target/plugins/something/package.json. So maybe mvn clean or check what is in the package.json file in target/plugins

tried clean didn’t work, the target folder contains several plugins among them application-theme-plugin

but i’m not using springboot