Magnolia could not be started java.lang.NoClassDefFoundError - magnolia

I am running an magnolia Application using magnolia-blossom.
I have added this dependency jar below :
<dependency>
<groupId>info.magnolia</groupId>
<artifactId>magnolia-module-standard-templating-kit</artifactId>
<version>2.7</version>
<type>jar</type>
</dependency>
I am getting the error :
Oops, Magnolia could not be started java.lang.NoClassDefFoundError:info/magnolia/dam/provider/AssetProviderNotFoundException
for which Tomcat server is unable to start.
Can anyone suggest me that how can i resolve this Error.

You're missing Magnolia DAM, use this dependency snippet:
<dependency>
<groupId>info.magnolia.dam</groupId>
<artifactId>magnolia-dam</artifactId>
<version>1.2</version>
</dependency>
I found the version used by STK 2.7 by looking at its POM here https://nexus.magnolia-cms.com/content/repositories/magnolia.public.releases/info/magnolia/standard-templating-kit-parent/2.7/standard-templating-kit-parent-2.7.pom

Related

Embedded Kafka test cases are error after adding jsonschema2pojo-core

I have an application that created with Spring boot and Spring kafka libraries. Now I added jsonschema2pojo-core library to my pom file. After adding this jar file my test cases are failing with below error
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'embeddedKafka': Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: scala/runtime/java8/JFunction0$mcZ$sp
Caused by: java.lang.NoClassDefFoundError: scala/runtime/java8/JFunction0$mcZ$sp
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.1.RELEASE</version>
<relativePath />
</parent>
<dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka</artifactId>
</dependency>
<!-- Test Dependencies -->
<dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jsonschema2pojo</groupId>
<artifactId>jsonschema2pojo-core</artifactId>
<version>1.0.2</version>
</dependency>
It's probably similar to this https://docs.spring.io/spring-kafka/docs/2.5.11.RELEASE/reference/html/#jacksonscala-incompatibility
with the library pulling in an incompatible scala library.
Yes, adding
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>2.12.11</version>
</dependency>
fixed it for me; but I can't guarantee that jsonschema2pojo will work with that version.
The scala folks are notorious for breaking API changes in patch releases.

Tomee+Microprofile UnsatisfiedResolutionException

