cannot find RooEntity annotation in spring Roo > 1.1.5 - java

We are using spring roo 1.1.5 and we want to upgrade version of spring roo.
We have some classes annotated with RooEntity. For example,
import org.springframework.roo.addon.entity.RooEntity;
#RooEntity
public class X {
...
}
But, I cannot find this class anywhere in later version of spring roo. My maven dependancy is as follows:
<dependency>
<groupId>org.springframework.roo</groupId>
<artifactId>org.springframework.roo.annotations</artifactId>
<version>${roo.version}</version>
<scope>provided</scope>
</dependency>
How do I upgrade spring roo to current version 1.3.1.RELEASE given that we use RooEntity annotation.
Thanks!

RooEntity was replaced by RooJpaActiveRecord. Have a look at http://www.kevinhooke.com/2013/02/06/spring-roo-rooentity-from-1-1-x-replaced-in-1-2-x/

Related

Springboot application start up fails and missing logs when using azure.keyvault.secret.property-sources

I am trying to migrate my springboot application written in kotlin to azure.
I added spring-cloud-azure-starter-keyvault-secrets:4.5.0 dependency in my app, and added below configurations to application.properties.
my.secret=${my-azure-secret}
spring.cloud.azure.keyvault.secret.property-source-enabled=true
spring.cloud.azure.keyvault.secret.property-sources[0].endpoint=<my-vault>.vault.azure.net/
After I add this, the spring boot initialization doesn't work any more and i can't find any logs.
log.info { "Log before springboot initialize" }
SpringApplication(MyApplication::class.java).run(*args)
log.info { "Log after springboot initialize" }
So, Log before springboot initialize is logged, and after that nothing happens (or I can't find any logs afterwards)
I already verified it is not related to any logback settings because if I remove the property spring.cloud.azure.keyvault.secret.property-sources[0].endpoint from application.properties, it boots up properly.
(I also tried to add the additional dependency spring-cloud-azure-dependencies:4.5.0 )
Any clues/hints what is happening and how to resolve it ?
Thanks.
Here I was able to boot the spring application using the same dependencies.
But here I used the latest version of spring-cloud-azure-starter-keyvault-secrets i.e. 5.0.0 also my spring boot version is 3.0.2
my dependencies:
<dependencies>
<dependency> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency> <!-- https://mvnrepository.com/artifact/com.azure.spring/spring-cloud-azure-starter-keyvault-secrets -->
<dependency>
<groupId>com.azure.spring</groupId>
<artifactId>spring-cloud-azure-starter-keyvault-secrets</artifactId>
<version>5.0.0</version>
</dependency>
<dependency> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency></dependencies>
Also I use windows so instead of my_azure_secret instead of the my-azure-secret
output:

NoSuchMethodError: com.zaxxer.hikari.HikariDataSource.getMetricsTrackerFactory()Lcom/zaxxer/hikari/metrics/MetricsTrackerFactory

I'm migrating a Java Spring application to Spring Boot. I've transferred the application-context.xml configuration inside Java beans. However, when I try to launch the Spring Boot app, I get the following error:
java.lang.NoSuchMethodError:
com.zaxxer.hikari.HikariDataSource.getMetricsTrackerFactory()Lcom/zaxxer/hikari/metrics/MetricsTrackerFactory;
It seems like there is something wrong with my configuration or the library version I'm using, but so far I've no clue. I'm using Spring Boot 2.5.6 and HikariCP 2.5.1.
Here is my data source configuration:
#Primary
#Bean(destroyMethod = "close")
DataSource dataSource(DatasourceProperties datasourceProperties) {
return DataSourceBuilder.create()
.type(HikariDataSource.class)
.driverClassName(datasourceProperties.getDriverClassName())
.url(datasourceProperties.getUrl())
.username(datasourceProperties.getUsername())
.password(datasourceProperties.getPassword())
.build();
}
I can provide more configuration and info if needed.
As listed in its reference documentation, Spring Boot 2.5.6 requires Hikari 4.0.3. You should upgrade Hikari.
It was a version issue of HikariCP. I noticed HikariDataSource came from com.zaxxer.HikariCP-java7.2.4.13, which was brought by a Quartz dependency.
I excluded this HikariCP library version from Quartz explicitly
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<version>${quartz.version}</version>
<exclusions>
<exclusion>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP-java7</artifactId>
</exclusion>
</exclusions>
</dependency>

Cannot access org.springframework.ui.velocity.VelocityEngineFactory Method setVelocityEngine()

i have upgraded my java web project from spring boot 1.5.22 to 2.6.6. During this Upgrade the Velocity package is not even deprecated, it got removed. I know that it is recommended to switch to FreeMarker, but as a quick fix i was trying to fix my project.
First i included the following three dependencies to get the old velocity package and classes.
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>4.3.25.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>4.3.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
<version>1.7</version>
</dependency>
After this most of my code got fixed after some changes.
The last remaining problem in my configuration bean is my VelocityConfigurer. I am trying to init a VelocityEngine with some properties and to create a VelocityConfigurer with the freshly created VelocityEngine afterwards. Like i did it before the spring boot update.
import org.apache.velocity.app.Velocity;
import org.apache.velocity.app.VelocityEngine;
import org.apache.velocity.runtime.RuntimeConstants;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.web.servlet.view.velocity.VelocityConfigurer;
#Configuration
public class MailConfig {
#Bean
#Primary
public VelocityConfigurer velocityEngineBean() {
VelocityEngine engine = new VelocityEngine();
engine.setProperty(Velocity.RESOURCE_LOADER, "ds");
engine.setProperty("ds.resource.loader.class", "XXX.CustomDataResourceLoader");
engine.setProperty("spring.velocity.checkTemplateLocation=false", "false");
engine.setProperty("spring.velocity.velocimacro.library", "XXX.vm");
engine.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS, Slf4jLogChute.class.getName());
engine.init();
VelocityConfigurer velocityConfigurer = new VelocityConfigurer();
velocityConfigurer.setVelocityEngine(engine);
return velocityConfigurer;
}
}
But i get the following error. Error: Cannot access org.springframework.ui.velocity.VelocityEngineFactory
I can figure out why it can access this method.
The .jar with the Class is there.VelocityEngineFactory
This won’t work as Spring Boot 2.6 requires Spring Framework 5.3. Velocity support was deprecated in Spring Framework 4.3 and removed in 5.0. If you want to use an up-to-date and supported version of Spring Boot (2.5.x or 2.6.x at the time of writing), you should migrate to an alternative templating engine.

