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).
Related
I want to include XStream in my RCP project and used a Maven Dependency to add it to my target definition.
<location includeDependencyDepth="infinite" includeDependencyScopes="compile,provided,runtime,test,system,import" includeSource="true" missingManifest="generate" type="Maven">
<dependencies>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.20</version>
<type>jar</type>
</dependency>
</dependencies>
</location>
From this diagram, it seems like xmlpull is present but XStream throws ClassNotFoundException in the constructor.
java.lang.ClassNotFoundException: org.xmlpull.v1.XmlPullParserException cannot be found by xstream_1.4.20
Looking more closely, I see that there are a number of new plugins named wrapped.bundlename. I then reconfigured the Maven Dependency to produce a feature and added the feature to my core feature.
The run configuration picked up the new feature but xmlpull was still not found at runtime. In desperation, I added all plugins (xmlpull included) to the run configuration but there was no improvement.
Is this the right approach for creating plugins from maven dependencies?
When attempting to test a neo4j server using neo4j-harness, I get a noclassdeffound exception when building the embedded Neo4j server
private final Neo4j embeddedNeo4jServer = Neo4jBuilders.newInProcessBuilder()
.withDisabledServer()
.withFixture("")
.build(); // exception here
My pom.xml looks like this:
<dependencies>
<!-- Core Dependencies -->
<dependency><groupId>org.neo4j.driver</groupId><artifactId>neo4j-java-driver</artifactId><version>4.4.5</version></dependency>
<dependency><groupId>org.apache.kafka</groupId><artifactId>kafka-streams</artifactId><version>3.0.0</version></dependency>
<dependency><groupId>org.apache.curator</groupId><artifactId>curator-x-discovery</artifactId><version>4.2.0</version></dependency>
<dependency><groupId>org.json</groupId><artifactId>json</artifactId><version>20211205</version></dependency>
<dependency><groupId>org.slf4j</groupId><artifactId>slf4j-simple</artifactId><version>1.7.30</version></dependency>
<!-- Test Dependencies -->
<dependency><groupId>org.junit.jupiter</groupId><artifactId>junit-jupiter</artifactId><version>5.8.2</version><scope>test</scope></dependency>
<dependency><groupId>org.skyscreamer</groupId><artifactId>jsonassert</artifactId><version>1.5.0</version><scope>test</scope></dependency>
<dependency><groupId>org.neo4j.test</groupId><artifactId>neo4j-harness</artifactId><version>4.4.5</version><scope>test</scope></dependency>
<!-- Spring dependencies for an embedded Kafka instance -->
<dependency><groupId>org.springframework.kafka</groupId><artifactId>spring-kafka</artifactId><version>2.8.3</version><scope>test</scope></dependency>
<dependency><groupId>org.springframework.kafka</groupId><artifactId>spring-kafka-test</artifactId><scope>test</scope><version>2.8.3</version></dependency>
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope><version>2.6.4</version>
<exclusions><exclusion><groupId>org.junit.vintage</groupId><artifactId>junit-vintage-engine</artifactId></exclusion></exclusions></dependency>
<!-- Mockito dependencies - NOTE: the inline dependency replaces the core one, but might be removed in future versions-->
<!--<dependency><groupId>org.mockito</groupId><artifactId>mockito-core</artifactId><version>4.4.0</version><scope>test</scope></dependency>-->
<dependency><groupId>org.mockito</groupId><artifactId>mockito-junit-jupiter</artifactId><version>4.4.0</version><scope>test</scope></dependency>
<dependency><groupId>org.mockito</groupId><artifactId>mockito-inline</artifactId><version>4.4.0</version><scope>test</scope></dependency>
</dependencies>
There is a clash in the version of scala-library used in spring-kafka-test and neo4j-harness.
To resolve this, you can exclude the scala dependency from spring-kafka-test, meaning the neo4j-harness version will be used for both.
To do this, add an exclusion in the pom.xml:
<dependency><groupId>org.springframework.kafka</groupId><artifactId>spring-kafka-test</artifactId><scope>test</scope><version>2.8.3</version>
<exclusions><exclusion><groupId>org.scala-lang</groupId><artifactId>scala-library</artifactId></exclusion></exclusions></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
I am trying to use dependency injection in my eclipse project. I included maven dependency for org.eclipse.e4.core.di in my dependency management pom.
<dependency>
<groupId>org.eclipse.e4</groupId>
<artifactId>org.eclipse.e4.core.di</artifactId>
<version>1.5.0-SDK-4.5.0</version>
</dependency>
And also, in the plugin where I am using dependency injection with compile scope.
<dependency>
<groupId>org.eclipse.e4</groupId>
<artifactId>org.eclipse.e4.core.di</artifactId>
<version>compile</version>
</dependency>
After this, when I try to use the annotation #Inject, I am seeing error and I am not able to see any import suggestion also.
I have tried including the following in the pom also
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.2</version>
</dependency>
What is causing this problem? I am using Java 8.
To use #Inject you must include javax.inject in the Require-Bundle or Import-Package entries in the MANIFEST.MF of your plug-in.
To do this in the MANIFEST.MF editor go to the Dependencies tab and add javax.inject to the Required Plug-ins or Imported Packages section.
When you have done this you should be able to use
import javax.inject.Inject;
in your code.
Note: Only classes created from entries in the e4 Application.e4xmi are injected unless you use ContextInjectionFactory to create the class.
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/