I have Cucumber Jbehave Test Automation framework which I am trying to sync up with Report Portal. I updated pom.xml, log4j2.xml and ReportPortal.properties file. If I comment out the line reportPortalScenario.instance in AllStories, test is running fine. I never used retrofit before. Please tell me what am I missing. Thanks in Advance
But when I run a test with ReportPortalScenarioFormat.INSTANCE , I see the below error
[ERROR] Failed to execute goal org.jbehave:jbehave-maven-plugin:4.8.1:run-stories-as-embeddables (embeddable-stories) on project insights-acceptance-tests: Execution embeddable-stories of goal org.jbehave:jbehave-maven-plugin:4.8.1:run-stories-as-embeddables failed: A required class was missing while executing org.jbehave:jbehave-maven-plugin:4.8.1:run-stories-as-embeddables: retrofit2/adapter/rxjava2/RxJava2CallAdapterFactory
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.jbehave:jbehave-maven-plugin:4.8.1
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/C:/jpt/m2/repo/org/jbehave/jbehave-maven-plugin/4.8.1/jbehave-maven-plugin-4.8.1.jar
[ERROR] urls[1] = file:/C:/jpt/m2/repo/org/jbehave/jbehave-core/4.8.1/jbehave-core-4.8.1.jar
[ERROR] urls[2] = file:/C:/jpt/m2/repo/junit/junit/4.13.1/junit-4.13.1.jar
[ERROR] urls[3] = file:/C:/jpt/m2/repo/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar
[ERROR] urls[4] = file:/C:/jpt/m2/repo/org/hamcrest/hamcrest/2.1/hamcrest-2.1.jar
[ERROR] urls[5] = file:/C:/jpt/m2/repo/commons-io/commons-io/2.6/commons-io-2.6.jar
[ERROR] urls[6] = file:/C:/jpt/m2/repo/org/apache/commons/commons-lang3/3.7/commons-lang3-3.7.jar
[ERROR] urls[7] = file:/C:/jpt/m2/repo/org/apache/commons/commons-text/1.3/commons-text-1.3.jar
[ERROR] urls[8] = file:/C:/jpt/m2/repo/org/codehaus/plexus/plexus-utils/3.1.0/plexus-utils-3.1.0.jar
[ERROR] urls[9] = file:/C:/jpt/m2/repo/org/freemarker/freemarker/2.3.28/freemarker-2.3.28.jar
[ERROR] urls[10] = file:/C:/jpt/m2/repo/com/thoughtworks/paranamer/paranamer/2.8/paranamer-2.8.jar
[ERROR] urls[11] = file:/C:/jpt/m2/repo/com/thoughtworks/xstream/xstream/1.4.14/xstream-1.4.14.jar
[ERROR] urls[12] = file:/C:/jpt/m2/repo/xmlpull/xmlpull/1.1.3.1/xmlpull-1.1.3.1.jar
[ERROR] urls[13] = file:/C:/jpt/m2/repo/xpp3/xpp3_min/1.1.4c/xpp3_min-1.1.4c.jar
[ERROR] urls[14] = file:/C:/jpt/m2/repo/com/google/code/gson/gson/2.8.5/gson-2.8.5.jar
[ERROR] urls[15] = file:/C:/jpt/m2/repo/org/codehaus/plexus/plexus-interpolation/1.1/plexus-interpolation-1.1.jar
[ERROR] urls[16] = file:/C:/jpt/m2/repo/org/codehaus/plexus/plexus-archiver/1.2/plexus-archiver-1.2.jar
[ERROR] urls[17] = file:/C:/jpt/m2/repo/org/codehaus/plexus/plexus-io/1.0.1/plexus-io-1.0.1.jar
[ERROR] urls[18] = file:/C:/jpt/m2/repo/org/apache/maven/skins/maven-default-skin/1.0/maven-default-skin-1.0.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------: retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :insights-acceptance-tests
Process finished with exit code 1
This is my pom.xml
ependencies>
<dependency>
<groupId>com.epam.reportportal</groupId>
<artifactId>agent-java-jbehave</artifactId>
<version>5.1.1</version>
</dependency>
<dependency>
<groupId>org.jbehave</groupId>
<artifactId>jbehave-core</artifactId>
<version>${jbehave.core.version}</version>
</dependency>
<dependency>
<groupId>com.mastercard.commercial.ta</groupId>
<artifactId>insights-application-driver</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>5.3.2</version>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>3.4.5</version>
</dependency>
<dependency>
<groupId>com.mastercard.commercial.ta</groupId>
<artifactId>tenon-io-lib</artifactId>
<version>3.1.0-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc10</artifactId>
<version>19.3.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.17.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-1.2-api</artifactId>
<version>2.17.1</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.jbehave</groupId>
<artifactId>jbehave-maven-plugin</artifactId>
<version>${jbehave.core.version}</version>
<executions>
<execution>
<id>embeddable-stories</id>
<phase>test</phase>
<configuration>
<includes>
<include>${embeddables}</include>
</includes>
<excludes/>
<ignoreFailureInStories>true</ignoreFailureInStories>
<ignoreFailureInView>false</ignoreFailureInView>
<threads>1</threads>
<metaFilters>
<metaFilter>${meta.filter}</metaFilter>
</metaFilters>
</configuration>
<goals>
<goal>run-stories-as-embeddables</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
log4j2.xml
<?xml version="1.0" encoding="UTF-8"?>
<Configuration packages="com.epam.ta.reportportal.log4j.appender" status="WARN">
<Appenders>
<Console name="ConsoleAppender" target="SYSTEM_OUT">
<PatternLayout
pattern="%d [%t] %-5level %logger{36} - %msg%n%throwable"/>
</Console>
<ReportPortalLog4j2Appender name="ReportPortalAppender">
<PatternLayout
pattern="%d [%t] %-5level %logger{36} - %msg%n%throwable"/>
</ReportPortalLog4j2Appender>
</Appenders>
<Loggers>
<Root level="DEBUG">
<AppenderRef ref="ConsoleAppender" level="info"/>
<AppenderRef ref="ReportPortalAppender"/>
</Root>
</Loggers>
</Configuration>
All Stories.java
public class AllStories extends AdapterUiStories {
/** Set STORY_NAME as "*" to execute all stories. */
private static final String STORY_NAME = "*";
/** This method will select the stories to be executed or re-executed. */
#Override
public List<String> storyPaths() {
String storyPaths = System.getProperty(STORY_PATHS_PROP);
if (storyPaths == null) {
return new StoryFinder()
.findPaths(
CodeLocations.codeLocationFromClass(this.getClass()),
String.format("stories/**/%s.story", STORY_NAME.trim().toLowerCase()),
"");
}
return Arrays.asList(storyPaths.split(FailedStoriesReporter.PATHS_BREAKER));
}
#Override
public Configuration configuration() {
MostUsefulConfiguration configuration = new MostUsefulConfiguration();
configuration.useStoryReporterBuilder(getStoryReporterBuilder(configuration))
.useStoryLoader(new LoadFromClasspath(this.getClass()));
return configuration;
}
private StoryReporterBuilder getStoryReporterBuilder(MostUsefulConfiguration configuration) {
return configuration.storyReporterBuilder()
.withCodeLocation(CodeLocations.codeLocationFromPath("build/reports/jbehave"))
.withDefaultFormats()
.withFormats(Format.HTML, Format.CONSOLE, ReportPortalScenarioFormat.INSTANCE);
}
#Override
protected StoryReporterBuilder getStoryReporterBuilder() {
return super.getStoryReporterBuilder()
.withFailureTraceCompression(false)
.withFailureTrace(true)
.withDefaultFormats();
}
#Override
public ApplicationContext getAnnotatedApplicationContext() {
return new AnnotationConfigApplicationContext(ApplicationConfig.class);
}
You have to specify additional dependencies for jbehave.
Please take a look on our example here: https://github.com/reportportal/examples-java/blob/master/example-jbehave/pom.xml#L56
I've put a comment: "For unknown reason 'jbehave-maven-plugin' does not see these dependencies". Nothing to add here, it's just some kind of bug inside the plugin.
Related
I am new to gRPC integration with SpringBoot.
In spring boot application I have created a module and defined .proto in it.
I have compiled the proto file and generated class files.
I have added the jar of this proto in server and created an api for accepting the request from client.
I have tried invoking the server from bloom rpc, and in response I am getting
"error": "14 UNAVAILABLE: GOAWAY received"
proto file
syntax = "proto3";
package com.test.spi;
option java_multiple_files = true;
option java_package = "com.test.spi";
option java_outer_classname = "RequestTest";
message Request{
Header head = 1;
Body body = 2;
message Header {
string version = 1;
}
message Body {
string type = 1;
}
}
message Response{
Header head = 1;
Body body = 2;
message Header {
string version = 1;
}
message Body {
string desc = 1;
}
}
service Service {
rpc testApi(Request) returns (Response);
}
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>test-service</artifactId>
<groupId>com.test</groupId>
<version>0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>grpc-contract</artifactId>
<packaging>jar</packaging>
<name>grpc-contract</name>
<version>1.0.2-SNAPSHOT</version>
<properties>
<spring.boot.dependencies.version>2.5.2</spring.boot.dependencies.version>
<org.projectlombok.version>1.18.20</org.projectlombok.version>
<io.grpc.version>1.37.0</io.grpc.version>
</properties>
<dependencies>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-netty</artifactId>
<version>${io.grpc.version}</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
<version>4.0.40.Final</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-protobuf</artifactId>
<version>${io.grpc.version}</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-stub</artifactId>
<version>${io.grpc.version}</version>
</dependency>
<dependency>
<groupId>net.devh</groupId>
<artifactId>grpc-spring-boot-starter</artifactId>
<version>2.12.0.RELEASE</version>
<exclusions>
<exclusion>
<groupId>io.grpc</groupId>
<artifactId>grpc-netty-shaded</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<distributionManagement>
</distributionManagement>
<build>
<extensions>
<extension>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>1.7.0</version>
</extension>
</extensions>
<plugins>
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
<version>0.6.1</version>
<configuration>
<protocArtifact>
com.google.protobuf:protoc:3.3.0:exe:${os.detected.classifier}
</protocArtifact>
<pluginId>grpc-java</pluginId>
<pluginArtifact>
io.grpc:protoc-gen-grpc-java:1.4.0:exe:${os.detected.classifier}
</pluginArtifact>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>compile-custom</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
service.java
import io.grpc.stub.StreamObserver;
import net.devh.boot.grpc.server.service.GrpcService;
#GrpcService
public class RequestService extends RequestTestGrpc.RequestTestServiceImplBase {
#Override
public void testApi(Request request, StreamObserver<Response> responseObserver) {
System.out.println("received request:-------------------");
Response.Body body = Response.Body.newBuilder()
.setOrderId("1234567")
.build();
Response response = Response.newBuilder()
.setBody(body)
.build();
responseObserver.onNext(response);
responseObserver.onCompleted();
}
}
console output
2022-04-05 15:16:42.974 DEBUG 20008 --- [-worker-ELG-3-1] io.grpc.netty.NettyServerHandler : [id: 0x8516478e, L:/0:0:0:0:0:0:0:1:9090 - R:/0:0:0:0:0:0:0:1:58123] OUTBOUND GO_AWAY: lastStreamId=2147483647 errorCode=2 length=0 bytes=
2022-04-05 15:16:42.976 DEBUG 20008 --- [-worker-ELG-3-1] i.n.h.c.http2.Http2ConnectionHandler : [id: 0x8516478e, L:/0:0:0:0:0:0:0:1:9090 - R:/0:0:0:0:0:0:0:1:58123] Sent GOAWAY: lastStreamId '2147483647', errorCode '2', debugData ''. Forcing shutdown of the connection.
2022-04-05 15:16:42.977 INFO 20008 --- [-worker-ELG-3-1] i.g.n.NettyServerTransport.connections : Transport failed
java.lang.NullPointerException: null
at java.base/java.util.regex.Matcher.getTextLength(Matcher.java:1769) ~[na:na]
at java.base/java.util.regex.Matcher.reset(Matcher.java:416) ~[na:na]
at java.base/java.util.regex.Matcher.<init>(Matcher.java:253) ~[na:na]
at java.base/java.util.regex.Pattern.matcher(Pattern.java:1147) ~[na:na]
at java.base/java.util.Formatter.parse(Formatter.java:2608) ~[na:na]
at java.base/java.util.Formatter.format(Formatter.java:2563) ~[na:na]
at java.base/java.util.Formatter.format(Formatter.java:2517) ~[na:na]
at java.base/java.lang.String.format(String.java:2747) ~[na:na]
at io.netty.handler.codec.http2.Http2Exception.connectionError(Http2Exception.java:122) ~[netty-codec-http2-4.1.75.Final.jar:4.1.75.Final]
at io.netty.handler.codec.http2.DefaultHttp2HeadersDecoder.decodeHeaders(DefaultHttp2HeadersDecoder.java:136) ~[netty-codec-http2-4.1.75.Final.jar:4.1.75.Final]
at io.netty.handler.codec.http2.DefaultHttp2FrameReader$HeadersBlockBuilder.headers(DefaultHttp2FrameReader.java:732) ~[netty-codec-http2-4.1.75.Final.jar:4.1.75.Final]
at io.netty.handler.codec.http2.DefaultHttp2FrameReader$2.processFragment(DefaultHttp2FrameReader.java:476) ~[netty-codec-http2-4.1.75.Final.jar:4.1.75.Final]
at io.netty.handler.codec.http2.DefaultHttp2FrameReader.readHeadersFrame(DefaultHttp2FrameReader.java:484) ~[netty-codec-http2-4.1.75.Final.jar:4.1.75.Final]
at io.netty.handler.codec.http2.DefaultHttp2FrameReader.processPayloadState(DefaultHttp2FrameReader.java:253) ~[netty-codec-http2-4.1.75.Final.jar:4.1.75.Final]
at io.netty.handler.codec.http2.DefaultHttp2FrameReader.readFrame(DefaultHttp2FrameReader.java:159) ~[netty-codec-http2-4.1.75.Final.jar:4.1.75.Final]
at io.netty.handler.codec.http2.Http2InboundFrameLogger.readFrame(Http2InboundFrameLogger.java:41) ~[netty-codec-http2-4.1.75.Final.jar:4.1.75.Final]
at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder.decodeFrame(DefaultHttp2ConnectionDecoder.java:173) ~[netty-codec-http2-4.1.75.Final.jar:4.1.75.Final]
at io.netty.handler.codec.http2.Http2ConnectionHandler$FrameDecoder.decode(Http2ConnectionHandler.java:378) ~[netty-codec-http2-4.1.75.Final.jar:4.1.75.Final]
at io.netty.handler.codec.http2.Http2ConnectionHandler$PrefaceDecoder.decode(Http2ConnectionHandler.java:242) [netty-codec-http2-4.1.75.Final.jar:4.1.75.Final]
at io.netty.handler.codec.http2.Http2ConnectionHandler.decode(Http2ConnectionHandler.java:438) [netty-codec-http2-4.1.75.Final.jar:4.1.75.Final]
at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:510) [netty-codec-4.1.75.Final.jar:4.1.75.Final]
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:449) [netty-codec-4.1.75.Final.jar:4.1.75.Final]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:279) [netty-codec-4.1.75.Final.jar:4.1.75.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [netty-transport-4.1.75.Final.jar:4.1.75.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [netty-transport-4.1.75.Final.jar:4.1.75.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) [netty-transport-4.1.75.Final.jar:4.1.75.Final]
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) [netty-transport-4.1.75.Final.jar:4.1.75.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [netty-transport-4.1.75.Final.jar:4.1.75.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [netty-transport-4.1.75.Final.jar:4.1.75.Final]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) [netty-transport-4.1.75.Final.jar:4.1.75.Final]
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166) [netty-transport-4.1.75.Final.jar:4.1.75.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:722) [netty-transport-4.1.75.Final.jar:4.1.75.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:658) [netty-transport-4.1.75.Final.jar:4.1.75.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:584) [netty-transport-4.1.75.Final.jar:4.1.75.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496) [netty-transport-4.1.75.Final.jar:4.1.75.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986) [netty-common-4.1.75.Final.jar:4.1.75.Final]
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) [netty-common-4.1.75.Final.jar:4.1.75.Final]
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [netty-common-4.1.75.Final.jar:4.1.75.Final]
at java.base/java.lang.Thread.run(Thread.java:844) [na:na]
Please help me in resolving this issue.
I had a Maven Java 8 project that got updated for Java 11. As a result I had to update some of the dependencies, in particular de.jensd:fontawesomefx-commons, which I updated to the latest version 11.0 from JFrog Bintray.
Maven downloaded the updated dependencies. While some classes are successfully imported, others aren't:
Note that the compiler is missing GlyphsDude and the package de.jensd.fx.glyphs.fontawesome, and upon examining the JAR file in my local .m2 Maven repository I indeed do not see them. However, examining the source code in its Bitbucket repository (pointed at as the official source repository from the JFrog Bintray page) I do see de.jensd.fx.glyphs.fontawesome.FontAwesomeIcon, so why isn't it in the JAR too?
EDIT:The problem occurred even though I added all dependencies for fontawesomefx. I tried both 9.1.2 and 11.0 sets and the problem persists.
Sample App:
module-info
module sed.test.testproject {
requires javafx.controls;
exports sed.test.testproject;
requires de.jensd.fx.glyphs.commons;
requires de.jensd.fx.glyphs.materialdesignicons;
requires de.jensd.fx.glyphs.fontawesome;
}
Main
import de.jensd.fx.glyphs.fontawesome.FontAwesomeIcon;
import de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView;
import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIcon;
import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIconView;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class App extends Application {
#Override
public void start(Stage primaryStage) {
MaterialDesignIconView materialDesignIconView = new MaterialDesignIconView(MaterialDesignIcon.THUMB_UP);
materialDesignIconView.setSize("4em");
FontAwesomeIconView fontAwesomeIconView = new FontAwesomeIconView(FontAwesomeIcon.ANDROID);
fontAwesomeIconView.setSize("4em");
VBox root = new VBox(materialDesignIconView, fontAwesomeIconView);
Scene scene = new Scene(root, 600, 500);
primaryStage.setTitle("Streaming Test");
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
POM
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>sed.test</groupId>
<artifactId>TestProject</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>14</maven.compiler.source>
<maven.compiler.target>14</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>14</version>
</dependency>
<dependency>
<groupId>de.jensd</groupId>
<artifactId>fontawesomefx-materialdesignfont</artifactId>
<version>2.0.26-9.1.2</version>
</dependency>
<dependency>
<groupId>de.jensd</groupId>
<artifactId>fontawesomefx-commons</artifactId>
<version>9.1.2</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>14</version>
</dependency>
<dependency>
<groupId>de.jensd</groupId>
<artifactId>fontawesomefx-fontawesome</artifactId>
<version>4.7.0-9.1.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>11</release>
</configuration>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.4</version>
<configuration>
<mainClass>sed.test.testproject.App</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</project>
Output
I have problem with a build native build and compilation application by maven. I cant solve error:
package com.victorlaerte.asynctask does not exist
i dont know how to deal with it, libray is added by maven and working properly when i run program by intelij.
compile errors:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project PROJECT_NAME: Compilation failure: Compilation failure:
[ERROR] /C:/Users/xxxx/dir/APP_NAME/src/main/java/api/request/UpdateDownload.java:[6,34] package com.victorlaerte.asynctask does not exist
[ERROR] /C:/Users/xxxx/dir/APP_NAME/src/main/java/api/request/UpdateDownload.java:[18,37] cannot find symbol
[ERROR] symbol: class AsyncTask
[ERROR] /C:/Users/xxxx/dir/APP_NAME/src/main/java/api/request/LicenseCheckStatus.java:[5,34] package com.victorlaerte.asynctask does not exist
[ERROR] /C:/Users/xxxx/dir/APP_NAME/src/main/java/api/request/LicenseCheckStatus.java:[17,41] cannot find symbol
[ERROR] symbol: class AsyncTask
[ERROR] /C:/Users/xxxx/dir/APP_NAME/src/main/java/controller/PreloaderWindowController.java:[4,34] package com.victorlaerte.asynctask does not exist
[ERROR] /C:/Users/xxxx/dir/APP_NAME/src/main/java/api/request/LicenseRegister.java:[7,34] package com.victorlaerte.asynctask does not exist
[ERROR] /C:/Users/xxxx/dir/APP_NAME/src/main/java/api/request/LicenseRegister.java:[19,38] cannot find symbol
The following pom.xml works for me:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>br.com.victorlaerte</groupId>
<artifactId>asynctask</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>12.0.1</version>
</dependency>
<dependency>
<groupId>com.victorlaerte</groupId>
<artifactId>jfx-asynctask</artifactId>
<version>1.0.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.2</version>
<configuration>
<mainClass>HelloFX</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</project>
Java:
import com.victorlaerte.asynctask.AsyncTask;
public class Test extends AsyncTask {
public void onPreExecute() {
}
public Object doInBackground(Object[] objects) {
return null;
}
public void onPostExecute(Object o) {
}
public void progressCallback(Object[] objects) {
}
}
I am new to Jersy framework and when I run a test case using Jersey Framework to test RESTful web-services I am getting an error as "No tests executed".
The test looks as below
import com.sun.jersey.api.client.WebResource;
import com.sun.jersey.test.framework.AppDescriptor;
import com.sun.jersey.test.framework.JerseyTest;
import com.sun.jersey.test.framework.WebAppDescriptor;
import java.net.URISyntaxException;
import javax.json.JsonException;
import javax.json.JsonObject;
import junit.framework.Assert;
import static junit.framework.Assert.assertEquals;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
public class UserServiceTestJersy extends JerseyTest {
public UserServiceTestJersy() {
}
#Override
protected AppDescriptor configure(){
return new WebAppDescriptor.Builder().build();
}
#Test
public void testUserFetchesSuccess() throws JsonException, URISyntaxException{
WebResource webResource=client().resource("http://jsonplaceholder.typicode.com/");
JsonObject json=webResource.path("posts/2").get(JsonObject.class);
assertEquals("1",json.get("userId"));
assertEquals("1",json.get("id"));
}
}
I can't sort out the error. I want to test a RESTful web service. But I am getting exceptions as follows,
Running UserServiceTestJersy
org.apache.maven.surefire.util.SurefireReflectionException: java.lang.reflect.InvocationTargetException; nested exception is java.lang.reflect.InvocationTargetException: null
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175)
at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:107)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:68)
Caused by: org.testng.TestNGException:
Cannot instantiate class UserServiceTestJersy
at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:38)
org.testng.SuiteRunner$DefaultTestRunnerFactory.newTestRunner(SuiteRunner.java:522)
at org.testng.SuiteRunner.init(SuiteRunner.java:157)
at org.testng.SuiteRunner.<init>(SuiteRunner.java:111)
at org.testng.TestNG.createSuiteRunner(TestNG.java:1299)
at org.testng.TestNG.createSuiteRunners(TestNG.java:1286)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
at org.testng.TestNG.run(TestNG.java:1057)
at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:70)
at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:109)
at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:111)
... 9 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:29)
... 28 more
Caused by: java.lang.AbstractMethodError: javax.ws.rs.core.UriBuilder.uri(Ljava/lang/String;)Ljavax/ws/rs/core/UriBuilder;
at javax.ws.rs.core.UriBuilder.fromUri(UriBuilder.java:119)
at com.sun.jersey.test.framework.JerseyTest.getBaseURI(JerseyTest.java:496)
at com.sun.jersey.test.framework.JerseyTest.getContainer(JerseyTest.java:342)
at com.sun.jersey.test.framework.JerseyTest.<init>(JerseyTest.java:165)
at UserServiceTestJersy.<init>(UserServiceTestJersy.java:28)
... 33 more
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Here is my POM file
<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sun.jersey.jersey-test-framework</groupId>
<artifactId>jersey-test-framework-core</artifactId>
<version>1.19.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.jersey.jersey-test-framework</groupId>
<artifactId>jersey-test-framework-external</artifactId>
<version>1.19.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${endorsed.dir}</outputDirectory>
<silent>true</silent>
<artifactItems>
<artifactItem>
<groupId>javax</groupId>
<artifactId>javaee-endorsed-api</artifactId>
<version>7.0</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
I have a java spring mvc web application which use Spring 3.2 and Tomcat 8. I use quartz 2.2 to schedule a task. My controller class is:
#Controller
public class StatusController implements Job
{
#Autowired
WebContentDefinitionService webContentDefinitionService;
public void execute(JobExecutionContext arg0) throws JobExecutionException
{
SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
System.out.println("Starting Job");
try
{
webContentDefinitionService.deletePurgedContents();
webContentDefinitionService.moveContentsToPurged();
}
catch (Exception e)
{
e.printStackTrace();
}
System.out.println("Executed Job");
}
}
and I have a QuartzInitializer class as follows:
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.annotation.WebListener;
import org.quartz.CronScheduleBuilder;
import org.quartz.JobBuilder;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.Trigger;
import org.quartz.TriggerBuilder;
import org.quartz.ee.servlet.QuartzInitializerListener;
import org.quartz.impl.StdSchedulerFactory;
#WebListener
public class QuartzListener extends QuartzInitializerListener {
#Override
public void contextInitialized(ServletContextEvent sce) {
super.contextInitialized(sce);
ServletContext ctx = sce.getServletContext();
StdSchedulerFactory factory = (StdSchedulerFactory) ctx.getAttribute(QUARTZ_FACTORY_KEY);
try {
Scheduler scheduler = factory.getScheduler();
JobDetail jobDetail = JobBuilder.newJob(StatusController.class).build();
Trigger trigger = TriggerBuilder.newTrigger().withIdentity("simple").withSchedule(
CronScheduleBuilder.cronSchedule("0 0/5 * * * ?")).startNow().build();
scheduler.scheduleJob(jobDetail, trigger);
scheduler.start();
} catch (Exception e) {
ctx.log("There was an error scheduling the job.", e);
}
}
}
My porm.xml file is:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>test</groupId>
<artifactId>BasicQuartz</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>BasicQuartz</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz-jobs</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.5</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
Now everything works fine for me until I try to stop my tomcat server. I get error telling that there are multiple threads started by the quartz initializer, but unable to stop them and this may lead to memory leak.
I found lot of similar instances, but could not find a solution that can be applied in my case since I am not using my web.xml file to initialize the quartz scheduler. The error I get on my console is as follows:
Aug 14, 2015 6:25:43 PM org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
Aug 14, 2015 6:25:43 PM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesJdbc
WARNING: The web application [smartwcm-admin] registered the JDBC driver [org.postgresql.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
Aug 14, 2015 6:25:43 PM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads
WARNING: The web application [smartwcm-admin] appears to have started a thread named [DefaultQuartzScheduler_Worker-1] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
java.lang.Object.wait(Native Method)
org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:568)
Aug 14, 2015 6:25:43 PM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads
WARNING: The web application [smartwcm-admin] appears to have started a thread named [DefaultQuartzScheduler_Worker-2] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
java.lang.Object.wait(Native Method)
I had the same issue, which I solved with the following setting
SchedulerFactoryBean.setWaitForJobsToCompleteOnShutdown(true);
Have you tried to shut the Scheduler down, when stopping the application? Scheduler (like other threadpools) has a shutdown() and a shutdown(boolean waitForTasks) method.