Forcing maven spring boot project to use older version of a dependency instead of a new version from another dependency

I'm running in to a problem where I cannot start a spring boot server due to the same problem listed in this question:
How to set up Spring Boot and log4j2 properly?
I am encountering this scenario because the spring boot project has a dependency on a jar that includes elasticsearch, which includes a new version of slf4j that isn't compatible with spring boot
I tried the recommended solution by implementing every exclusion in the elasticsearch project dependency definition possible, but for some reason the new version keeps being picked up. I cannot seem to force the spring boot project to ignore the logging packages used by the elasticsearch project.
Here is my pom for the spring-boot project, see the dependency for problematic.project.import : http://pastebin.com/Yeq2qk9Y
Here is the pom for the project that is being imported into the spring boot project: http://pastebin.com/gknmf6Tt
The error I am getting is:
Caused by: java.lang.NoSuchMethodError: org.apache.logging.log4j.core.config.ConfigurationFactory.getConfiguration(Lorg/apache/logging/log4j/core/config/ConfigurationSource;)Lorg/apache/logging/log4j/core/config/Configuration;
at org.springframework.boot.logging.log4j2.Log4J2LoggingSystem.loadConfiguration(Log4J2LoggingSystem.java:165)
at org.springframework.boot.logging.log4j2.Log4J2LoggingSystem.loadDefaults(Log4J2LoggingSystem.java:148)
at org.springframework.boot.logging.AbstractLoggingSystem.initializeWithConventions(AbstractLoggingSystem.java:75)
at org.springframework.boot.logging.AbstractLoggingSystem.initialize(AbstractLoggingSystem.java:50)
Any tips on how to get this issue cleared? Is this possible for two versions of this set of libraries to be loaded, each module ignorant to the version they don't need?
You can exclude the cyclic dependencies by using the <exclusions> tag in your pom.xml like this:
<dependency>
<groupId>sample.ProjectB</groupId>
<artifactId>Project-B</artifactId>
<version>1.0-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>sample.ProjectE</groupId> <!-- Exclude Project-E from Project-B -->
<artifactId>Project-E</artifactId>
</exclusion>
</exclusions>
</dependency>
You should exclude the cyclic dependency of the newer version from the dependency which is having it and that way only the older version will be loaded and not both.
Here is the link for more information:
https://maven.apache.org/guides/introduction/introduction-to-optional-and-excludes-dependencies.html

How Configure EasyMock Class Extension 3.1?

I want to add EasyMock Class Extension 3.1 to my project and I have a problem with dependencies of EasyMock 3.1 CE. I add dependencies : cglib-2.2.2.jar and asm-4.0.jar and throws exception :
java.lang.VerifyError: class net.sf.cglib.core.DebuggingClassWriter overrides final method visit.(IILjava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)V
When I use cglib-nodep-2.1_3.jar and asm-4.0.jar throws another exception:
java.lang.NoClassDefFoundError: org/objenesis/ObjenesisHelper
at org.easymock.internal.ObjenesisClassInstantiator.newInstance(ObjenesisClassInstantiator.java:26)
at org.easymock.internal.ClassProxyFactory.createProxy(ClassProxyFactory.java:219)
at org.easymock.internal.MocksControl.createMock(MocksControl.java:70)
How do I configure EasyMock Class Extension 3.1? What dependencies do I need to use?
Easymock extension 3.1 depends upon easymock 3.1, the dependencies are:
cglib: cglib-nodep 2.2.2
org.objenesis: objenesis 1.2
from Maven Easymock.
If you're using maven, then the following dependency will work:
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymockclassextension</artifactId>
<version>3.1</version>
</dependency>
From version 3.0 there is no longer any need to import classextension. Simply do search and replace of all org.easymock.classextension.* with org.easymock.* and just import the "plain" easymock dependency (see the EasyMock 3.0 doc):
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
<version>3.1</version>
</dependency>
Moreover, if you use Maven, you can use the command
mvn dependency:tree
to see all dependencies (transitive as well as non-transitive).

Categories

Resources