Handler processing failed; nested exception is java.lang.NoSuchMethodError: org.springframework.web.util.WebUtils.getNativeRequest - nosuchmethoderror

Handler processing failed; nested exception is java.lang.NoSuchMethodError: org.springframework.web.util.WebUtils.getNativeRequest(Ljavax/servlet/ServletRequest;Ljava/lang/Class;)Ljava/lang/Object; I am getting this error after submitting form

It looks like you have class WebUtils from Spring 2.5.x branch (this method has been added in 3.x branch).
Please check your dependencies and search for mixing of libraries from 3.x and 2.5.x branch.

Related

Grails 3 urlMappingsReport failed

I have created a Grails 3 Restful application, using MySQL as my database. The endpoints are working fine when I hit them with Rest Clients like Postman.
I am using this blog for reference. But it fails when I try to run the command grails url-mappings-report.
Here is the output:
:compileJava NO-SOURCE
:compileGroovy
:buildProperties UP-TO-DATE
:processResources
:classes
:findMainClass
:urlMappingsReport
Configuring Spring Security Core ...
... finished configuring Spring Security Core
Configuring Spring Security REST 2.0.0.M2...
... finished configuring Spring Security REST
... with GORM support
2017-10-01 17:45:24.867 ERROR --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
The dependencies of some of the beans in the application context form a cycle:
restTokenValidationFilter
↓
restAuthenticationProvider
↓
tokenStorageService
↓
userDetailsService
┌─────┐
| hibernateDatastore
↑ ↓
| userPasswordEncoderListener
└─────┘
Context failed to load: Error creating bean with name 'restTokenValidationFilter': Cannot resolve reference to bean 'restAuthenticationProvider' while setting bean property 'restAuthenticationProvider'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'restAuthenticationProvider': Cannot resolve reference to bean 'tokenStorageService' while setting bean property 'tokenStorageService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tokenStorageService': Cannot resolve reference to bean 'userDetailsService' while setting bean property 'userDetailsService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDetailsService': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateDatastore': Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.grails.orm.hibernate.HibernateDatastore]: Constructor threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userPasswordEncoderListener': Cannot resolve reference to bean 'hibernateDatastore' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'hibernateDatastore': Requested bean is currently in creation: Is there an unresolvable circular reference?
:urlMappingsReport FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':urlMappingsReport'.
> Process 'command '/usr/lib/jvm/java-8-openjdk-amd64/bin/java'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 37.453 secs
| Error Command [url-mappings-report] error: Could not execute build using Gradle distribution 'https://services.gradle.org/distributions/gradle-3.4.1-bin.zip'. (Use --stacktrace to see the full trace)
Grails Version: 3.2.10
Groovy Version: 2.4.10
JVM Version: 1.8.0_131
Try using GORM version >= 6.1
I get the same issue with GORM version 6.0.12.RELEASE

Spring boot junit test cannot get command line argument (Eclipse - STS)

I did a Spring Boot application, and use some command line arguments. I read them in services like
#Value("${v}")
private String vertical;
Application works and see value passed from command line. I added same command line arguments to all JUnit tests run configurations
--spring.profiles.active=development --m=keyword --v=Healthcare --i=keyword_update.json
But when I try to run test it crashes with message, that means application context cannot get command line attribute:
2016-05-28 17:16:00.924 ERROR 4204 --- [ main]
o.s.boot.SpringApplicat ion : Application startup failed
org.springframework.beans.factory.BeanCreationException: Error
creating bean wit h name 'application': Injection of autowired
dependencies failed; nested excepti on is
org.springframework.beans.factory.BeanCreationException: Could not
autowir e field: healthjobs.service.Catalog
healthjobs.app.Application.catalog; nested e xception is
org.springframework.beans.factory.BeanCreationException: Error creat
ing bean with name 'catalogImpl': Injection of autowired dependencies
failed; ne sted exception is
org.springframework.beans.factory.BeanCreationException: Could not
autowire field: healthjobs.service.CatalogPage
healthjobs.service.CatalogIm pl.catalogPage; nested exception is
org.springframework.beans.factory.BeanCreati onException: Error
creating bean with name 'catalogPageImpl': Injection of autow ired
dependencies failed; nested exception is
org.springframework.beans.factory. BeanCreationException: Could not
autowire field: private java.lang.String health
jobs.service.CatalogPageImpl.vertical; nested exception is
java.lang.IllegalArgu mentException: Could not resolve placeholder 'v'
in string value "${v}"
Why? How to run tests with command line arguments in spring boot?
PS full stack trace appears too long to attach here. When I run mvn package I get same error about test, but mvn run config does not have ability to input command line arguments. My environment:
Spring Tool Suite Version: 3.7.2.RELEASE Build Id: 201511261048
Platform: Eclipse Mars.1 (4.5.1)

