Problem running project from s4sdk archtypes with artifact id: scp-cf-spring - s4sdk

I'm getting issues in running hello world project when I created it from below command:
mvn archetype:generate -DarchetypeGroupId=com.sap.cloud.s4hana.archetypes -DarchetypeArtifactId=scp-cf-spring -DarchetypeVersion=LATEST
The project gets created fine but when I'm running the application I get an error in creating beans, the error looks something like this:
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name
'com.sap.cloud.sdk.cloudplatform.cache.CacheMonitor': Cannot create
inner bean '(inner bean)#630d4350' of type
[com.sap.cloud.sdk.cloudplatform.cache.CacheMonitor] while setting
bean property 'listener'; nested exception is
org.springframework.beans.factory.CannotLoadBeanClassException: Error
loading class [com.sap.cloud.sdk.cloudplatform.cache.CacheMonitor] for
bean with name '(inner bean)#630d4350' defined in URL
[jar:file:/Users/setup/.m2/repository/com/sap/cloud/s4hana/cloudplatform/caching/2.4.2-SNAPSHOT/caching-2.4.2-SNAPSHOT.jar!/com/sap/cloud/sdk/cloudplatform/cache/CacheMonitor.class]:
problem with class file or dependent class; nested exception is
java.lang.NoClassDefFoundError:
com/sap/cloud/sdk/cloudplatform/monitoring/JmxMonitor . . .
Caused by:
org.springframework.beans.factory.CannotLoadBeanClassException: Error
loading class [com.sap.cloud.sdk.cloudplatform.cache.CacheMonitor] for
bean with name '(inner bean)#630d4350' defined in URL
[jar:file:/Users/setup/.m2/repository/com/sap/cloud/s4hana/cloudplatform/caching/2.4.2-SNAPSHOT/caching-2.4.2-SNAPSHOT.jar!/com/sap/cloud/sdk/cloudplatform/cache/CacheMonitor.class]:
problem with class file or dependent class; nested exception is
java.lang.NoClassDefFoundError:
com/sap/cloud/sdk/cloudplatform/monitoring/JmxMonitor . . .
Caused by: java.lang.ClassNotFoundException:
com.sap.cloud.sdk.cloudplatform.monitoring.JmxMonitor
Please let me know if I should furnish more details.

The fix is: I generated project with version: 2.3.1, it is working fine now.:
mvn archetype:generate -DarchetypeGroupId=com.sap.cloud.s4hana.archetypes -DarchetypeArtifactId=scp-cf-spring -DarchetypeVersion=2.3.1

Related

Mule Migration from 3.8.4 to 3.9.2 jars related issue

Getting below issue while migration from 3.8.4 to 3.9.2 Mule runtime.
java.lang.NoClassDefFoundError: org/springframework/context/ResourceLoaderAware (org.mule.api.lifecycle.InitialisationException) (org.mule.api.config.ConfigurationException)
I have spring spring-context-4.1.9.RELEASE.jar and all default jars in opt folder of Mule runtime.
ResourceLoaderAware class is in this spring-context-4.1.9.RELEASE.jar.
Any idea how do I resolve this issue.
Caused by: org.mule.api.config.ConfigurationException: Error creating bean with name '_muleNotificationManager': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '_muleTransactionManager': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.mule.api.transaction.TransactionManagerFactory org.mule.config.spring.factories.TransactionManagerFactoryBean.txManagerFactory; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean] for bean with name 'entityManagerFactory' defined in class path resource [CCModuleFlood-context.xml]: problem with class file or dependent class; nested exception is java.lang.NoClassDefFoundError: org/springframework/context/ResourceLoaderAware (org.mule.api.lifecycle.InitialisationException) (org.mule.api.config.ConfigurationException)
at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:49) ~[mule-core-3.9.2.jar:3.9.2]
at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:69) ~[mule-core-3.9.2.jar:3.9.2]
at org.mule.context.DefaultMuleContextFactory$1.configure(DefaultMuleContextFactory.java:89) ~[mule-core-3.9.2.jar:3.9.2]
at org.mule.context.DefaultMuleContextFactory.doCreateMuleContext(DefaultMuleContextFactory.java:222) ~[mule-core-3.9.2.jar:3.9.2]
at org.mule.context.DefaultMuleContextFactory.createMuleContext(DefaultMuleContextFactory.java:81) ~[mule-core-3.9.2.jar:3.9.2]
at org.mule.module.launcher.application.DefaultMuleApplication.init(DefaultMuleApplication.java:210) ~[mule-module-launcher-3.9.2.jar:3.9.2]
... 18 more
Error NoClassDefFoundError doesn't mean that it was not able to find the class, it means that there was some previous error loading the class. You need to find the previous error to identify the root cause.
It might that there are some incompatible versions in the classpath that caused the original error.

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultValidator' defined in class path resource

I'm unable to run springboot application because of below error.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultValidator' defined in class path resource [org/springframework/boot/autoconfigure/validation/ValidationAutoConfiguration.class]: Invocation of init method failed; nested exception is java.lang.AbstractMethodError: org.hibernate.validator.internal.engine.ConfigurationImpl.getDefaultParameterNameProvider()Ljavax/validation/ParameterNameProvider;
Please help me.
This looks like an error caused by an illegal mix of spring versions.
Try to run mvn dependency:tree and see whether there are different versions of spring mixed in the classpath.

HTTP ERROR 503 with Spring Framework

I am using appEngine with Spring Framework and maven. I run the application from maven and everything is fine in command line but in browser I found this error.
HTTP ERROR: 503
Problem accessing /. Reason:
SERVICE_UNAVAILABLE
I don't know where I have to fix. Below is the error code in terminal when I try to run with maven. I think Spring framework has big problem in my PC.
[INFO] WARNING: Nested in org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#0': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.handler.MappedInterceptor#0': Cannot create inner bean '(inner bean)' of type [org.springframework.web.servlet.handler.ConversionServiceExposingInterceptor] while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)': Cannot resolve reference to bean 'org.springframework.format.support.FormattingConversionServiceFactoryBean#0' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.format.support.FormattingConversionServiceFactoryBean#0': Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: java.time.format.FormatStyle is a restricted class. Please see the Google App Engine developer's guide for more details.:
[INFO] java.lang.NoClassDefFoundError: java.time.format.FormatStyle is a restricted class. Please see the Google App Engine developer's guide for more details.

I am working on a spring and hibernate web application MySQLDialect not found

When i deploy it shows following error
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory com.quad.dao.RoleDAOImpl.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/mvc-dispatcher-servlet.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Dialect class not found: org.hibernate.dialect.MySQLDialect
but i have hibernate jar file in lib folder.I dont understand why it is giving error.
You do not have your hibernate jar file in your classpath. Add the jars to your classpath and do a clean build.

tomcat error while running spring program

i m running hello world program in spring which works fine with eclipse but when i run it in tomcat separately it shows me error
rg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'urlMapping' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Cannot resolve reference to bean 'helloController' while setting bean property 'urlMap' with key [TypedStringValue: value [/hello.html], target type [null]]; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [net.roseindia.web.HelloWorldController] for bean with name 'helloController' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]; nested exception is java.lang.ClassNotFoundException: net.roseindia.web.HelloWorldController
Looks like net.roseindia.web.HelloWorldController is not in your classpath.

Resources