everybody!
Could you give me advice about such an issue.
I have a simple test project in order to test using Microprofile config.
Field of my test class I test:
#Inject
#ConfigProperty(name = "injected.value")
private String injectedValue;
So this is the dependencies section of my pom:
<dependencies>
<!-- https://mvnrepository.com/artifact/org.eclipse.microprofile/microprofile -->
<dependency>
<groupId>org.eclipse.microprofile</groupId>
<artifactId>microprofile</artifactId>
<version>3.3</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
</dependencies>
I build the war and then:
1. when i deploy war into the tomee 8.0.1-microprofile (tomee-maven-plugin with tomeeClassifier set up to microprofile) -> then all works OK.
2. BUT when i deploy war into the tomee 8.0.1-plus (tomee-maven-plugin with tomeeClassifier set up to plus) -> then i got exception:
org.apache.webbeans.exception.WebBeansDeploymentException: javax.enterprise.inject.UnsatisfiedResolutionException: Api type [java.lang.String] is not found with the qualifiers
Qualifiers: [#org.eclipse.microprofile.config.inject.ConfigProperty(name=injected.value, defaultValue=org.eclipse.microprofile.config.configproperty.unconfigureddvalue)]
for injection into Field Injection Point, field name : injectedValue, Bean Owner : ...
More over in case 1 (deploy to tomee 8.0.1-microprofile) when i change pom dependencies to:
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>8.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.microprofile.config</groupId>
<artifactId>microprofile-config-api</artifactId>
<version>1.4</version>
</dependency>
</dependencies>
i got the error:
org.apache.webbeans.exception.WebBeansDeploymentException: javax.enterprise.inject.UnsatisfiedResolutionException: Api type [java.lang.String] is not found with the qualifiers
Qualifiers: [#org.eclipse.microprofile.config.inject.ConfigProperty(name=injected.value, defaultValue=org.eclipse.microprofile.config.configproperty.unconfigureddvalue)]...
Please could anybody help me with this issue?
I need to use Microptofile in the prod and for now, I can't do it.
for the plus and plume version to work, you must include the following property in system.properties:
tomee.mp.scan = all
reference:
http://tomee-openejb.979440.n4.nabble.com/MicroProfile-Integration-in-Plus-and-Plume-td4686818i60.html
another way is using the tomee plugin and adding this property in pom.xml :
<systemVariables>
<tomee.mp.scan>all</tomee.mp.scan>
</systemVariables>

Adding Spring Kafka Maven dependency version 2.2.1.RELEASE encountered ClassNotFoundException

I wanna use Kafka client in Spring boot.
After reading the offical documentaion,
I added the maven dependency.
Then I tried to start Spring Boot. It throws
ClassNotFoundException.
This class is 'org.springframework.kafka.listener.RecordInterceptor '
Could anyone can solve this problem?
Version:
<spring.boot.version>2.2.1.RELEASE</spring.boot.version>
<spring.version>5.2.1.RELEASE</spring.version>
pom.xml:
<dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka</artifactId>
<version>${spring.boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>${spring.boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
<version>${spring.boot.version}</version>
</dependency>
When using Spring Boot, you should let boot manage the version, for Boot 2.2.1, the proper version is 2.3.3.
Docs.
But, when using Boot, you can omit the version and Boot will automatically use the right version.
<dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka</artifactId>
</dependency>

Unable to start server when I use Eureka and actuator

I am using Spring boot version 2.2.0.M4. When I am adding dependencies
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
<version>2.1.2.RELEASE</version>
</dependency>
while starting server it fails to start with below mentioned error
APPLICATION FAILED TO START
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
org.springframework.cloud.client.discovery.health.DiscoveryCompositeHealthIndicator.<init>(DiscoveryCompositeHealthIndicator.java:42)
The correct way of working with Spring Cloud projects versioning is using the dependencyManagement plugin and release trains versions rather than passing versions of separate artifacts manually.
You can get a correct pom generated automatically (with all the correct versions) at start.spring.io.
On the date that question was posted, a version of Spring Cloud supporting Spring Boot 2.2.x has not been released yet. The latest Spring Cloud release version available is Greenwich.SR2, that supports Spring Boot 2.1.6.RELEASE.
UPDATE: Spring Cloud Hoxton.M1 that supports Spring Boot 2.2.0.M4 was released on 3rd July 2019. You can now use it and also generate correct build files with this version from start.spring.io.
For the following dependency:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
The Following spring cloud version worked for me.
<properties>
<java.version>11</java.version>
<spring-cloud.version>Hoxton.SR4</spring-cloud.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

Arquillian can't load LoadableExtension for Websphere Embedded Container

I can't make Arquillian and Websphere Embedded EJBContainer work smoothly together.
Because I can't use the arquillian-was-embedded-8 Jar File (Missing in Company Maven repository and Jenkins).
I try to load the WebSphereExtension (LoadableExtension) in my Junit test without success. Can someone point me to the right solution?
My second question is, even if i load this jar file locally in my IDE i also have problems with the interface (on my EJB's). See the same issue here:
[arquillian-was-embedded-8 runs but can't inject EJB. NullPointerException
How can i avoid this?
My maven Dependencies:
<dependency>
<groupId>com.ibm.websphere</groupId>
<artifactId>com.ibm.ws.ejb.embeddableContainer</artifactId>
<version>8.0.0.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.ibm.websphere</groupId>
<artifactId>endorsed_apis</artifactId>
<version>8.0.0.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>1.1.4.Final</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-build</artifactId>
<version>1.1.4.Final</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-container-spi</artifactId>
<version>1.1.4.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<version>1.1.4.Final</version>
<scope>test</scope>
</dependency>
Java 6, Junit 4.12, IDE Luna 4.4.2
Thank you in advance, I would appreciate it a lot
I found the solution. I don't need to build the artifacts if I use this
in src/test/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension (this is a file name)
with the contents --> /path/to/WebSphereExtension
The second problem I resolve like this:
#EJB(mappedName = "java:global/test/MyEjbTest!com.home.coem.Processor")
Processor test1;
Processor is the interface name and MyEjbTest is the implementation bean!
I hope it will help somebody

Resources