Uploaded image for project: 'Undertow'
  1. Undertow
  2. UNDERTOW-1582

DeploymentInfo use the field tempDir before setting

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor Minor
    • 2.0.26.Final
    • 2.0.17.Final, 2.0.21.Final
    • Servlet
    • None
    • Hide

      In Windows,I use spring.servlet.multipart.location=/opt/jar-application-dir
      And then io.undertow.servlet.core.ManagedServlet Line 75 , will return false.then in line 78 will throw the NullPointException. The reason is field tempDir was null.

      In Linux, I use spring.servlet.multipart.location=C://jar-application-dir
      And then io.undertow.servlet.core.ManagedServlet Line 75 , will return false.then in line 78 will throw the NullPointException. The reason is field tempDir was null.

      Seem like the Method Path.isAbsolute() can not recognize diffrent OS file system. and then UndertowServletWebServerFactory.createDeploymentManager() didn't init the field tempDir

      Show
      In Windows,I use spring.servlet.multipart.location=/opt/jar-application-dir And then io.undertow.servlet.core.ManagedServlet Line 75 , will return false.then in line 78 will throw the NullPointException. The reason is field tempDir was null. In Linux, I use spring.servlet.multipart.location=C://jar-application-dir And then io.undertow.servlet.core.ManagedServlet Line 75 , will return false.then in line 78 will throw the NullPointException. The reason is field tempDir was null. Seem like the Method Path.isAbsolute() can not recognize diffrent OS file system. and then UndertowServletWebServerFactory.createDeploymentManager() didn't init the field tempDir
    • Compatibility/Configuration
    • Roiocam

      I am using Spring Boot undertow construct upload file class, the configuration of the 'spring.servlet.multipart.location' attributes, when the attribute value and the current environment is not configured at the same time, the undertow ManagedServlet setupMultipart method to obtain the 'servletContext.getDeployment().getDeploymentInfo().getTempPath()' returns value. But this method doesn't seem to return the correct value.

      This is exception stacktrace :

      [restartedMain] ERROR org.springframework.boot.SpringApplication.reportFailure:858 - Application run failed
      org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is java.lang.RuntimeException: java.lang.NullPointerException
      	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:157)
      	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)
      	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142)
      	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775)
      	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
      	at org.springframework.boot.SpringApplication.run(SpringApplication.java:316)
      	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260)
      	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248)
      	at com.offerslook.api.*****Application.main(*****Application.java:22)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
      Caused by: java.lang.RuntimeException: java.lang.NullPointerException
      	at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:252)
      	at org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory.createDeploymentManager(UndertowServletWebServerFactory.java:284)
      	at org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory.getWebServer(UndertowServletWebServerFactory.java:208)
      	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:181)
      	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:154)
      	... 13 common frames omitted
      Caused by: java.lang.NullPointerException: null
      	at io.undertow.servlet.core.ManagedServlet.setupMultipart(ManagedServlet.java:107)
      	at io.undertow.servlet.spec.ServletRegistrationImpl.setMultipartConfig(ServletRegistrationImpl.java:117)
      	at org.springframework.boot.web.servlet.ServletRegistrationBean.configure(ServletRegistrationBean.java:201)
      	at org.springframework.boot.web.servlet.ServletRegistrationBean.configure(ServletRegistrationBean.java:51)
      	at org.springframework.boot.web.servlet.DynamicRegistrationBean.register(DynamicRegistrationBean.java:115)
      	at org.springframework.boot.web.servlet.RegistrationBean.onStartup(RegistrationBean.java:54)
      	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.selfInitialize(ServletWebServerApplicationContext.java:235)
      	at org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory$Initializer.onStartup(UndertowServletWebServerFactory.java:616)
      	at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:203)
      	at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:185)
      	at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42)
      	at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
      	at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:250)
      	... 17 common frames omitted
      

              flaviarnn Flavia Rainone
              roiocam Andy Chen (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: