Spring Cloud Data Flow Local Server Jar - java.lang.NoClassDefFoundError - spring

Recently I updated my JDK from 8 (1.8_275) to 11 (openjdk version "11.0.9.1" 2020-11-04)
While I am trying to launch SCDF local server using
java -jar spring-cloud-dataflow-server-local-1.7.4.RELEASE.jar
It had no issues at all while I used JDK 8. But with JDK 11, I am getting below exception:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name
'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]:
Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError:
javax/xml/bind/JAXBException
I looked here and here. Even trying (with --add-modules java.xml.bind):
java -jar spring-cloud-dataflow-server-local-1.7.4.RELEASE.jar --add-modules java.xml.bind
results in the same error as mentioned above.
I understand, as per this, it is removed in JDK 11. But What I am missing here? I mean how can I make it work or what is work around for this?

You're using an ancient and deprecated version of SCDF. The 1.x version of SCDF has reached EOL/EOGS, as well. In particular, the version you're using is >2yrs old.
Please upgrade to the 2.x version. The latest GA is at 2.7.0.
Check out the getting-started guide and the release blog for more details.

You could try running without internet connection. They didn’t update the pre-built jars properly and it must be behind a firewall also. Try kubernetes too.

Related

Trouble deploying Grails 5.1.1 app on tomcat

I have created a Grails 5.1.1 app from the command line with "grails create-app".
It runs fine, from the command line "grails run-app", and I can build a war file which can be run from the command line with "java -jar app-0.1.war".
I then attempted to follow the instructions for deploying in a container (Tomcat 8 and Tomcat 9 in my case) by adding the context-path and changing the build dependency. The documentation says to change "org.springframework.boot:spring-boot-starter-tomcat" to provided in build.gradle. "provided" is not a valid option as far as I can tell. I've tried both providedCompile and providedRuntime with the same result as below.
When I deploy the resulting app-0.1-plain.war I get one of two errors:
The bean 'characterEncodingFilter' could not be registered. A bean with that name has already been defined in class path resource [org/springframework/boot/autoconfigure/web/servl
et/HttpEncodingAutoConfiguration.class] and overriding is disabled.
with the suggested remedy of adding: spring.main.allow-bean-definition-overriding=true
results in a circular bean reference for hibernateDatastore.
Caused by: org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'hibernateDatastore': Requested bean is currently in creation: Is there an unresolvable circular reference?
I'm using openjdk version "1.8.0_292" of Java, Gradle 7.2 and I tried deploying on apache-tomcat-8.5.73 and apache-tomcat-9.0.56.
Any ideas about what might be wrong with my set up that prevents the deploy war from running?
Edit: This seems to be a manifestation:
https://github.com/grails/grails-core/issues/12288 and/or
https://github.com/grails/grails-core/issues/12278
Though the work around suggested did not work for me I do not experience the same problem with 5.0.3 as suggested in 12278.

spring boot application with JDK 14 fails to start. no error either

I am upgrading
(JDK 8 + spring boot application (2.1.0.RELEASE)) TO
(JDK 14 + spring boot application (2.3.3.RELEASE))
I am using --enable-preview as part of java command but it silently fails. can't see any logger stmts either. --verbose option is not throwing any error nor warning.
any help?
Thanks for responses. Here are more details.
I use maven to compile and use java directly to run it (thru a shell script) java -jar ./target/fat_00.1.jar
Why I am doing both (spring FM + JDK) at same time?
upgrading JDK kind of forced me to upgrade SFM 2.1 to 2.3 (latest)
what else I tried?
I tried "--enable-preview" while compiling (by changing maven pom maven-compiler-plugin plugin) and adding to "java" command prompt
** java -verbose --enable-preview -jar ./target/fat_00.1.jar**
But none of them give any clue. biggest problem is my spring application exits without any error.
IF I upgrade ONLY spring FW keeping JDK1.8 I get following error:
findById(java.lang.Long) in com.model.repository.MyRepository clashes with findById(ID) in org.springframework.data.repository.CrudRepository
I understand the error its throwing, but does it mean it has no backward compatibility?
How do I find what's going on? without any error thrown anywhere, it is really frustrating.

How do I include a java 9 module at runtime?

I have a server kit that I'm trying to test on the java9 JDK (found here, I'm using the 64-bit Linux version), however I'm encountering the following error shortly after startup:
java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:533)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:186)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:476)
The server kit starts without issue when using java8. Somehow I need to tell the runtime system to include the javax.xml.bind module, however I'm new to java9 and don't know how to do this short of recompiling the entire server kit into a module and adding a dependency on the javax.xml.bind module. Is there a way to resolve this error that doesn't require me to recompile the server kit into a module?
Java EE modules are shipped with the JDK but not resolved by default and java.xml.bind is one of them. In such cases they need to be included explicitly with --add-modules.
In your case, launch with --add-modules java.xml.bind.

EnvironmentCapable Not available Spring 3.2.3

Am trying to integrate Spring 3.2.3 with JSF 2.2.1 and getting an error like Caused by: java.lang.NoClassDefFoundError: org/springframework/core/env/EnvironmentCapable The class is available in my classpath (spring-core-3.2.3.RELEASE.jar) but not sure why this error occurs.
It worked fine when I removed the project from the server, clean/build and restarted again. Thanks.

Grails 1.2.1 with Spring 3.0.0 dependency problem under Jetty

Just moved to Grails 1.2.1 (used 1.1.1 before). Changed application.properties, ran grails upgrade, fixed BuildConfig and Bootstrap - everything works just fine from grails console.
However, getting a problem when deploy packaged war under jetty 6.1.22:
1581 [main] ERROR org.springframework.web.context.ContextLoader - Context initialization failed org.springframework.beans.factory.access.BootstrapException: Error executing bootstraps; nested exception is java.lang.NoSuchMethodError: org.codehaus.groovy.grails.commons.spring.ReloadAwareAutowireCapableBeanFactory.setParameterNameDiscoverer(Lorg/springframework/core/ParameterNameDiscoverer;)V
My project is built with maven2. I researched the war dependencies and see that both spring 2.5.6 and 3.0.0.RELEASE are used there.
I then tried to suppress use of spring 2.5.6 and got a problem with Acegi plugin (using version 0.5.1):
2010-03-10 21:06:56.440:WARN::Nested in org.springframework.beans.factory.access.BootstrapException: Error executing bootstraps; nested exception is java.lang.NoSuchMethodError: org.springframework.web.context.ConfigurableWebApplicationContext.setId(Ljava/lang/String;)V
Any help would be greatly appreciated.
The problem is caused by the fact that in new version of Spring
ConfigurableWebApplicationContext is located in spring-web.jar, but the interface it inherits ConfigurableApplicationContext, which contains setId(String) method is in located in spring-context.jar.
If you have a library which has been compiled against older version of spring-context it will fail with NoMethodFound exception.
The solution is to locate and recompile that library against latest Spring version.
If you are using Spring version below 3.0 you could try to put full Spring bundle Jar instead of separate packages.

Resources