zengkid / SmartTomcat

The Tomcat plugin for Intellij IDEA
Apache License 2.0
126 stars 55 forks source link

Bug with SmartTomcat 4.3.1 - Cannot create temporary files #90

Closed polilluminato closed 2 years ago

polilluminato commented 2 years ago

Hi @zengkid from the version 4.3.1 of SmartTomcat when my Spring application starts I see this warning in console:

22-Aug-2022 14:29:02.444 AVVERTENZA [main] org.glassfish.jersey.media.multipart.internal.MultiPartReaderClientSide.createMimeConfig Cannot create temporary files. Multipart attachments will be limited to "4.096" bytes.
    java.io.IOException: File o directory non esistente
        at java.base/java.io.UnixFileSystem.createFileExclusively(Native Method)
        at java.base/java.io.File.createTempFile(File.java:2129)
        at org.glassfish.jersey.media.multipart.internal.MultiPartReaderClientSide.createMimeConfig(MultiPartReaderClientSide.java:119)
        at org.glassfish.jersey.media.multipart.internal.MultiPartReaderClientSide.<init>(MultiPartReaderClientSide.java:101)
        at org.glassfish.jersey.media.multipart.internal.MultiPartReaderServerSide.<init>(MultiPartReaderServerSide.java:57)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
        at org.glassfish.hk2.utilities.reflection.ReflectionHelper.makeMe(ReflectionHelper.java:1356)
        at org.jvnet.hk2.internal.ClazzCreator.createMe(ClazzCreator.java:248)
        at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:342)
        at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:463)
        at org.jvnet.hk2.internal.SingletonContext$1.compute(SingletonContext.java:59)
        at org.jvnet.hk2.internal.SingletonContext$1.compute(SingletonContext.java:47)
        at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture$1.call(Cache.java:74)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture.run(Cache.java:131)
        at org.glassfish.hk2.utilities.cache.Cache.compute(Cache.java:176)
        at org.jvnet.hk2.internal.SingletonContext.findOrCreate(SingletonContext.java:98)
        at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2102)
        at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:93)
        at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:67)
        at org.glassfish.jersey.inject.hk2.AbstractHk2InjectionManager.lambda$getAllServiceHolders$0(AbstractHk2InjectionManager.java:136)
        at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
        at java.base/java.util.LinkedList$LLSpliterator.forEachRemaining(LinkedList.java:1239)
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
        at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
        at org.glassfish.jersey.inject.hk2.AbstractHk2InjectionManager.getAllServiceHolders(AbstractHk2InjectionManager.java:140)
        at org.glassfish.jersey.inject.hk2.ImmediateHk2InjectionManager.getAllServiceHolders(ImmediateHk2InjectionManager.java:30)
        at org.glassfish.jersey.internal.inject.Providers.getServiceHolders(Providers.java:307)
        at org.glassfish.jersey.internal.inject.Providers.getCustomProviders(Providers.java:151)
        at org.glassfish.jersey.message.internal.MessageBodyFactory.initialize(MessageBodyFactory.java:219)
        at org.glassfish.jersey.message.internal.MessageBodyFactory$MessageBodyWorkersConfigurator.postInit(MessageBodyFactory.java:114)
        at org.glassfish.jersey.server.ApplicationHandler.lambda$initialize$2(ApplicationHandler.java:353)
        at java.base/java.util.Arrays$ArrayList.forEach(Arrays.java:4390)
        at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:353)
        at org.glassfish.jersey.server.ApplicationHandler.lambda$initialize$1(ApplicationHandler.java:297)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:292)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:274)
        at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:232)
        at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:296)
        at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:261)
        at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:311)
        at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:154)
        at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:347)
        at javax.servlet.GenericServlet.init(GenericServlet.java:158)
        at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1164)
        at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1117)
        at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1010)
        at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4957)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5264)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:726)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:698)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:696)
        at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:690)
        at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1889)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
        at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:118)
        at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:583)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:473)
        at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1618)
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:319)
        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
        at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:423)
        at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:366)
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:946)
        at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:835)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1396)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1386)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
        at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:919)
        at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:265)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.StandardService.startInternal(StandardService.java:432)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:772)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:345)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:476)

My versions:

With previuos version of SmartTomcat I had not this warning.

Intellij & SmartTomcat Version

IntelliJ IDEA 2022.2.1 (Community Edition)
Build #IC-222.3739.54, built on August 16, 2022
Runtime version: 17.0.3+7-b469.37 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 5.15.0-46-generic
GC: G1 Young Generation, G1 Old Generation
Memory: 1940M
Cores: 8
Non-Bundled Plugins:
    idea.plugin.protoeditor (222.3739.24)
    com.vermouthx.idea (1.13.3)
    com.samdark.intellij-visual-studio-code-dark-plus (2.6)
    com.poratu.idea.plugins.tomcat (4.3.1)
    com.mallowigi (70.0.0)
    GenerateSerialVersionUID (3.0.3)
    Docker (222.3739.64)
    Dart (222.3739.24)
    io.flutter (69.0.5)

Kotlin: 222-1.7.10-release-334-IJ3739.54
Current Desktop: ubuntu:GNOME
yuezk commented 2 years ago

I found the root cause and will fix it soon.

yuezk commented 2 years ago

Fixed in 4.3.2, waiting for the approval, will be available tomorrow.

polilluminato commented 2 years ago

Fixed in 4.3.2, waiting for the approval, will be available tomorrow.

I saw your commit e4407557177f7944fe2938e40d17e4d933627abe and I'm waiting for the plugin update on IntelliJ. Thanks a lot @yuezk

yuezk commented 2 years ago

Yes. The workaround is to create the temp folder manually under the ~/.SmartTomcat/<project_name>/<module_name>/ folder.