Soap spring boot wsdl generated app fails with 404 no message available - maven
What I am using:
netbeans 8.2
spring boot
Maven 4.0
tomcat 8.5
Here is the POM file:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>demo-sem-ds</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>demoSemDs</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.9.RELEASE</version>
<relativePath/>
<!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web-services</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<!--<scope>provided</scope>-->
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
</configuration>
</plugin>
<plugin>
<groupId>org.jvnet.jax-ws-commons</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<wsdlFiles>
<wsdlFile>tissSolicitacaoProcedimentoV3_03_02.wsdl</wsdlFile>
</wsdlFiles>
<vmArgs>
<vmArg>-Djavax.xml.accessExternalSchema=all</vmArg>
</vmArgs>
<staleFile>${project.build.directory}/jaxws/stale/tissSolicitacaoProcedimentoV3_03_02.stale</staleFile>
</configuration>
<id>wsimport-generate-tissSolicitacaoProcedimentoV3_03_02</id>
<phase>generate-sources</phase>
</execution>
<!--<execution>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<wsdlFiles>
<wsdlFile>tissSolicitacaoProcedimentoV3_03_02.wsdl</wsdlFile>
</wsdlFiles>
<vmArgs>
<vmArg>-Djavax.xml.accessExternalSchema=all</vmArg>
</vmArgs>
<staleFile>${project.build.directory}/jaxws/stale/tissSolicitacaoProcedimentoV3_03_02_1.stale</staleFile>
</configuration>
<id>wsimport-generate-tissSolicitacaoProcedimentoV3_03_02_1</id>
<phase>generate-sources</phase>
</execution>-->
</executions>
<dependencies>
<dependency>
<groupId>javax.xml</groupId>
<artifactId>webservices-api</artifactId>
<version>2.0</version>
</dependency>
</dependencies>
<configuration>
<sourceDestDir>${project.build.directory}/generated-sources/jaxws-wsimport</sourceDestDir>
<xnocompile>true</xnocompile>
<verbose>true</verbose>
<extension>true</extension>
<catalog>${basedir}/src/jax-ws-catalog.xml</catalog>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<!--<version>2.0.2</version>-->
<configuration>
<webResources>
<resource>
<directory>src</directory>
<targetPath>WEB-INF</targetPath>
<includes>
<include>jax-ws-catalog.xml</include>
<include>wsdl/**</include>
</includes>
</resource>
</webResources>
</configuration>
</plugin>
</plugins>
</build>
</project>
Here are my generated classes for the webservice:
Application:
package com.example.demosemds;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
#SpringBootApplication
public class DemoSemDsApplication {
public static void main(String[] args) {
SpringApplication.run(DemoSemDsApplication.class, args);
}
}
Servlet:
package com.example.demosemds;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
public class ServletInitializer extends SpringBootServletInitializer {
#Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(DemoSemDsApplication.class);
}
}
WebService Operation:
package com.example.demosemds;
import br.gov.ans.padroes.tiss.schemas.StTissFault;
import br.gov.ans.padroes.tiss.schemas.TissFaultWS;
import br.gov.ans.tiss.ws.tipos.tisssolicitacaoprocedimento.v30302.TissFault;
import javax.jws.WebService;
/**
*
* #author chris
*/
#WebService(serviceName = "tissSolicitacaoProcedimento", portName = "tissSolicitacaoProcedimento_Port", endpointInterface = "br.gov.ans.tiss.ws.tipos.tisssolicitacaoprocedimento.v30302.TissSolicitacaoProcedimentoPortType", targetNamespace = "http://www.ans.gov.br/tiss/ws/tipos/tisssolicitacaoprocedimento/v30302", wsdlLocation = "WEB-INF/wsdl/tissSolicitacaoProcedimentoV3_03_02.wsdl")
public class DemoSemDsWSFromWSDL {
public br.gov.ans.padroes.tiss.schemas.AutorizacaoProcedimentoWS tissSolicitacaoProcedimentoOperation(br.gov.ans.padroes.tiss.schemas.SolicitacaoProcedimentoWS solicitacaoProcedimento) throws TissFault {
//TODO implement this method
//throw new UnsupportedOperationException("Not implemented yet.");
TissFaultWS tissFaultWS = new TissFaultWS();
tissFaultWS.setTissFault(StTissFault.HASH_INVALIDO);
throw new TissFault("Something at last!", tissFaultWS);
}
}
When I run this it deploys to the tomcat server on port 8090. But when I call it on localhost:8090/demo-sem-ds I just get the Whitelabel Error Page: There was an unexpected error (type=Not Found, status=404). No message available.
I don't know if it's related, but I also get an INFO message in the tomcat log when running the application saying: org.apache.catalina.core.ApplicationContext.log 2 Spring WebApplicationInitializers detected on classpath.
I have searched the internet, mainly StackOverflow, to try and find a definitive answer, but so far I haven't had any luck.
I would be most grateful if anyone can help me. Please let me know if there is anything extra I can add to the question.
Thanks,
Update 1:
Sorry about replying like this. I ran out of characters in the question.
I saw in this link that #markwatsonatx suggested that Mapped "{[/demo-sem-ds]}" should be somewhere in the log. However, I can't find it in my tomcat output.
Here's the tomcat output just when running the project:
10-Jan-2018 17:02:30.431 INFORMAÇÕES [http-nio-8090-exec-35] org.apache.catalina.startup.HostConfig.deployDescriptor Deploying configuration descriptor [C:\Program Files\Apache Software Foundation\Tomcat 8.5\conf\Catalina\localhost\demo-sem-ds.xml]
10-Jan-2018 17:02:44.330 INFORMAÇÕES [http-nio-8090-exec-35] com.sun.xml.ws.transport.http.servlet.WSServletDelegate.<init> WSSERVLET14: Inicializando servlet de JAX-WS
17:02:45.307 [http-nio-8090-exec-35] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Adding PropertySource 'servletConfigInitParams' with lowest search precedence
17:02:45.323 [http-nio-8090-exec-35] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Adding PropertySource 'servletContextInitParams' with lowest search precedence
17:02:45.347 [http-nio-8090-exec-35] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Adding PropertySource 'jndiProperties' with lowest search precedence
17:02:45.347 [http-nio-8090-exec-35] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Adding PropertySource 'systemProperties' with lowest search precedence
17:02:45.347 [http-nio-8090-exec-35] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Adding PropertySource 'systemEnvironment' with lowest search precedence
17:02:45.347 [http-nio-8090-exec-35] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Initialized StandardServletEnvironment with PropertySources [StubPropertySource#927279822 {name='servletConfigInitParams', properties=java.lang.Object#69dde978}, StubPropertySource#166873606 {name='servletContextInitParams', properties=java.lang.Object#1b7de455}, JndiPropertySource#99663534 {name='jndiProperties', properties=org.springframework.jndi.JndiLocatorDelegate#3e00141}, MapPropertySource#408537409 {name='systemProperties', properties={java.vendor=Oracle Corporation, sun.java.launcher=SUN_STANDARD, catalina.base=C:\Program Files\Apache Software Foundation\Tomcat 8.5, sun.management.compiler=HotSpot 64-Bit Tiered Compilers, catalina.useNaming=true, os.name=Windows 10, sun.boot.class.path=C:\Program Files\Java\jdk1.8.0_131\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_131\jre\lib\rt.jar;C:\Program Files\Java\jdk1.8.0_131\jre\lib\sunrsasign.jar;C:\Program Files\Java\jdk1.8.0_131\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_131\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_131\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_131\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_131\jre\classes, java.util.logging.config.file=C:\Program Files\Apache Software Foundation\Tomcat 8.5\conf\logging.properties, sun.desktop=windows, java.vm.specification.vendor=Oracle Corporation, java.runtime.version=1.8.0_131-b11, user.name=chris, tomcat.util.scan.StandardJarScanFilter.jarsToScan=log4j-web*.jar,log4j-taglib*.jar,log4javascript*.jar,slf4j-taglib*.jar, shared.loader=, tomcat.util.buf.StringCache.byte.enabled=true, user.language=pt, java.naming.factory.initial=org.apache.naming.java.javaURLContextFactory, sun.boot.library.path=C:\Program Files\Java\jdk1.8.0_131\jre\bin, PID=14652, jdk.tls.ephemeralDHKeySize=2048, java.version=1.8.0_131, java.util.logging.manager=org.apache.juli.ClassLoaderLogManager, user.timezone=America/Sao_Paulo, sun.arch.data.model=64, java.util.concurrent.ForkJoinPool.common.threadFactory=org.apache.catalina.startup.SafeForkJoinWorkerThreadFactory, java.endorsed.dirs=C:\Program Files\Java\jdk1.8.0_131\jre\lib\endorsed, sun.cpu.isalist=amd64, sun.jnu.encoding=Cp1252, file.encoding.pkg=sun.io, package.access=sun.,org.apache.catalina.,org.apache.coyote.,org.apache.jasper.,org.apache.tomcat., file.separator=\, java.specification.name=Java Platform API Specification, java.class.version=52.0, user.country=BR, java.home=C:\Program Files\Java\jdk1.8.0_131\jre, java.vm.info=mixed mode, os.version=10.0, path.separator=;, java.vm.version=25.131-b11, org.jboss.logging.provider=slf4j, user.variant=, java.protocol.handler.pkgs=org.apache.catalina.webresources, java.awt.printerjob=sun.awt.windows.WPrinterJob, sun.io.unicode.encoding=UnicodeLittle, awt.toolkit=sun.awt.windows.WToolkit, package.definition=sun.,java.,org.apache.catalina.,org.apache.coyote.,org.apache.jasper.,org.apache.naming.,org.apache.tomcat., user.script=, java.naming.factory.url.pkgs=org.apache.naming, user.home=C:\Users\chris, java.specification.vendor=Oracle Corporation, tomcat.util.scan.StandardJarScanFilter.jarsToSkip=bootstrap.jar,commons-daemon.jar,tomcat-juli.jar,annotations-api.jar,el-api.jar,jsp-api.jar,servlet-api.jar,websocket-api.jar,jaspic-api.jar,catalina.jar,catalina-ant.jar,catalina-ha.jar,catalina-storeconfig.jar,catalina-tribes.jar,jasper.jar,jasper-el.jar,ecj-*.jar,tomcat-api.jar,tomcat-util.jar,tomcat-util-scan.jar,tomcat-coyote.jar,tomcat-dbcp.jar,tomcat-jni.jar,tomcat-websocket.jar,tomcat-i18n-en.jar,tomcat-i18n-es.jar,tomcat-i18n-fr.jar,tomcat-i18n-ja.jar,tomcat-juli-adapters.jar,catalina-jmx-remote.jar,catalina-ws.jar,tomcat-jdbc.jar,tools.jar,commons-beanutils*.jar,commons-codec*.jar,commons-collections*.jar,commons-dbcp*.jar,commons-digester*.jar,commons-fileupload*.jar,commons-httpclient*.jar,commons-io*.jar,commons-lang*.jar,commons-logging*.jar,commons-math*.jar,commons-pool*.jar,jstl.jar,taglibs-standard-spec-*.jar,geronimo-spec-jaxrpc*.jar,wsdl4j*.jar,ant.jar,ant-junit*.jar,aspectj*.jar,jmx.jar,h2*.jar,hibernate*.jar,httpclient*.jar,jmx-tools.jar,jta*.jar,log4j*.jar,mail*.jar,slf4j*.jar,xercesImpl.jar,xmlParserAPIs.jar,xml-apis.jar,junit.jar,junit-*.jar,hamcrest-*.jar,easymock-*.jar,cglib-*.jar,objenesis-*.jar,ant-launcher.jar,cobertura-*.jar,asm-*.jar,dom4j-*.jar,icu4j-*.jar,jaxen-*.jar,jdom-*.jar,jetty-*.jar,oro-*.jar,servlet-api-*.jar,tagsoup-*.jar,xmlParserAPIs-*.jar,xom-*.jar, java.library.path=C:\Program Files\Java\jdk1.8.0_131\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Oracle\ora12c_65bits\product\12.1.0\client_1\bin;C:\Oracle\ora12c_32bits\product\12.1.0\client_1\bin;C:\Oracle\ora11g_720\product\11.1.0\client_1;C:\Oracle\ora11g_720\product\11.1.0\client_1\bin;C:\Oracle\ora11g_621\product\11.1.0\client_1;C:\Oracle\ora11g_621\product\11.1.0\client_1\bin;C:\Program Files\Java\jdk1.8.0_131\bin\;C:\Program Files\Java\jdk1.8.0_131\jre\bin;C:\Program Files (x86)\Java\jdk1.8.0_131\bin\;C:\Program Files (x86)\Java\jdk1.8.0_131\jre\bin;C:\Program Files\NetBeans 8.2\java\maven\bin;C:\Program Files\NetBeans 8.2\java\maven\bin;C:\Program Files\Microsoft MPI\Bin\;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Hewlett-Packard\SimplePass\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Skype\Phone\;C:\Program Files\OpenVPN\bin;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Git\cmd;C:\Program Files (x86)\GtkSharp\2.12\bin;C:\Users\chris\AppData\Local\Microsoft\WindowsApps;;., java.vendor.url=http://java.oracle.com/, spring.beaninfo.ignore=true, java.vm.vendor=Oracle Corporation, common.loader="${catalina.base}/lib","${catalina.base}/lib/*.jar","${catalina.home}/lib","${catalina.home}/lib/*.jar", java.runtime.name=Java(TM) SE Runtime Environment, sun.java.command=org.apache.catalina.startup.Bootstrap start, java.class.path=C:\Program Files\Apache Software Foundation\Tomcat 8.5\bin\bootstrap.jar;C:\Program Files\Apache Software Foundation\Tomcat 8.5\bin\tomcat-juli.jar, java.vm.specification.name=Java Virtual Machine Specification, java.vm.specification.version=1.8, catalina.home=C:\Program Files\Apache Software Foundation\Tomcat 8.5, sun.cpu.endian=little, sun.os.patch.level=, java.awt.headless=true, java.io.tmpdir=C:\Program Files\Apache Software Foundation\Tomcat 8.5\temp, java.vendor.url.bug=http://bugreport.sun.com/bugreport/, server.loader=, os.arch=amd64, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, java.ext.dirs=C:\Program Files\Java\jdk1.8.0_131\jre\lib\ext;C:\WINDOWS\Sun\Java\lib\ext, user.dir=C:\Program Files\Apache Software Foundation\Tomcat 8.5\bin, line.separator=
, java.vm.name=Java HotSpot(TM) 64-Bit Server VM, file.encoding=Cp1252, java.specification.version=1.8}}, SystemEnvironmentPropertySource#1819461971 {name='systemEnvironment', properties={NB_EXEC_TOMCAT_START_PROCESS_UUID=tomcat80:home=C:\Program Files\Apache Software Foundation\Tomcat 8.5, USERDOMAIN_ROAMINGPROFILE=PC-CONSULTORIO, PROCESSOR_LEVEL=6, Platform=HPD, FP_NO_HOST_CHECK=NO, _RUNJAVA="C:\Program Files\Java\jdk1.8.0_131\bin\java.exe", JSSE_OPTS="-Djdk.tls.ephemeralDHKeySize=2048", SESSIONNAME=Console, ALLUSERSPROFILE=C:\ProgramData, JAVA_OPTS= "-Djdk.tls.ephemeralDHKeySize=2048" -Djava.protocol.handler.pkgs=org.apache.catalina.webresources, PROCESSOR_ARCHITECTURE=AMD64, TNS_ADMIN=C:\Chris\Work\TNS, PSModulePath=C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\;C:\Program Files\WindowsPowerShell\Modules\;C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ResourceManager\AzureResourceManager\;C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ServiceManagement\;C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\Storage\, SystemDrive=C:, JRE_HOME=C:\Program Files\Java\jdk1.8.0_131, USERNAME=chris, ProgramFiles(x86)=C:\Program Files (x86), FPS_BROWSER_USER_PROFILE_STRING=Default, PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC, ProgramData=C:\ProgramData, ProgramW6432=C:\Program Files, HOMEPATH=\Users\chris, _RUNJDB="C:\Program Files\Java\jdk1.8.0_131\bin\jdb.exe", PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 60 Stepping 3, GenuineIntel, LOGGING_CONFIG=-Djava.util.logging.config.file="C:\Program Files\Apache Software Foundation\Tomcat 8.5\conf\logging.properties", ProgramFiles=C:\Program Files, PUBLIC=C:\Users\Public, CURRENT_DIR=C:\Program Files\Apache Software Foundation\Tomcat 8.5\bin, windir=C:\WINDOWS, =::=::\, NB_TOMCAT_JDK=1.8, LOCALAPPDATA=C:\Users\chris\AppData\Local, MSMPI_BIN=C:\Program Files\Microsoft MPI\Bin\, CATALINA_TMPDIR=C:\Program Files\Apache Software Foundation\Tomcat 8.5\temp, USERDOMAIN=PC-CONSULTORIO, FPS_BROWSER_APP_PROFILE_STRING=Internet Explorer, LOGONSERVER=\\PC-CONSULTORIO, JAVA_HOME=C:\Program Files\Java\jdk1.8.0_131, PROMPT=$P$G, FSHARPINSTALLDIR=C:\Program Files (x86)\Microsoft SDKs\F#\4.1\Framework\v4.0\, asl.log=Destination=file, CATALINA_BASE=C:\Program Files\Apache Software Foundation\Tomcat 8.5, OneDrive=C:\Users\chris\OneDrive, =C:=C:\Program Files\Apache Software Foundation\Tomcat 8.5\bin, APPDATA=C:\Users\chris\AppData\Roaming, GTK_BASEPATH=C:\Program Files (x86)\GtkSharp\2.12\, _EXECJAVA="C:\Program Files\Java\jdk1.8.0_131\bin\java.exe", VBOX_MSI_INSTALL_PATH=C:\Program Files\Oracle\VirtualBox\, CommonProgramFiles=C:\Program Files\Common Files, Path=C:\Oracle\ora12c_65bits\product\12.1.0\client_1\bin;C:\Oracle\ora12c_32bits\product\12.1.0\client_1\bin;C:\Oracle\ora11g_720\product\11.1.0\client_1;C:\Oracle\ora11g_720\product\11.1.0\client_1\bin;C:\Oracle\ora11g_621\product\11.1.0\client_1;C:\Oracle\ora11g_621\product\11.1.0\client_1\bin;C:\Program Files\Java\jdk1.8.0_131\bin\;C:\Program Files\Java\jdk1.8.0_131\jre\bin;C:\Program Files (x86)\Java\jdk1.8.0_131\bin\;C:\Program Files (x86)\Java\jdk1.8.0_131\jre\bin;C:\Program Files\NetBeans 8.2\java\maven\bin;C:\Program Files\NetBeans 8.2\java\maven\bin;C:\Program Files\Microsoft MPI\Bin\;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Hewlett-Packard\SimplePass\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Skype\Phone\;C:\Program Files\OpenVPN\bin;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Git\cmd;C:\Program Files (x86)\GtkSharp\2.12\bin;C:\Users\chris\AppData\Local\Microsoft\WindowsApps;, OS=Windows_NT, COMPUTERNAME=PC-CONSULTORIO, CATALINA_HOME=C:\Program Files\Apache Software Foundation\Tomcat 8.5, MAINCLASS=org.apache.catalina.startup.Bootstrap, LOGGING_MANAGER=-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager, OnlineServices=Online Services, PROCESSOR_REVISION=3c03, CLASSPATH=C:\Program Files\Apache Software Foundation\Tomcat 8.5\bin\bootstrap.jar;C:\Program Files\Apache Software Foundation\Tomcat 8.5\bin\tomcat-juli.jar, CommonProgramW6432=C:\Program Files\Common Files, ComSpec=C:\WINDOWS\system32\cmd.exe, SystemRoot=C:\WINDOWS, TEMP=C:\Users\chris\AppData\Local\Temp, ACTION=start, HOMEDRIVE=C:, USERPROFILE=C:\Users\chris, TMP=C:\Users\chris\AppData\Local\Temp, CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files, NUMBER_OF_PROCESSORS=4}}]
17:02:45.491 [http-nio-8090-exec-35] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Replacing PropertySource 'servletContextInitParams' with 'servletContextInitParams'
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.5.9.RELEASE)
2018-01-10 17:02:47.145 INFO 14652 --- [io-8090-exec-35] c.example.demosemds.ServletInitializer : Starting ServletInitializer on PC-Consultorio with PID 14652 (C:\Users\chris\Documents\NetBeansProjects\demoSemDsProject\target\demo-sem-ds-0.0.1-SNAPSHOT\WEB-INF\classes started by chris in C:\Program Files\Apache Software Foundation\Tomcat 8.5\bin)
2018-01-10 17:02:47.148 INFO 14652 --- [io-8090-exec-35] c.example.demosemds.ServletInitializer : No active profile set, falling back to default profiles: default
2018-01-10 17:02:47.378 INFO 14652 --- [io-8090-exec-35] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#186f3e22: startup date [Wed Jan 10 17:02:47 BRST 2018]; root of context hierarchy
2018-01-10 17:02:52.088 INFO 14652 --- [io-8090-exec-35] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.ws.config.annotation.DelegatingWsConfiguration' of type [org.springframework.ws.config.annotation.DelegatingWsConfiguration$$EnhancerBySpringCGLIB$$bdca92aa] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-01-10 17:02:52.224 INFO 14652 --- [io-8090-exec-35] .w.s.a.s.AnnotationActionEndpointMapping : Supporting [WS-Addressing August 2004, WS-Addressing 1.0]
2018-01-10 17:02:52.274 INFO 14652 --- [io-8090-exec-35] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 4896 ms
2018-01-10 17:02:54.021 INFO 14652 --- [io-8090-exec-35] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2018-01-10 17:02:54.022 INFO 14652 --- [io-8090-exec-35] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'messageDispatcherServlet' to [/services/*]
2018-01-10 17:02:54.022 INFO 14652 --- [io-8090-exec-35] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'errorPageFilter' to: [/*]
2018-01-10 17:02:54.022 INFO 14652 --- [io-8090-exec-35] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'metricsFilter' to: [/*]
2018-01-10 17:02:54.022 INFO 14652 --- [io-8090-exec-35] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2018-01-10 17:02:54.022 INFO 14652 --- [io-8090-exec-35] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2018-01-10 17:02:54.022 INFO 14652 --- [io-8090-exec-35] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2018-01-10 17:02:54.023 INFO 14652 --- [io-8090-exec-35] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2018-01-10 17:02:54.023 INFO 14652 --- [io-8090-exec-35] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'webRequestLoggingFilter' to: [/*]
2018-01-10 17:02:54.023 INFO 14652 --- [io-8090-exec-35] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'applicationContextIdFilter' to: [/*]
2018-01-10 17:02:55.527 INFO 14652 --- [io-8090-exec-35] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for #ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#186f3e22: startup date [Wed Jan 10 17:02:47 BRST 2018]; root of context hierarchy
2018-01-10 17:02:55.975 INFO 14652 --- [io-8090-exec-35] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2018-01-10 17:02:55.979 INFO 14652 --- [io-8090-exec-35] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2018-01-10 17:02:56.076 INFO 14652 --- [io-8090-exec-35] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-01-10 17:02:56.076 INFO 14652 --- [io-8090-exec-35] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-01-10 17:02:56.257 INFO 14652 --- [io-8090-exec-35] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-01-10 17:02:57.428 INFO 14652 --- [io-8090-exec-35] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/auditevents || /auditevents.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public org.springframework.http.ResponseEntity<?> org.springframework.boot.actuate.endpoint.mvc.AuditEventsMvcEndpoint.findByPrincipalAndAfterAndType(java.lang.String,java.util.Date,java.lang.String)
2018-01-10 17:02:57.433 INFO 14652 --- [io-8090-exec-35] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/loggers/{name:.*}],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.LoggersMvcEndpoint.get(java.lang.String)
2018-01-10 17:02:57.433 INFO 14652 --- [io-8090-exec-35] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/loggers/{name:.*}],methods=[POST],consumes=[application/vnd.spring-boot.actuator.v1+json || application/json],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.LoggersMvcEndpoint.set(java.lang.String,java.util.Map<java.lang.String, java.lang.String>)
2018-01-10 17:02:57.433 INFO 14652 --- [io-8090-exec-35] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/loggers || /loggers.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2018-01-10 17:02:57.433 INFO 14652 --- [io-8090-exec-35] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/trace || /trace.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2018-01-10 17:02:57.434 INFO 14652 --- [io-8090-exec-35] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/metrics/{name:.*}],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.MetricsMvcEndpoint.value(java.lang.String)
2018-01-10 17:02:57.434 INFO 14652 --- [io-8090-exec-35] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/metrics || /metrics.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2018-01-10 17:02:57.434 INFO 14652 --- [io-8090-exec-35] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/mappings || /mappings.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2018-01-10 17:02:57.435 INFO 14652 --- [io-8090-exec-35] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/autoconfig || /autoconfig.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2018-01-10 17:02:57.436 INFO 14652 --- [io-8090-exec-35] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/env/{name:.*}],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EnvironmentMvcEndpoint.value(java.lang.String)
2018-01-10 17:02:57.436 INFO 14652 --- [io-8090-exec-35] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/env || /env.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2018-01-10 17:02:57.437 INFO 14652 --- [io-8090-exec-35] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/info || /info.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2018-01-10 17:02:57.501 INFO 14652 --- [io-8090-exec-35] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/heapdump || /heapdump.json],methods=[GET],produces=[application/octet-stream]}" onto public void org.springframework.boot.actuate.endpoint.mvc.HeapdumpMvcEndpoint.invoke(boolean,javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) throws java.io.IOException,javax.servlet.ServletException
2018-01-10 17:02:57.503 INFO 14652 --- [io-8090-exec-35] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/health || /health.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint.invoke(javax.servlet.http.HttpServletRequest,java.security.Principal)
2018-01-10 17:02:57.506 INFO 14652 --- [io-8090-exec-35] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/beans || /beans.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2018-01-10 17:02:57.509 INFO 14652 --- [io-8090-exec-35] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/configprops || /configprops.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2018-01-10 17:02:57.513 INFO 14652 --- [io-8090-exec-35] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/dump || /dump.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2018-01-10 17:02:58.035 INFO 14652 --- [io-8090-exec-35] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2018-01-10 17:02:58.080 INFO 14652 --- [io-8090-exec-35] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 0
2018-01-10 17:02:58.292 INFO 14652 --- [io-8090-exec-35] c.example.demosemds.ServletInitializer : Started ServletInitializer in 12.74 seconds (JVM running for 2359.263)
10-Jan-2018 17:02:58.328 INFORMAÇÕES [http-nio-8090-exec-35] org.apache.catalina.startup.HostConfig.deployDescriptor Deployment of configuration descriptor [C:\Program Files\Apache Software Foundation\Tomcat 8.5\conf\Catalina\localhost\demo-sem-ds.xml] has finished in [27,898] ms
2018-01-10 17:02:58.304 INFO 14652 --- [io-8090-exec-35] com.sun.xml.ws.server.http : WSSERVLET12: inicialização do listener de contexto de JAX-WS
2018-01-10 17:02:58.305 INFO 14652 --- [io-8090-exec-35] com.sun.xml.ws.server.http : WSSERVLET12: inicialização do listener de contexto de JAX-WS
10-Jan-2018 17:02:58.367 INFORMAÇÕES [http-nio-8090-exec-35] org.apache.catalina.util.LifecycleBase.start The start() method was called on component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/demo-sem-ds]] after start() had already been called. The second call will be ignored.
2018-01-10 17:02:59.296 INFO 14652 --- [io-8090-exec-38] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization started
2018-01-10 17:02:59.427 INFO 14652 --- [io-8090-exec-38] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization completed in 131 ms
...and the application startup output:
Deploying on Apache Tomcat or TomEE
profile mode: false
debug mode: false
force redeploy: true
In-place deployment at C:\Users\chris\Documents\NetBeansProjects\demoSemDsProject\target\demo-sem-ds-0.0.1-SNAPSHOT
Deployment is in progress...
deploy?config=file%3A%2FC%3A%2FUsers%2Fchris%2FAppData%2FLocal%2FTemp%2Fcontext8200228991787487399.xml&path=/demo-sem-ds
OK - Deployed application at context path [/demo-sem-ds]
start?path=/demo-sem-ds
OK - Started application at context path [/demo-sem-ds]
Thanks again.
Update 2:
A colleague showed me how to get the proper response.
When I run the ws project, it was opening http://localhost:8090/demo-sem-ds/, but the url needs to have the name of the webservice on the end. In this case http://localhost:8090/demo-sem-ds/tissSolicitacaoProcedimento. Using this in SoupUI, with an appropriate call message, allows the webservice to reply.
Related
Spring Boot - Thymeleaf - New project does not work
I need help to start a new project with spring boot. I used spring tool suite 4 "spring starter project". I followed all the steps of the guide correctly, but once I run localhost:8080 it tells me that it's impossible to reach the site. In problem's section, i've 0 problems and warnings. my pom.xml: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.3.4.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>it.progettoThymeleaf</groupId> <artifactId>progettoThymeleaf</artifactId> <version>0.0.1-SNAPSHOT</version> <name>MyNewProject</name> <description>Nuov progetto ThymeLeaf</description> <properties> <java.version>1.8</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-integration</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <scope>runtime</scope> <optional>true</optional> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> <exclusions> <exclusion> <groupId>org.junit.vintage</groupId> <artifactId>junit-vintage-engine</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.springframework.integration</groupId> <artifactId>spring-integration-test</artifactId> <scope>test</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project> My .log file: !ENTRY org.eclipse.jdt.debug 2 0 2020-10-08 21:09:12.334 !MESSAGE Unable to find location of java.lang.Thread.setName() in debuggee JVM, for type java.lang.Thread Thank you THE NEW CONSOLE OUTPUT: . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v2.3.4.RELEASE) 2020-10-08 21:43:13.953 INFO 19656 --- [ restartedMain] i.p.start.MyNewProjectApplication : Starting MyNewProjectApplication on griccipw10 with PID 19656 (C:\Progetto Thymeleaf\Workspace\MyNewProject\target\classes started by gricci in C:\Progetto Thymeleaf\Workspace\MyNewProject) 2020-10-08 21:43:13.960 INFO 19656 --- [ restartedMain] i.p.start.MyNewProjectApplication : No active profile set, falling back to default profiles: default 2020-10-08 21:43:14.051 INFO 19656 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable 2020-10-08 21:43:14.051 INFO 19656 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG' 2020-10-08 21:43:15.087 INFO 19656 --- [ restartedMain] faultConfiguringBeanFactoryPostProcessor : No bean named 'errorChannel' has been explicitly defined. Therefore, a default PublishSubscribeChannel will be created. 2020-10-08 21:43:15.105 INFO 19656 --- [ restartedMain] faultConfiguringBeanFactoryPostProcessor : No bean named 'taskScheduler' has been explicitly defined. Therefore, a default ThreadPoolTaskScheduler will be created. 2020-10-08 21:43:15.110 INFO 19656 --- [ restartedMain] faultConfiguringBeanFactoryPostProcessor : No bean named 'integrationHeaderChannelRegistry' has been explicitly defined. Therefore, a default DefaultHeaderChannelRegistry will be created. 2020-10-08 21:43:15.199 INFO 19656 --- [ restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.integration.config.IntegrationManagementConfiguration' of type [org.springframework.integration.config.IntegrationManagementConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2020-10-08 21:43:15.212 INFO 19656 --- [ restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'integrationChannelResolver' of type [org.springframework.integration.support.channel.BeanFactoryChannelResolver] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2020-10-08 21:43:15.215 INFO 19656 --- [ restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'integrationDisposableAutoCreatedBeans' of type [org.springframework.integration.config.annotation.Disposables] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2020-10-08 21:43:15.615 INFO 19656 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http) 2020-10-08 21:43:15.627 INFO 19656 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat] 2020-10-08 21:43:15.627 INFO 19656 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.38] 2020-10-08 21:43:15.949 INFO 19656 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2020-10-08 21:43:15.949 INFO 19656 --- [ restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1898 ms 2020-10-08 21:43:16.267 INFO 19656 --- [ restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor' 2020-10-08 21:43:16.283 DEBUG 19656 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerAdapter : ControllerAdvice beans: 0 #ModelAttribute, 0 #InitBinder, 1 RequestBodyAdvice, 1 ResponseBodyAdvice 2020-10-08 21:43:16.365 DEBUG 19656 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : 2 mappings in 'requestMappingHandlerMapping' 2020-10-08 21:43:16.399 DEBUG 19656 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Patterns [/webjars/**, /**] in 'resourceHandlerMapping' 2020-10-08 21:43:16.408 DEBUG 19656 --- [ restartedMain] .m.m.a.ExceptionHandlerExceptionResolver : ControllerAdvice beans: 0 #ExceptionHandler, 1 ResponseBodyAdvice 2020-10-08 21:43:16.601 INFO 19656 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729 2020-10-08 21:43:16.751 INFO 19656 --- [ restartedMain] o.s.s.c.ThreadPoolTaskScheduler : Initializing ExecutorService 'taskScheduler' 2020-10-08 21:43:16.851 INFO 19656 --- [ restartedMain] o.s.i.endpoint.EventDrivenConsumer : Adding {logging-channel-adapter:_org.springframework.integration.errorLogger} as a subscriber to the 'errorChannel' channel 2020-10-08 21:43:16.852 INFO 19656 --- [ restartedMain] o.s.i.channel.PublishSubscribeChannel : Channel 'application.errorChannel' has 1 subscriber(s). 2020-10-08 21:43:16.852 INFO 19656 --- [ restartedMain] o.s.i.endpoint.EventDrivenConsumer : started bean '_org.springframework.integration.errorLogger' 2020-10-08 21:43:16.903 INFO 19656 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path '' 2020-10-08 21:43:16.923 INFO 19656 --- [ restartedMain] i.p.start.MyNewProjectApplication : Started MyNewProjectApplication in 3.491 seconds (JVM running for 6.366) 2020-10-08 21:43:20.841 INFO 19656 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet' 2020-10-08 21:43:20.841 INFO 19656 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet' 2020-10-08 21:43:20.841 DEBUG 19656 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Detected StandardServletMultipartResolver 2020-10-08 21:43:20.851 DEBUG 19656 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : enableLoggingRequestDetails='false': request parameters and headers will be masked to prevent unsafe logging of potentially sensitive data 2020-10-08 21:43:20.851 INFO 19656 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 10 ms 2020-10-08 21:43:20.881 DEBUG 19656 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : GET "/home", parameters={} 2020-10-08 21:43:20.896 DEBUG 19656 --- [nio-8080-exec-1] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped to ResourceHttpRequestHandler ["classpath:/META-INF/resources/", "classpath:/resources/", "classpath:/static/", "classpath:/public/", "/"] 2020-10-08 21:43:20.900 DEBUG 19656 --- [nio-8080-exec-1] o.s.w.s.r.ResourceHttpRequestHandler : Resource not found 2020-10-08 21:43:20.901 DEBUG 19656 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed 404 NOT_FOUND 2020-10-08 21:43:20.911 DEBUG 19656 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : "ERROR" dispatch for GET "/error", parameters={} 2020-10-08 21:43:20.914 DEBUG 19656 --- [nio-8080-exec-1] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController#errorHtml(HttpServletRequest, HttpServletResponse) 2020-10-08 21:43:20.960 DEBUG 19656 --- [nio-8080-exec-1] o.s.w.s.v.ContentNegotiatingViewResolver : Selected 'text/html' given [text/html, text/html;q=0.8] 2020-10-08 21:43:20.966 DEBUG 19656 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Exiting from "ERROR" dispatch, status 404 Screen of my browser: enter image description here HomeController.java : package it.progettoThymeleaf.start; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; public class HomeController { #GetMapping("/home") public String getHome(Model model) { model.addAttribute("message", "Benvenuti nel mio nuovo progetto Thymeleaf!"); return "home"; } } home.html: <!DOCTYPE html> <html xmlns:th="www.thymeleaf.org"> <head> <meta charset="ISO-8859-1"> <title>Gianluca's New Project</title> </head> <body> <h1 th:text=${message}></h1> </body> </html> Project package explorer screen: enter image description here
Your namespace in home.html is incomplete http://www.w3.org/1999/xhtml. <html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
I tried to create a project on my local and faced the same issue. I got it resolved by adding an html file under templates folder. Basically, this is the place where your thymeleaf templates will live. Adding a screenshot. Add this to your properties file if you want to access home page from /home server.servlet.context-path=/home
Spring Boot controller returns 404 for all api endpoints
I am new to Spring's ecosystem. And I am stuck with this particular situation. My application server responds with 404 for all of my API endpoints. This is my controller package com.example.controllers; import com.example.models.Movie; import com.example.services.MovieService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Optional; #RestController public class MovieController { #Autowired private MovieService movieService; #RequestMapping(value = "/movies", method = RequestMethod.GET) #ResponseBody public List<Movie> getAllMovies(){ return movieService.getAllMovies(); } #RequestMapping(value = "/movies", method = RequestMethod.POST) #ResponseBody public Movie addNewMovie(#RequestBody Movie movie){ System.out.println("Hello World"); return movieService.addMovie(movie); } #RequestMapping(value = "/movies/{id}", method = RequestMethod.GET) #ResponseBody public Optional<Movie> getMovieById(#PathVariable String id){ return movieService.getMovieById(id); } #RequestMapping(value = "/movies", method = RequestMethod.PUT) #ResponseBody public Movie updateMovie(#RequestBody Movie movie){ return movieService.updateMovie(movie); } #RequestMapping(value = "/movies/{id}", method = RequestMethod.DELETE) public void removeMovieById(#PathVariable String id){ movieService.deleteMovie(id); } } And this my main class package com.example; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.ComponentScan; #EnableAutoConfiguration #ComponentScan #SpringBootApplication public class LearnSpringApplication{ public static void main(String[] args) { SpringApplication.run(LearnSpringApplication.class, args); } } I am running it on localhost and port is 8080. I did set up a small app prior to this one, and that worked as expected. However, I am guessing that it's because the controller is in a different package since in the previous app, the main class and the controller were in the same package. Edit Here's my pom.xml file: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.example</groupId> <artifactId>learn_spring</artifactId> <version>0.0.1</version> <packaging>jar</packaging> <name>learn_spring</name> <description>Project to learn Spring</description> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.0.1.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.version>10</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-mongodb</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project> EDIT My Spring-Boot startup logs are 2018-05-03 17:16:44.937 INFO 14017 --- [ main] com.example.LearnSpringApplication : Starting LearnSpringApplication v0.0.1 on tfc with PID 14017 (/home/ayush/Workspace/learn_spring/target/learn_spring-0.0.1.jar started by ayush in /home/ayush/Workspace/learn_spring) 2018-05-03 17:16:44.940 INFO 14017 --- [ main] com.example.LearnSpringApplication : No active profile set, falling back to default profiles: default 2018-05-03 17:16:45.045 INFO 14017 --- [ main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext#6aba2b86: startup date [Thu May 03 17:16:45 IST 2018]; root of context hierarchy WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by org.springframework.cglib.core.ReflectUtils$1 (jar:file:/home/ayush/Workspace/learn_spring/target/learn_spring-0.0.1.jar!/BOOT-INF/lib/spring-core-5.0.5.RELEASE.jar!/) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) WARNING: Please consider reporting this to the maintainers of org.springframework.cglib.core.ReflectUtils$1 WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release 2018-05-03 17:16:46.113 INFO 14017 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http) 2018-05-03 17:16:46.138 INFO 14017 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat] 2018-05-03 17:16:46.139 INFO 14017 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.29 2018-05-03 17:16:46.151 INFO 14017 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib] 2018-05-03 17:16:46.218 INFO 14017 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2018-05-03 17:16:46.218 INFO 14017 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1186 ms 2018-05-03 17:16:46.336 INFO 14017 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Servlet dispatcherServlet mapped to [/] 2018-05-03 17:16:46.339 INFO 14017 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*] 2018-05-03 17:16:46.340 INFO 14017 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*] 2018-05-03 17:16:46.340 INFO 14017 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*] 2018-05-03 17:16:46.340 INFO 14017 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*] 2018-05-03 17:16:46.455 INFO 14017 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2018-05-03 17:16:46.720 INFO 14017 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for #ControllerAdvice: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext#6aba2b86: startup date [Thu May 03 17:16:45 IST 2018]; root of context hierarchy 2018-05-03 17:16:46.786 INFO 14017 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) 2018-05-03 17:16:46.787 INFO 14017 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest) 2018-05-03 17:16:46.817 INFO 14017 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2018-05-03 17:16:46.817 INFO 14017 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2018-05-03 17:16:47.060 INFO 14017 --- [ main] org.mongodb.driver.cluster : Cluster created with settings {hosts=[localhost:27017], mode=SINGLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms', maxWaitQueueSize=500} 2018-05-03 17:16:47.151 INFO 14017 --- [localhost:27017] org.mongodb.driver.connection : Opened connection [connectionId{localValue:1, serverValue:12}] to localhost:27017 2018-05-03 17:16:47.155 INFO 14017 --- [localhost:27017] org.mongodb.driver.cluster : Monitor thread successfully connected to server with description ServerDescription{address=localhost:27017, type=STANDALONE, state=CONNECTED, ok=true, version=ServerVersion{versionList=[3, 6, 3]}, minWireVersion=0, maxWireVersion=6, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=null, roundTripTimeNanos=2192957} 2018-05-03 17:16:47.323 INFO 14017 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup 2018-05-03 17:16:47.392 INFO 14017 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path '' 2018-05-03 17:16:47.395 INFO 14017 --- [ main] com.example.LearnSpringApplication : Started LearnSpringApplication in 2.89 seconds (JVM running for 3.296)
Sometimes is because of your package structure. Always make sure your controllers are in same package or sub-package level as the #SpringBootApplication class. For example: If application class is at com.a.b then controllers should be at com.a.b or com.a.b.c or com.a.b.c.d etc. You don't always have to add #ComponentScan to get them registered.
You're using IntelliJ IDEA community version, which does not support the Spring Framework: see https://www.jetbrains.com/idea/features/editions_comparison_matrix.html for reference Update Since you're using the command line, then the above does not apply. I'll leave it here as a reference, though. In the comments, you have specified that when running mvn clean package followed by java -jar target/whatever-your-project-name-is.jar, you get the following error: Field movieService in com.example.controllers.MovieController required a bean of type 'com.example.services.MovieService' that could not be found. Please make sure that: you have a class MovieService in the package services that class is annotated with the #Service annotation Update 2 Since the above did not work, try replacing #ComponentScan by #ComponentScan({"com.example.services", "com.example.controllers"}) in your LearnSpringApplication class. Include all other packages that have classes annotated with #Component, #Service, #Controller, #RestController, or #Repository. Note that this is a workaround. Normally, having #ComponentScan alone should be sufficient -- or as #DarrenForsythe mentionned in the comment, even just #SpringBootApplication should be sufficient for your case.
I had the same problem today and tried the simple solution provided above by #Daniel Moshi. It worked fine. Thanks. Other option is using like below: #SpringBootApplication(scanBasePackages = "com.example") ...with this the Controller can stay in any sub-package of com.example and works good even without explicit usage of #ComponentScan.
Spting cloud data flow batch job is running one time if #EnableTask is used in main app
Hi I am trying to deploy simple spring boot batch jar file in local spring cloud data flow server. I am facing serious problem in the batch when I am using #EnableTask in my main java class. When I am using #EnableTask in my application the batch job is running only one time. Its executing the batch and then de registering the application automatically. Code for the application is given below. 1)main class package com.jwt.spring.batch; import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.task.configuration.EnableTask; #EnableTask #EnableBatchProcessing #SpringBootApplication public class ScdfBatchApplication { public static void main(String[] args) { SpringApplication.run(ScdfBatchApplication.class, args); } } 2)JobConfiguration.java package com.jwt.spring.batch; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.batch.core.Job; import org.springframework.batch.core.StepContribution; import org.springframework.batch.core.configuration.annotation.JobBuilderFactory; import org.springframework.batch.core.configuration.annotation.StepBuilderFactory; import org.springframework.batch.core.scope.context.ChunkContext; import org.springframework.batch.core.step.tasklet.Tasklet; import org.springframework.batch.repeat.RepeatStatus; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; #Configuration public class JobConfiguration { private static final Log logger = LogFactory.getLog(JobConfiguration.class); #Autowired public JobBuilderFactory jobBuilderFactory; #Autowired public StepBuilderFactory stepBuilderFactory; #Bean public Job job() { return jobBuilderFactory.get("job").start(stepBuilderFactory.get("jobStep1").tasklet(new Tasklet() { #Override public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception { logger.info("Job was run"); return RepeatStatus.FINISHED; } }).build()).build(); } } 3)pom.xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.jwt.spring.batch</groupId> <artifactId>SCDFBatch</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>SCDFBatch</name> <description>Demo project for Spring Boot</description> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.9.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.version>1.8</java.version> <spring-cloud-task.version>1.2.2.RELEASE</spring-cloud-task.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-batch</artifactId> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-task</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> <scope>runtime</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework.batch</groupId> <artifactId>spring-batch-test</artifactId> <scope>test</scope> </dependency> </dependencies> <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-task-dependencies</artifactId> <version>${spring-cloud-task.version}</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project> Below is the log of the application . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v1.5.9.RELEASE) 2018-01-05 17:13:37.984 INFO 14436 --- [ main] c.jwt.spring.batch.ScdfBatchApplication : Starting ScdfBatchApplication on bdc7-l-5065XBS with PID 14436 (C:\STS-WORK_SPACE\SPRING-BATCH\SCDFBatch\target\classes started by mukesh.bo.kumar in C:\STS-WORK_SPACE\SPRING-BATCH\SCDFBatch) 2018-01-05 17:13:37.990 INFO 14436 --- [ main] c.jwt.spring.batch.ScdfBatchApplication : No active profile set, falling back to default profiles: default 2018-01-05 17:13:38.091 INFO 14436 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#9e725a: startup date [Fri Jan 05 17:13:38 IST 2018]; root of context hierarchy 2018-01-05 17:13:39.153 INFO 14436 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'transactionManager' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.cloud.task.configuration.SimpleTaskConfiguration; factoryMethodName=transactionManager; initMethodName=null; destroyMethodName=(inferred); defined in org.springframework.cloud.task.configuration.SimpleTaskConfiguration] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.batch.core.configuration.annotation.SimpleBatchConfiguration; factoryMethodName=transactionManager; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/batch/core/configuration/annotation/SimpleBatchConfiguration.class]] 2018-01-05 17:13:39.784 WARN 14436 --- [ main] o.s.c.a.ConfigurationClassEnhancer : #Bean method ScopeConfiguration.stepScope is non-static and returns an object assignable to Spring's BeanFactoryPostProcessor interface. This will result in a failure to process annotations such as #Autowired, #Resource and #PostConstruct within the method's declaring #Configuration class. Add the 'static' modifier to this method to avoid these container lifecycle issues; see #Bean javadoc for complete details. 2018-01-05 17:13:39.804 WARN 14436 --- [ main] o.s.c.a.ConfigurationClassEnhancer : #Bean method ScopeConfiguration.jobScope is non-static and returns an object assignable to Spring's BeanFactoryPostProcessor interface. This will result in a failure to process annotations such as #Autowired, #Resource and #PostConstruct within the method's declaring #Configuration class. Add the 'static' modifier to this method to avoid these container lifecycle issues; see #Bean javadoc for complete details. 2018-01-05 17:13:39.943 INFO 14436 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.task.batch.configuration.TaskBatchAutoConfiguration' of type [org.springframework.cloud.task.batch.configuration.TaskBatchAutoConfiguration$$EnhancerBySpringCGLIB$$e6554726] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2018-01-05 17:13:39.952 INFO 14436 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$60e59b9a] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2018-01-05 17:13:40.005 INFO 14436 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.task.batch.listener.BatchEventAutoConfiguration' of type [org.springframework.cloud.task.batch.listener.BatchEventAutoConfiguration$$EnhancerBySpringCGLIB$$2eab5129] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2018-01-05 17:13:40.955 INFO 14436 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http) 2018-01-05 17:13:40.971 INFO 14436 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat] 2018-01-05 17:13:40.972 INFO 14436 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.23 2018-01-05 17:13:41.201 INFO 14436 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2018-01-05 17:13:41.202 INFO 14436 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 3116 ms 2018-01-05 17:13:41.540 INFO 14436 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/] 2018-01-05 17:13:41.544 INFO 14436 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*] 2018-01-05 17:13:41.545 INFO 14436 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*] 2018-01-05 17:13:41.545 INFO 14436 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*] 2018-01-05 17:13:41.545 INFO 14436 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*] 2018-01-05 17:13:42.681 INFO 14436 --- [ main] o.s.jdbc.datasource.init.ScriptUtils : Executing SQL script from class path resource [org/springframework/cloud/task/schema-h2.sql] 2018-01-05 17:13:42.726 INFO 14436 --- [ main] o.s.jdbc.datasource.init.ScriptUtils : Executed SQL script from class path resource [org/springframework/cloud/task/schema-h2.sql] in 45 ms. 2018-01-05 17:13:43.076 INFO 14436 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for #ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#9e725a: startup date [Fri Jan 05 17:13:38 IST 2018]; root of context hierarchy 2018-01-05 17:13:43.170 INFO 14436 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest) 2018-01-05 17:13:43.172 INFO 14436 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) 2018-01-05 17:13:43.206 INFO 14436 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2018-01-05 17:13:43.207 INFO 14436 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2018-01-05 17:13:43.314 INFO 14436 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2018-01-05 17:13:43.415 INFO 14436 --- [ main] o.s.jdbc.datasource.init.ScriptUtils : Executing SQL script from class path resource [org/springframework/batch/core/schema-h2.sql] 2018-01-05 17:13:43.435 INFO 14436 --- [ main] o.s.jdbc.datasource.init.ScriptUtils : Executed SQL script from class path resource [org/springframework/batch/core/schema-h2.sql] in 20 ms. 2018-01-05 17:13:43.592 INFO 14436 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup 2018-01-05 17:13:43.603 INFO 14436 --- [ main] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 0 2018-01-05 17:13:43.721 INFO 14436 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http) 2018-01-05 17:13:43.725 INFO 14436 --- [ main] o.s.b.a.b.JobLauncherCommandLineRunner : Running default command line with: [] 2018-01-05 17:13:43.730 INFO 14436 --- [ main] o.s.b.c.r.s.JobRepositoryFactoryBean : No database type set, using meta data indicating: H2 2018-01-05 17:13:43.913 INFO 14436 --- [ main] o.s.b.c.l.support.SimpleJobLauncher : No TaskExecutor has been set, defaulting to synchronous executor. 2018-01-05 17:13:43.961 INFO 14436 --- [ main] o.s.b.c.l.support.SimpleJobLauncher : Job: [SimpleJob: [name=job]] launched with the following parameters: [{}] 2018-01-05 17:13:43.972 INFO 14436 --- [ main] o.s.c.t.b.l.TaskBatchExecutionListener : The job execution id 1 was run within the task execution 1 2018-01-05 17:13:43.981 INFO 14436 --- [ main] o.s.batch.core.job.SimpleStepHandler : Executing step: [jobStep1] 2018-01-05 17:13:43.992 INFO 14436 --- [ main] com.jwt.spring.batch.JobConfiguration : Job was run 2018-01-05 17:13:43.998 INFO 14436 --- [ main] o.s.b.c.l.support.SimpleJobLauncher : Job: [SimpleJob: [name=job]] completed with the following parameters: [{}] and the following status: [COMPLETED] 2018-01-05 17:13:44.003 INFO 14436 --- [ main] ationConfigEmbeddedWebApplicationContext : Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#9e725a: startup date [Fri Jan 05 17:13:38 IST 2018]; root of context hierarchy 2018-01-05 17:13:44.004 INFO 14436 --- [ main] o.s.c.support.DefaultLifecycleProcessor : Stopping beans in phase 0 2018-01-05 17:13:44.005 INFO 14436 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown 2018-01-05 17:13:44.278 INFO 14436 --- [ main] c.jwt.spring.batch.ScdfBatchApplication : Started ScdfBatchApplication in 6.956 seconds (JVM running for 9.208)
Please this post. You need to use the RunIdIncrementer in your job. Spring Batch Item Reader is executing only once
First thing Please add timestamp to name of the Job to make it unique everytime its being run. Secondly, you should use task-launcher or stream to launch your task run more than once. Launch it using TriggerTask; with this you could either choose to launch it with fixedDelay or via a cron expression Finally if you wanted job to be running based on some event then create and deploy your spring batch job as stream rather than deploying as task. What type of stream depends upon your requirement whether it is processor or sink. As per the details in your query, its more kind of processor hence reference examples from spring cloud stream related to processor, have pasted a sample processor application code. Please refer https://github.com/spring-cloud/spring-cloud-stream-samples/tree/master/transform
How can I connect to MongoDB via Springboot?
I have a simple Springboot application up and running, and know my full MongoDB URI/connection string. The database is also up and running. Why am I getting the error below and how can I get my Springboot application to run? application.properties #mongodb spring.data.mongodb.host=asdf spring.data.mongodb.port=27017 spring.data.mongodb.database=asdf spring.data.mongodb.username=admin #logging logging.level.org.springframework.data=debug logging.level.=error build.gradle: // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { ext.kotlin_version = '1.1.2-4' repositories { mavenCentral() } dependencies { // Needed for the 'kotlin' plugin classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // Needed for the 'org.springframework.boot' plugin classpath "org.springframework.boot:spring-boot-gradle-plugin:1.5.2.RELEASE" // Needed for the 'kotlin-spring' plugin classpath "org.jetbrains.kotlin:kotlin-allopen:$kotlin_version" } } // Allows us to compile Kotlin files apply plugin: 'kotlin' // Does some extra work to set up Spring Boot. // Specifically this gives us the "bootRun" task we will be using apply plugin: 'org.springframework.boot' // Allows for improved interop between Kotlin and Spring apply plugin: 'kotlin-spring' repositories { mavenCentral() } dependencies { // MongoDB compile 'org.springframework.data:spring-data-mongodb:1.2.3.RELEASE' // Kotlin Dependencies compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" testCompile "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version" // Spring Dependencies compile("org.springframework.boot:spring-boot-starter-web") { exclude module: "spring-boot-starter-tomcat" } compile "org.springframework.boot:spring-boot-starter-jetty" compile "org.springframework.boot:spring-boot-starter-actuator" // Jackson Dependencies compile "com.fasterxml.jackson.core:jackson-annotations" compile "com.fasterxml.jackson.core:jackson-core" compile "com.fasterxml.jackson.core:jackson-databind" runtime "com.fasterxml.jackson.datatype:jackson-datatype-jdk8" runtime "com.fasterxml.jackson.datatype:jackson-datatype-jsr310" runtime "com.fasterxml.jackson.module:jackson-module-kotlin" } task wrapper(type: Wrapper) { gradleVersion = "3.5" } Stacktrace: $ ./gradlew bootRun Starting a Gradle Daemon, 1 busy and 2 incompatible Daemons could not be reused, use --status for details :compileKotlin UP-TO-DATE :compileJava NO-SOURCE :copyMainKotlinClasses UP-TO-DATE :processResources UP-TO-DATE :classes UP-TO-DATE :findMainClass Using a single directory for all classes from a source set. This behaviour has been deprecated and is scheduled to be removed in Gradle 5.0 :bootRun . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v1.5.2.RELEASE) 2017-09-18 15:30:31.765 INFO 5904 --- [ main] hello.ApplicationKt : Starting ApplicationKt on Martin with PID 5904 (started by Martin in D:\Software Projects\Web Projects\spring-boot-kotlin-demo) 2017-09-18 15:30:31.767 INFO 5904 --- [ main] hello.ApplicationKt : No active profile set, falling back to default profiles: default 2017-09-18 15:30:31.808 INFO 5904 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#3c72f59f: startup date [Mon Sep 18 15:30:31 CEST 2017]; root of context hierarchy 2017-09-18 15:30:32.826 INFO 5904 --- [ main] org.eclipse.jetty.util.log : Logging initialized #1697ms to org.eclipse.jetty.util.log.Slf4jLog 2017-09-18 15:30:33.074 INFO 5904 --- [ main] e.j.JettyEmbeddedServletContainerFactory : Server initialized with port: 8080 2017-09-18 15:30:33.075 INFO 5904 --- [ main] org.eclipse.jetty.server.Server : jetty-9.4.2.v20170220 2017-09-18 15:30:33.300 INFO 5904 --- [ main] org.eclipse.jetty.server.session : DefaultSessionIdManager workerName=node0 2017-09-18 15:30:33.300 INFO 5904 --- [ main] org.eclipse.jetty.server.session : No SessionScavenger set, using defaults 2017-09-18 15:30:33.302 INFO 5904 --- [ main] org.eclipse.jetty.server.session : Scavenging every 600000ms 2017-09-18 15:30:33.306 INFO 5904 --- [ main] o.e.jetty.ContextHandler.application : Initializing Spring embedded WebApplicationContext 2017-09-18 15:30:33.307 INFO 5904 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1501 ms 2017-09-18 15:30:33.484 INFO 5904 --- [ main] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/] 2017-09-18 15:30:33.486 INFO 5904 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'metricsFilter' to: [/*] 2017-09-18 15:30:33.486 INFO 5904 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*] 2017-09-18 15:30:33.486 INFO 5904 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*] 2017-09-18 15:30:33.486 INFO 5904 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*] 2017-09-18 15:30:33.486 INFO 5904 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*] 2017-09-18 15:30:33.486 INFO 5904 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'webRequestLoggingFilter' to: [/*] 2017-09-18 15:30:33.486 INFO 5904 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'applicationContextIdFilter' to: [/*] 2017-09-18 15:30:33.652 INFO 5904 --- [ main] o.e.jetty.server.handler.ContextHandler : Started o.s.b.c.e.j.JettyEmbeddedWebAppContext#562457e1{/,[file:///C:/Users/Martin/AppData/Local/Temp/jetty-docbase.789597977539512961.8080/],AVAILABLE} 2017-09-18 15:30:33.652 INFO 5904 --- [ main] org.eclipse.jetty.server.Server : Started #2524ms 2017-09-18 15:30:33.911 INFO 5904 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for #ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#3c72f59f: startup date [Mon Sep 18 15:30:31 CEST 2017]; root of context hierarchy 2017-09-18 15:30:33.961 INFO 5904 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest) 2017-09-18 15:30:33.961 INFO 5904 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) 2017-09-18 15:30:33.990 INFO 5904 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2017-09-18 15:30:33.990 INFO 5904 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2017-09-18 15:30:34.028 INFO 5904 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2017-09-18 15:30:34.382 INFO 5904 --- [ main] org.mongodb.driver.cluster : Cluster created with settings {hosts=[localhost:27017], mode=SINGLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms', maxWaitQueueSize=500} 2017-09-18 15:30:34.853 INFO 5904 --- [ main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/info || /info.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke() 2017-09-18 15:30:34.854 INFO 5904 --- [ main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/env/{name:.*}],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EnvironmentMvcEndpoint.value(java.lang.String) 2017-09-18 15:30:34.854 INFO 5904 --- [ main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/env || /env.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke() 2017-09-18 15:30:34.855 INFO 5904 --- [ main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/health || /health.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint.invoke(javax.servlet.http.HttpServletRequest,java.security.Principal) 2017-09-18 15:30:34.855 INFO 5904 --- [ main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/trace || /trace.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke() 2017-09-18 15:30:34.856 INFO 5904 --- [ main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/heapdump || /heapdump.json],methods=[GET],produces=[application/octet-stream]}" onto public void org.springframework.boot.actuate.endpoint.mvc.HeapdumpMvcEndpoint.invoke(boolean,javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) throws java.io.IOException,javax.servlet.ServletException 2017-09-18 15:30:34.859 INFO 5904 --- [ main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/loggers/{name:.*}],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.LoggersMvcEndpoint.get(java.lang.String) 2017-09-18 15:30:34.859 INFO 5904 --- [ main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/loggers/{name:.*}],methods=[POST],consumes=[application/vnd.spring-boot.actuator.v1+json || application/json],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.LoggersMvcEndpoint.set(java.lang.String,java.util.Map<java.lang.String, java.lang.String>) 2017-09-18 15:30:34.859 INFO 5904 --- [ main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/loggers || /loggers.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke() 2017-09-18 15:30:34.863 INFO 5904 --- [ main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/mappings || /mappings.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke() 2017-09-18 15:30:34.864 INFO 5904 --- [ main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/metrics/{name:.*}],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.MetricsMvcEndpoint.value(java.lang.String) 2017-09-18 15:30:34.864 INFO 5904 --- [ main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/metrics || /metrics.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke() 2017-09-18 15:30:34.865 INFO 5904 --- [ main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/dump || /dump.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke() 2017-09-18 15:30:34.865 INFO 5904 --- [ main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/beans || /beans.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke() 2017-09-18 15:30:34.866 INFO 5904 --- [ main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/configprops || /configprops.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke() 2017-09-18 15:30:34.867 INFO 5904 --- [ main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/auditevents || /auditevents.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public org.springframework.http.ResponseEntity<?> org.springframework.boot.actuate.endpoint.mvc.AuditEventsMvcEndpoint.findByPrincipalAndAfterAndType(java.lang.String,java.util.Date,java.lang.String) 2017-09-18 15:30:34.867 INFO 5904 --- [ main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/autoconfig || /autoconfig.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke() 2017-09-18 15:30:34.990 INFO 5904 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup 2017-09-18 15:30:35.000 INFO 5904 --- [ main] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 0 2017-09-18 15:30:35.082 INFO 5904 --- [ main] o.e.jetty.ContextHandler.application : Initializing Spring FrameworkServlet 'dispatcherServlet' 2017-09-18 15:30:35.082 INFO 5904 --- [ main] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization started 2017-09-18 15:30:35.094 INFO 5904 --- [ main] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization completed in 12 ms 2017-09-18 15:30:35.106 INFO 5904 --- [ main] o.e.jetty.server.AbstractConnector : Started ServerConnector#7f6874f2{HTTP/1.1,[http/1.1]}{0.0.0.0:8080} 2017-09-18 15:30:35.106 INFO 5904 --- [ main] .s.b.c.e.j.JettyEmbeddedServletContainer : Jetty started on port(s) 8080 (http/1.1) 2017-09-18 15:30:35.111 INFO 5904 --- [ main] hello.ApplicationKt : Started ApplicationKt in 3.62 seconds (JVM running for 3.982) 2017-09-18 15:30:35.479 INFO 5904 --- [localhost:27017] org.mongodb.driver.cluster : Exception in monitor thread while connecting to server localhost:27017 com.mongodb.MongoSocketOpenException: Exception opening socket at com.mongodb.connection.SocketStream.open(SocketStream.java:63) ~[mongo-java-driver-3.4.2.jar:na] at com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:115) ~[mongo-java-driver-3.4.2.jar:na] at com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:113) ~[mongo-java-driver-3.4.2.jar:na] at java.lang.Thread.run(Thread.java:745) [na:1.8.0_20] Caused by: java.net.ConnectException: Connection refused: connect at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method) ~[na:1.8.0_20] at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85) ~[na:1.8.0_20] at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:345) ~[na:1.8.0_20] at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[na:1.8.0_20] at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[na:1.8.0_20] at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) ~[na:1.8.0_20] at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:1.8.0_20] at java.net.Socket.connect(Socket.java:589) ~[na:1.8.0_20] at com.mongodb.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:57) ~[mongo-java-driver-3.4.2.jar:na] at com.mongodb.connection.SocketStream.open(SocketStream.java:58) ~[mongo-java-driver-3.4.2.jar:na] ... 3 common frames omitted Application Class: package hello import org.springframework.boot.SpringApplication import org.springframework.boot.autoconfigure.EnableAutoConfiguration import org.springframework.context.annotation.Configuration #EnableAutoConfiguration #Configuration class Application fun main(args: Array<String>) { SpringApplication.run(Application::class.java, *args) }
Spring boot doesn't load data to initialize database using data.sql
I am trying to load some data when Spring boot is starting, but data is not getting loaded to database though I do not get any error. Below is the code spring: debug: true datasource: username: root password: **** url: jdbc:mariadb://localhost:3306/customer_registration_service?connectTimeout=100 driver-class-name: org.mariadb.jdbc.Driver initialize: true data: data-mysql.sql validation-query: SELECT 1 test-on-borrow: true jpa: database-platform: org.hibernate.dialect.MySQL5InnoDBDialect properties: hibernate: ddl-auto: validate naming-strategy: org.springframework.boot.orm.jpa.hibernate.SpringNamingStrategy I have data-mysql.sql under src/main/resources In-order to force error, I tried deliberately giving a wrong file name, still I do not get any real error..So it seems like Spring is ignoring the setting altogether EDIT: Here is the startup log [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building customer-registration 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] >>> spring-boot-maven-plugin:1.5.2.RELEASE:run (default-cli) # customer-registration >>> [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) # customer-registration --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 1 resource [INFO] Copying 1 resource [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # customer-registration --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # customer-registration --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory /Users/cheruveettilz/Projects/innovationday/customer-registration-service/src/test/resources [INFO] [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # customer-registration --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] <<< spring-boot-maven-plugin:1.5.2.RELEASE:run (default-cli) # customer-registration <<< [INFO] [INFO] --- spring-boot-maven-plugin:1.5.2.RELEASE:run (default-cli) # customer-registration --- . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v1.5.2.RELEASE) 2017-07-13 19:41:37.055 INFO 83740 --- [ main] c.b.s.customer.registration.Application : Starting Application 2017-07-13 19:41:37.058 INFO 83740 --- [ main] c.b.s.customer.registration.Application : No active profile set, falling back to default profiles: default 2017-07-13 19:41:37.106 INFO 83740 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#4883e67d: startup date [Thu Jul 13 19:41:37 CEST 2017]; root of context hierarchy 2017-07-13 19:41:37.792 INFO 83740 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'httpRequestHandlerAdapter' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$EnableWebMvcConfiguration; factoryMethodName=httpRequestHandlerAdapter; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration; factoryMethodName=httpRequestHandlerAdapter; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/data/rest/webmvc/config/RepositoryRestMvcConfiguration.class]] 2017-07-13 19:41:38.278 INFO 83740 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$4b8a61c9] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2017-07-13 19:41:38.521 INFO 83740 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http) 2017-07-13 19:41:38.530 INFO 83740 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat 2017-07-13 19:41:38.531 INFO 83740 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.11 2017-07-13 19:41:38.598 INFO 83740 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2017-07-13 19:41:38.598 INFO 83740 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1495 ms 2017-07-13 19:41:38.713 INFO 83740 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/] 2017-07-13 19:41:38.716 INFO 83740 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*] 2017-07-13 19:41:38.716 INFO 83740 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*] 2017-07-13 19:41:38.716 INFO 83740 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*] 2017-07-13 19:41:38.716 INFO 83740 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*] 2017-07-13 19:41:39.080 INFO 83740 --- [ main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default' 2017-07-13 19:41:39.094 INFO 83740 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [ name: default ...] 2017-07-13 19:41:39.163 INFO 83740 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.0.12.Final} 2017-07-13 19:41:39.165 INFO 83740 --- [ main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found 2017-07-13 19:41:39.166 INFO 83740 --- [ main] org.hibernate.cfg.Environment : HHH000021: Bytecode provider name : javassist 2017-07-13 19:41:39.206 INFO 83740 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final} 2017-07-13 19:41:39.315 INFO 83740 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL5InnoDBDialect 2017-07-13 19:41:39.841 INFO 83740 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default' 2017-07-13 19:41:40.513 INFO 83740 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for #ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#4883e67d: startup date [Thu Jul 13 19:41:37 CEST 2017]; root of context hierarchy 2017-07-13 19:41:40.575 INFO 83740 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest) 2017-07-13 19:41:40.576 INFO 83740 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) 2017-07-13 19:41:40.598 INFO 83740 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2017-07-13 19:41:40.598 INFO 83740 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2017-07-13 19:41:40.609 INFO 83740 --- [ main] .m.m.a.ExceptionHandlerExceptionResolver : Detected #ExceptionHandler methods in repositoryRestExceptionHandler 2017-07-13 19:41:40.657 INFO 83740 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2017-07-13 19:41:40.801 INFO 83740 --- [ main] o.s.d.r.w.RepositoryRestHandlerAdapter : Looking for #ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#4883e67d: startup date [Thu Jul 13 19:41:37 CEST 2017]; root of context hierarchy 2017-07-13 19:41:40.816 INFO 83740 --- [ main] o.s.d.r.w.RepositoryRestHandlerMapping : Mapped "{[/{repository}/{id}/{property}],methods=[GET],produces=[application/hal+json || application/json]}" onto public org.springframework.http.ResponseEntity<org.springframework.hateoas.ResourceSupport> org.springframework.data.rest.webmvc.RepositoryPropertyReferenceController.followPropertyReference(org.springframework.data.rest.webmvc.RootResourceInformation,java.io.Serializable,java.lang.String,org.springframework.data.rest.webmvc.PersistentEntityResourceAssembler) throws java.lang.Exception 2017-07-13 19:41:40.816 INFO 83740 --- [ main] o.s.d.r.w.RepositoryRestHandlerMapping : Mapped "{[/{repository}/{id}/{property}/{propertyId}],methods=[GET],produces=[application/hal+json || application/json]}" onto public org.springframework.http.ResponseEntity<org.springframework.hateoas.ResourceSupport> org.springframework.data.rest.webmvc.RepositoryPropertyReferenceController.followPropertyReference(org.springframework.data.rest.webmvc.RootResourceInformation,java.io.Serializable,java.lang.String,java.lang.String,org.springframework.data.rest.webmvc.PersistentEntityResourceAssembler) throws java.lang.Exception 2017-07-13 19:41:40.816 INFO 83740 --- [ main] o.s.d.r.w.RepositoryRestHandlerMapping : Mapped "{[/{repository}/{id}/{property}],methods=[DELETE],produces=[application/hal+json || application/json]}" onto public org.springframework.http.ResponseEntity<? extends org.springframework.hateoas.ResourceSupport> org.springframework.data.rest.webmvc.RepositoryPropertyReferenceController.deletePropertyReference(org.springframework.data.rest.webmvc.RootResourceInformation,java.io.Serializable,java.lang.String) throws java.lang.Exception 2017-07-13 19:41:40.817 INFO 83740 --- [ main] o.s.d.r.w.RepositoryRestHandlerMapping : Mapped "{[/{repository}/{id}/{property}],methods=[GET],produces=[application/x-spring-data-compact+json || text/uri-list]}" onto public org.springframework.http.ResponseEntity<org.springframework.hateoas.ResourceSupport> org.springframework.data.rest.webmvc.RepositoryPropertyReferenceController.followPropertyReferenceCompact(org.springframework.data.rest.webmvc.RootResourceInformation,java.io.Serializable,java.lang.String,org.springframework.data.rest.webmvc.PersistentEntityResourceAssembler) throws java.lang.Exception 2017-07-13 19:41:40.817 INFO 83740 --- [ main] o.s.d.r.w.RepositoryRestHandlerMapping : Mapped "{[/{repository}/{id}/{property}],methods=[PATCH || PUT || POST],consumes=[application/json || application/x-spring-data-compact+json || text/uri-list],produces=[application/hal+json || application/json]}" onto public org.springframework.http.ResponseEntity<? extends org.springframework.hateoas.ResourceSupport> org.springframework.data.rest.webmvc.RepositoryPropertyReferenceController.createPropertyReference(org.springframework.data.rest.webmvc.RootResourceInformation,org.springframework.http.HttpMethod,org.springframework.hateoas.Resources<java.lang.Object>,java.io.Serializable,java.lang.String) throws java.lang.Exception 2017-07-13 19:41:40.817 INFO 83740 --- [ main] o.s.d.r.w.RepositoryRestHandlerMapping : Mapped "{[/{repository}/{id}/{property}/{propertyId}],methods=[DELETE],produces=[application/hal+json || application/json]}" onto public org.springframework.http.ResponseEntity<org.springframework.hateoas.ResourceSupport> org.springframework.data.rest.webmvc.RepositoryPropertyReferenceController.deletePropertyReferenceId(org.springframework.data.rest.webmvc.RootResourceInformation,java.io.Serializable,java.lang.String,java.lang.String) throws java.lang.Exception 2017-07-13 19:41:40.819 INFO 83740 --- [ main] o.s.d.r.w.RepositoryRestHandlerMapping : Mapped "{[/{repository}/search],methods=[OPTIONS],produces=[application/hal+json || application/json]}" onto public org.springframework.http.HttpEntity<?> org.springframework.data.rest.webmvc.RepositorySearchController.optionsForSearches(org.springframework.data.rest.webmvc.RootResourceInformation) 2017-07-13 19:41:40.819 INFO 83740 --- [ main] o.s.d.r.w.RepositoryRestHandlerMapping : Mapped "{[/{repository}/search],methods=[HEAD],produces=[application/hal+json || application/json]}" onto public org.springframework.http.HttpEntity<?> org.springframework.data.rest.webmvc.RepositorySearchController.headForSearches(org.springframework.data.rest.webmvc.RootResourceInformation) 2017-07-13 19:41:40.819 INFO 83740 --- [ main] o.s.d.r.w.RepositoryRestHandlerMapping : Mapped "{[/{repository}/search],methods=[GET],produces=[application/hal+json || application/json]}" onto public org.springframework.data.rest.webmvc.RepositorySearchesResource org.springframework.data.rest.webmvc.RepositorySearchController.listSearches(org.springframework.data.rest.webmvc.RootResourceInformation) 2017-07-13 19:41:40.819 INFO 83740 --- [ main] o.s.d.r.w.RepositoryRestHandlerMapping : Mapped "{[/{repository}/search/{search}],methods=[GET],produces=[application/hal+json || application/json]}" onto public org.springframework.http.ResponseEntity<?> org.springframework.data.rest.webmvc.RepositorySearchController.executeSearch(org.springframework.data.rest.webmvc.RootResourceInformation,org.springframework.util.MultiValueMap<java.lang.String, java.lang.Object>,java.lang.String,org.springframework.data.rest.webmvc.support.DefaultedPageable,org.springframework.data.domain.Sort,org.springframework.data.rest.webmvc.PersistentEntityResourceAssembler,org.springframework.http.HttpHeaders) 2017-07-13 19:41:40.819 INFO 83740 --- [ main] o.s.d.r.w.RepositoryRestHandlerMapping : Mapped "{[/{repository}/search/{search}],methods=[GET],produces=[application/x-spring-data-compact+json]}" onto public org.springframework.hateoas.ResourceSupport org.springframework.data.rest.webmvc.RepositorySearchController.executeSearchCompact(org.springframework.data.rest.webmvc.RootResourceInformation,org.springframework.http.HttpHeaders,org.springframework.util.MultiValueMap<java.lang.String, java.lang.Object>,java.lang.String,java.lang.String,org.springframework.data.rest.webmvc.support.DefaultedPageable,org.springframework.data.domain.Sort,org.springframework.data.rest.webmvc.PersistentEntityResourceAssembler) 2017-07-13 19:41:40.820 INFO 83740 --- [ main] o.s.d.r.w.RepositoryRestHandlerMapping : Mapped "{[/{repository}/search/{search}],methods=[OPTIONS],produces=[application/hal+json || application/json]}" onto public org.springframework.http.ResponseEntity<java.lang.Object> org.springframework.data.rest.webmvc.RepositorySearchController.optionsForSearch(org.springframework.data.rest.webmvc.RootResourceInformation,java.lang.String) 2017-07-13 19:41:40.820 INFO 83740 --- [ main] o.s.d.r.w.RepositoryRestHandlerMapping : Mapped "{[/{repository}/search/{search}],methods=[HEAD],produces=[application/hal+json || application/json]}" onto public org.springframework.http.ResponseEntity<java.lang.Object> org.springframework.data.rest.webmvc.RepositorySearchController.headForSearch(org.springframework.data.rest.webmvc.RootResourceInformation,java.lang.String) 2017-07-13 19:41:40.821 INFO 83740 --- [ main] o.s.d.r.w.RepositoryRestHandlerMapping : Mapped "{[/ || ],methods=[OPTIONS],produces=[application/hal+json || application/json]}" onto public org.springframework.http.HttpEntity<?> org.springframework.data.rest.webmvc.RepositoryController.optionsForRepositories() 2017-07-13 19:41:40.822 INFO 83740 --- [ main] o.s.d.r.w.RepositoryRestHandlerMapping : Mapped "{[/ || ],methods=[HEAD],produces=[application/hal+json || application/json]}" onto public org.springframework.http.ResponseEntity<?> org.springframework.data.rest.webmvc.RepositoryController.headForRepositories() 2017-07-13 19:41:40.822 INFO 83740 --- [ main] o.s.d.r.w.RepositoryRestHandlerMapping : Mapped "{[/ || ],methods=[GET],produces=[application/hal+json || application/json]}" onto public org.springframework.http.HttpEntity<org.springframework.data.rest.webmvc.RepositoryLinksResource> org.springframework.data.rest.webmvc.RepositoryController.listRepositories() 2017-07-13 19:41:40.823 INFO 83740 --- [ main] o.s.d.r.w.RepositoryRestHandlerMapping : Mapped "{[/{repository}],methods=[OPTIONS],produces=[application/hal+json || application/json]}" onto public org.springframework.http.ResponseEntity<?> org.springframework.data.rest.webmvc.RepositoryEntityController.optionsForCollectionResource(org.springframework.data.rest.webmvc.RootResourceInformation) 2017-07-13 19:41:40.824 INFO 83740 --- [ main] o.s.d.r.w.RepositoryRestHandlerMapping : Mapped "{[/{repository}],methods=[HEAD],produces=[application/hal+json || application/json]}" onto public org.springframework.http.ResponseEntity<?> org.springframework.data.rest.webmvc.RepositoryEntityController.headCollectionResource(org.springframework.data.rest.webmvc.RootResourceInformation,org.springframework.data.rest.webmvc.support.DefaultedPageable) throws org.springframework.web.HttpRequestMethodNotSupportedException 2017-07-13 19:41:40.824 INFO 83740 --- [ main] o.s.d.r.w.RepositoryRestHandlerMapping : Mapped "{[/{repository}],methods=[GET],produces=[application/hal+json || application/json]}" onto public org.springframework.hateoas.Resources<?> org.springframework.data.rest.webmvc.RepositoryEntityController.getCollectionResource(org.springframework.data.rest.webmvc.RootResourceInformation,org.springframework.data.rest.webmvc.support.DefaultedPageable,org.springframework.data.domain.Sort,org.springframework.data.rest.webmvc.PersistentEntityResourceAssembler) throws org.springframework.data.rest.webmvc.ResourceNotFoundException,org.springframework.web.HttpRequestMethodNotSupportedException 2017-07-13 19:41:40.824 INFO 83740 --- [ main] o.s.d.r.w.RepositoryRestHandlerMapping : Mapped "{[/{repository}],methods=[GET],produces=[application/x-spring-data-compact+json || text/uri-list]}" onto public org.springframework.hateoas.Resources<?> org.springframework.data.rest.webmvc.RepositoryEntityController.getCollectionResourceCompact(org.springframework.data.rest.webmvc.RootResourceInformation,org.springframework.data.rest.webmvc.support.DefaultedPageable,org.springframework.data.domain.Sort,org.springframework.data.rest.webmvc.PersistentEntityResourceAssembler) throws org.springframework.data.rest.webmvc.ResourceNotFoundException,org.springframework.web.HttpRequestMethodNotSupportedException 2017-07-13 19:41:40.824 INFO 83740 --- [ main] o.s.d.r.w.RepositoryRestHandlerMapping : Mapped "{[/{repository}],methods=[POST],produces=[application/hal+json || application/json]}" onto public org.springframework.http.ResponseEntity<org.springframework.hateoas.ResourceSupport> org.springframework.data.rest.webmvc.RepositoryEntityController.postCollectionResource(org.springframework.data.rest.webmvc.RootResourceInformation,org.springframework.data.rest.webmvc.PersistentEntityResource,org.springframework.data.rest.webmvc.PersistentEntityResourceAssembler,java.lang.String) throws org.springframework.web.HttpRequestMethodNotSupportedException 2017-07-13 19:41:40.825 INFO 83740 --- [ main] o.s.d.r.w.RepositoryRestHandlerMapping : Mapped "{[/{repository}/{id}],methods=[OPTIONS],produces=[application/hal+json || application/json]}" onto public org.springframework.http.ResponseEntity<?> org.springframework.data.rest.webmvc.RepositoryEntityController.optionsForItemResource(org.springframework.data.rest.webmvc.RootResourceInformation) 2017-07-13 19:41:40.825 INFO 83740 --- [ main] o.s.d.r.w.RepositoryRestHandlerMapping : Mapped "{[/{repository}/{id}],methods=[HEAD],produces=[application/hal+json || application/json]}" onto public org.springframework.http.ResponseEntity<?> org.springframework.data.rest.webmvc.RepositoryEntityController.headForItemResource(org.springframework.data.rest.webmvc.RootResourceInformation,java.io.Serializable,org.springframework.data.rest.webmvc.PersistentEntityResourceAssembler) throws org.springframework.web.HttpRequestMethodNotSupportedException 2017-07-13 19:41:40.825 INFO 83740 --- [ main] o.s.d.r.w.RepositoryRestHandlerMapping : Mapped "{[/{repository}/{id}],methods=[GET],produces=[application/hal+json || application/json]}" onto public org.springframework.http.ResponseEntity<org.springframework.hateoas.Resource<?>> org.springframework.data.rest.webmvc.RepositoryEntityController.getItemResource(org.springframework.data.rest.webmvc.RootResourceInformation,java.io.Serializable,org.springframework.data.rest.webmvc.PersistentEntityResourceAssembler,org.springframework.http.HttpHeaders) throws org.springframework.web.HttpRequestMethodNotSupportedException 2017-07-13 19:41:40.826 INFO 83740 --- [ main] o.s.d.r.w.RepositoryRestHandlerMapping : Mapped "{[/{repository}/{id}],methods=[PUT],produces=[application/hal+json || application/json]}" onto public org.springframework.http.ResponseEntity<? extends org.springframework.hateoas.ResourceSupport> org.springframework.data.rest.webmvc.RepositoryEntityController.putItemResource(org.springframework.data.rest.webmvc.RootResourceInformation,org.springframework.data.rest.webmvc.PersistentEntityResource,java.io.Serializable,org.springframework.data.rest.webmvc.PersistentEntityResourceAssembler,org.springframework.data.rest.webmvc.support.ETag,java.lang.String) throws org.springframework.web.HttpRequestMethodNotSupportedException 2017-07-13 19:41:40.826 INFO 83740 --- [ main] o.s.d.r.w.RepositoryRestHandlerMapping : Mapped "{[/{repository}/{id}],methods=[PATCH],produces=[application/hal+json || application/json]}" onto public org.springframework.http.ResponseEntity<org.springframework.hateoas.ResourceSupport> org.springframework.data.rest.webmvc.RepositoryEntityController.patchItemResource(org.springframework.data.rest.webmvc.RootResourceInformation,org.springframework.data.rest.webmvc.PersistentEntityResource,java.io.Serializable,org.springframework.data.rest.webmvc.PersistentEntityResourceAssembler,org.springframework.data.rest.webmvc.support.ETag,java.lang.String) throws org.springframework.web.HttpRequestMethodNotSupportedException,org.springframework.data.rest.webmvc.ResourceNotFoundException 2017-07-13 19:41:40.827 INFO 83740 --- [ main] o.s.d.r.w.RepositoryRestHandlerMapping : Mapped "{[/{repository}/{id}],methods=[DELETE],produces=[application/hal+json || application/json]}" onto public org.springframework.http.ResponseEntity<?> org.springframework.data.rest.webmvc.RepositoryEntityController.deleteItemResource(org.springframework.data.rest.webmvc.RootResourceInformation,java.io.Serializable,org.springframework.data.rest.webmvc.support.ETag) throws org.springframework.data.rest.webmvc.ResourceNotFoundException,org.springframework.web.HttpRequestMethodNotSupportedException 2017-07-13 19:41:40.831 INFO 83740 --- [ main] o.s.d.r.w.BasePathAwareHandlerMapping : Mapped "{[/profile],methods=[GET]}" onto org.springframework.http.HttpEntity<org.springframework.hateoas.ResourceSupport> org.springframework.data.rest.webmvc.ProfileController.listAllFormsOfMetadata() 2017-07-13 19:41:40.831 INFO 83740 --- [ main] o.s.d.r.w.BasePathAwareHandlerMapping : Mapped "{[/profile],methods=[OPTIONS]}" onto public org.springframework.http.HttpEntity<?> org.springframework.data.rest.webmvc.ProfileController.profileOptions() 2017-07-13 19:41:40.831 INFO 83740 --- [ main] o.s.d.r.w.BasePathAwareHandlerMapping : Mapped "{[/profile/{repository}],methods=[GET],produces=[application/schema+json]}" onto public org.springframework.http.HttpEntity<org.springframework.data.rest.webmvc.json.JsonSchema> org.springframework.data.rest.webmvc.RepositorySchemaController.schema(org.springframework.data.rest.webmvc.RootResourceInformation) 2017-07-13 19:41:40.832 INFO 83740 --- [ main] o.s.d.r.w.BasePathAwareHandlerMapping : Mapped "{[/profile/{repository}],methods=[OPTIONS],produces=[application/alps+json]}" onto org.springframework.http.HttpEntity<?> org.springframework.data.rest.webmvc.alps.AlpsController.alpsOptions() 2017-07-13 19:41:40.832 INFO 83740 --- [ main] o.s.d.r.w.BasePathAwareHandlerMapping : Mapped "{[/profile/{repository}],methods=[GET],produces=[application/alps+json || */*]}" onto org.springframework.http.HttpEntity<org.springframework.data.rest.webmvc.RootResourceInformation> org.springframework.data.rest.webmvc.alps.AlpsController.descriptor(org.springframework.data.rest.webmvc.RootResourceInformation) 2017-07-13 19:41:40.950 INFO 83740 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup 2017-07-13 19:41:40.999 INFO 83740 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http) 2017-07-13 19:41:41.004 INFO 83740 --- [ main] c.b.s.customer.registration.Application : Started Application in 4.291 seconds (JVM running for 7.001)
Try adding this line in application.properties: spring.sql.init.mode=always Or for Spring Boot before 2.5: spring.datasource.initialization-mode=always
These two lines worked for me: spring.jpa.defer-datasource-initialization=true spring.sql.init.mode=always Unfortunately, the accepted answer spring.datasource.initialization-mode=always is deprecated.
There may be other causes, but this will certainly stop it running: ddl-auto: validate Hibernate will only execute data.sql for create or create-drop; change to ddl-auto: create or ddl-auto: create-drop Spring documentation on database initialization. [EDIT] Hibernate WILL flatten your existing database with this setting - don't do this on production.
This works for me: spring.jpa.hibernate.ddl-auto=create-drop spring.datasource.initialization-mode=always Please remember to not use 'create-drop' on production. It will drop your database after application stop.
You should turn off automatic schema creation: spring.jpa.hibernate.ddl-auto=none More information about initial loading data can be found here: https://www.baeldung.com/spring-boot-data-sql-and-schema-sql
spring.datasource.initialization-mode=always spring.datasource.data=classpath:Data.sql I added these two and it worked.
You should try to set the following property spring.datasource.platform to mysql. Thus, Spring Boot will be able to load the data-${platform}.sql file. You can find more details here.
I had to create two files: one for the schema and one for seed data. src/ main/ resources/ schema.sql data.sql in schema.sql: DROP TABLE IF EXISTS users; CREATE TABLE users ( id INT AUTO_INCREMENT PRIMARY KEY, username VARCHAR(250) NOT NULL, password VARCHAR(250) NOT NULL, ); in data.sql: INSERT INTO users (username, password) VALUES ('nastysloper', 'password');
The property spring.datasource.initialization-mode is deprecated and according to the latest documents of spring boot database can be initialized with an sql file file named "import.sql"; In addition, a file named import.sql in the root of the classpath is executed on startup if Hibernate creates the schema from scratch (that is, if the ddl-auto property is set to create or create-drop). https://docs.spring.io/spring-boot/docs/current/reference/html/howto.html#howto.data-initialization
I'm using Hibernate and for me it didn't work with a file named data.sql. I had to name it import.sql. Other required settings are: spring.sql.init.mode=always
SpringBoot 1.x.x Active by default spring.datasource.initialize=true/false SpringBoot 2.x.x Active by default for EMBEDDED Databases spring.datasource.initialization-mode=embedded/always/never
I had the same exact issue, below is my spring boot application.properties file . -- If you are using a version greater that 2.0 , you need to use import.sql and not data.sql, the problem with data.sql was, it used to load data everytime the application starts. The import.sql just works fine. I was using version 2.7.0 of Spring Boot . spring.datasource.url=jdbc:postgresql://localhost:5432/test_db spring.datasource.username=postgres spring.datasource.password=root spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect spring.jpa.hibernate.ddl-auto=update spring.jpa.defer-datasource-initialization=true spring.jpa.hibernate.show-sql=true spring.jpa.generate-ddl=true
(Tried multiple ways, but at last this worked for me) Try to update the application.properties file with below values: server.port=8080 spring.datasource.driverClassName=org.h2.Driver spring.jpa.database-platform=org.hibernate.dialect.H2Dialect spring.jpa.hibernate.ddl-auto=none spring.jpa.show-sql=true spring.jpa.properties.hibernate.format_sql=true