Spring Boot DatasourceBean error, Macbook, MySQL

I'm getting the following error when I deploy my application to Tomcat 8. I have MySQL installed on my macbook :
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate com.catalina.productcarried.dao.impl.ProductCarriedDAOImpl.jdbcTemplate; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$JdbcTemplateConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private javax.sql.DataSource org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$JdbcTemplateConfiguration.dataSource; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration$NonEmbeddedConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:573) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
... 26 common frames omitted
Here is my application.properties file :
#Database properties local
spring.datasource.url=jdbc:mysql://localhost:3306/simulator?autoReconnect=true&useSSL=false
spring.datasource.username=root
spring.datasource.password=
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
debug=true
Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).
Your application.properties is not taken into account for some reason. Note that the driver-classis unnecessary, Spring Boot detects that from the url parameter.
Make sure to review the following:
The mysql driver is defined in your dependencies
The content of the application.properties file you provided in description is in one of the supported locations

BeanCreationException in grails deployment on linux env

I am trying to deploy a war file created using grails on tomcat6. The same war files works just alright on my windows machine it does give me following exception with prod linux environment
SEVERE: Exception sending context initialized event to listener instance of class org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'hibernateProperties' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class 'com.mysql.jdbc.Driver'
and
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class 'com.mysql.jdbc.Driver'
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:329)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:107)
I have already gone through
How do I fix the org.springframework.beans.factory.BeanCreationException error in my Grails application?
and
Grails transactionManager exception on Run
but it die not help
Scroll to the end where it says Cannot load JDBC driver class 'com.mysql.jdbc.Driver'. It's usually the case with Grails exceptions that the top-level text is generic and useless, and the real cause is further down near the bottom.
I'm guessing you put the MySQL driver jar in the lib directory, but Grails didn't find it there. You shouldn't use jars unless they're not available in an online repo, and the MySQL driver certainly is. In fact it's the sample entry in BuildConfig.groovy in the dependencies block. Uncomment that, optionally updating to the latest version (5.1.28), and redeploy your war file. Make sure it's there in the file, in WEB-INF/lib

RESTEasy gives NoClassDefFoundError for HeaderParameterParser

I have written simple RESTEasy Hello World web-service. It used to work just fine when invoked from IE or from within Eclipse(RAD), but when I hit it from Google Chrome, it used give Exception saying.
com.ibm.ws.webcontainer.servlet.ServletWrapper service Uncaught service() exception thrown by servlet RestEasy: java.lang.NoClassDefFoundError: org/jboss/resteasy/util/HeaderParameterParser
at org.jboss.resteasy.plugins.delegates.MediaTypeHeaderDelegate.parse(MediaTypeHeaderDelegate.java:57)
at org.jboss.resteasy.plugins.delegates.MediaTypeHeaderDelegate.fromString(MediaTypeHeaderDelegate.java:18)
at javax.ws.rs.core.MediaType.valueOf(MediaType.java:150)
at org.jboss.resteasy.util.MediaTypeHelper.parseHeader(MediaTypeHelper.java:203)
at org.jboss.resteasy.plugins.server.servlet.ServletUtil.extractAccepts(ServletUtil.java:120)
at org.jboss.resteasy.plugins.server.servlet.ServletUtil.extractHttpHeaders(ServletUtil.java:83)
at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:186)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1224)
But now this Exception is occurring in all the cases.
I am sure that the jar file containing HeaderParameterParser class which is restreasy-jaxrs2.2.3.GA.jar is on the classpath.
I am using
RESTEasy 2.2.3.GA(also tried with 3.o.1Final).
Websphere Application Server v8.0
RAD 8.0
Maven