Unable to consume messages with Camel 3.3 and Google Pubsub - apache-camel

I have a small groovy script with Apache camel that is attempting to pull messages from Google Pubsub. This works well on Camel 2.25.1, but camel 3.3.0 does not. Here is the script. I also looked at the Camel 2.x to 3.0 migration guide, but I am unable to find anything relevant to this issue, but perhaps I am mistaken and I would need some help.
My groovy version is 3.0.4 and I am using JDK 11.0.6
#Grapes([
#Grab(group='org.apache.camel', module='camel-core', version='3.3.0'),
#Grab(group='org.apache.camel', module='camel-google-pubsub', version='3.3.0'),
#Grab(group='org.slf4j', module='slf4j-api', version='1.7.30'),
#Grab(group='ch.qos.logback', module='logback-classic', version='1.2.3'),
])
import org.apache.camel.CamelContext
import org.apache.camel.impl.DefaultCamelContext
import org.apache.camel.builder.RouteBuilder
main()
def main() {
println "downloaded camel dependencies"
CamelContext context = new DefaultCamelContext()
context.addRoutes(new ReadFromQueueWithPubsub())
context.start()
addShutdownHook { context.stop() }
synchronized(this){ this.wait() }
}
class ReadFromQueueWithPubsub extends RouteBuilder {
#Override
void configure() {
from("google-pubsub://my_gcp_project:transaction-test-subscriber")
.to("log:input?showAll=true")
}
}
Here is the snippet of logs in debug mode. I can't see anything that's relevant here, but I may be mistaken.
2020-05-28 07:14:51 INFO [o.a.c.i.e.AbstractCamelContext ] - Apache Camel 3.3.0 (CamelContext: camel-1) is starting
2020-05-28 07:14:51 DEBUG [o.a.c.i.e.AbstractCamelContext ] - Using ClassResolver=org.apache.camel.impl.engine.DefaultClassResolver#25478603, PackageScanClassResolver=org.apache.camel.impl.engine.DefaultPackageScanClassResolver#3c7dbf1f, ApplicationContextClassLoader=null, RouteController=org.apache.camel.impl.engine.DefaultRouteController#2efbe938
2020-05-28 07:14:51 INFO [o.a.c.i.e.AbstractCamelContext ] - StreamCaching is not in use. If using streams then its recommended to enable stream caching. See more details at http://camel.apache.org/stream-caching.html
2020-05-28 07:14:51 DEBUG [o.a.c.i.e.AbstractCamelContext ] - Using HeadersMapFactory: org.apache.camel.impl.engine.DefaultHeadersMapFactory#12459991
2020-05-28 07:14:51 DEBUG [o.a.c.i.e.AbstractCamelContext ] - Using ReactiveExecutor: org.apache.camel.impl.engine.DefaultReactiveExecutor#43114981
2020-05-28 07:14:51 DEBUG [o.a.c.i.e.AbstractCamelContext ] - Warming up route id: route1 having autoStartup=true
2020-05-28 07:14:51 DEBUG [o.a.c.s.DefaultProducer ] - Starting producer: Producer[log://input?showAll=true]
2020-05-28 07:14:52 DEBUG [o.a.c.i.e.AbstractCamelContext ] - Route: route1 >>> Route[google-pubsub://my_gcp_project:transaction-test-subscriber -> null]
2020-05-28 07:14:52 DEBUG [o.a.c.i.e.AbstractCamelContext ] - Starting consumer (order: 1000) on route: route1
2020-05-28 07:14:52 DEBUG [o.a.c.s.DefaultConsumer ] - Init consumer: Consumer[google-pubsub://my_gcp_project:transaction-test-subscriber]
2020-05-28 07:14:52 DEBUG [o.a.c.s.DefaultConsumer ] - Starting consumer: Consumer[google-pubsub://my_gcp_project:transaction-test-subscriber]
2020-05-28 07:14:52 INFO [o.a.c.c.g.p.GooglePubsubConsumer ] - Starting Google PubSub consumer for my_gcp_project/transaction-test-subscriber
2020-05-28 07:14:52 DEBUG [o.a.c.i.e.BaseExecutorServiceManager ] - Created new ThreadPool for source: google-pubsub://my_gcp_project:transaction-test-subscriber with name: GooglePubsubConsumer[transaction-test-subscriber]. -> org.apache.camel.util.concurrent.RejectableThreadPoolExecutor#7d726fa1[Running, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0][GooglePubsubConsumer[transaction-test-subscriber]]
2020-05-28 07:14:52 INFO [o.a.c.i.e.AbstractCamelContext ] - Route: route1 started and consuming from: google-pubsub://my_gcp_project:transaction-test-subscriber
2020-05-28 07:14:52 INFO [o.a.c.i.e.AbstractCamelContext ] - Total 1 routes, of which 1 are started
2020-05-28 07:14:52 INFO [o.a.c.i.e.AbstractCamelContext ] - Apache Camel 3.3.0 (CamelContext: camel-1) started in 0.078 seconds
2020-05-28 07:14:52 DEBUG [o.a.c.c.g.p.GooglePubsubConsumer ] - Subscribing to projects/my_gcp_project/subscriptions/transaction-test-subscriber

Closing this out: It looks like there's a bug open in JIRA for this CAMEL-15064 that affects versions >= 3.2

Related

How to configure REST properties in Java-only Camel Main?

I'm working on a simple "hello-world" Camel3 (Camel version 3.4.3) REST API example with the following setup:
REST API is described in OpenAPI specification (Swagger v2.0)
The API spec is converted to Java DSL with camel-restdsl-swagger-plugin
Using Camel Main
100% Java (i.e. no XML)
The example below works as expected but I fail to set jetty port. Therefore on every run the web server runs on a random port. How do I set the port (e.g. to 8081) in the Java code ? It also seems to be possible to set the port in application.properties file. Example of that option is also appreciated.
// https://camel.apache.org/components/latest/others/main.html
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.main.Main;
import org.apache.camel.main.RestConfigurationProperties;
import rest.dsl.generated.Api101;
public class App {
public static void main(String[] args) throws Exception {
Main main = new Main();
// How do I set the rest properties ?
// The code below doesn't seem to have effect.
RestConfigurationProperties p = main.configure().rest()
.withComponent("jetty")
.withHost("localhost")
.withPort(8081)
;
main.configure().addConfiguration(p);
// The route generated by camel-restdsl-swagger-plugin
main.configure().addRoutesBuilder(
new Api101()
);
// The actual route.
main.configure().addRoutesBuilder(
new RouteBuilder() {
public void configure() {
from("direct:rest1")
.routeId("Rest1Route")
.log("START:")
.setBody(constant("{hello: \"Hello, World!\"}"))
.log("END:")
;
}
}
);
main.run(args);
}
}
Generated Api101 code:
package rest.dsl.generated;
import javax.annotation.Generated;
import org.apache.camel.builder.RouteBuilder;
/**
* Generated from Swagger specification by Camel REST DSL generator.
*/
#Generated("org.apache.camel.generator.swagger.PathGenerator")
public final class Api101 extends RouteBuilder {
/**
* Defines Apache Camel routes using REST DSL fluent API.
*/
public void configure() {
rest("/api101")
.get("/hello")
.description("Basic Hello World")
.to("direct:rest1");
}
}
Compilation & run example:
/tmp/openapi$ mvn clean compile exec:java
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------< com.stackoverflow:openapi >----------------------
[INFO] Building openapi 1.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # openapi ---
[INFO] Deleting /tmp/openapi/target
[INFO]
[INFO] --- camel-restdsl-swagger-plugin:3.4.3:generate-with-dto (default) # openapi ---
[INFO] reading from /tmp/openapi/swagger.yaml
[INFO] Generating Camel DSL source in directory: /tmp/openapi/target/generated-sources/restdsl-swagger
[INFO] Generating DTO classes using io.swagger:swagger-codegen-maven-plugin:2.4.12
[INFO] reading from /tmp/openapi/swagger.yaml
[WARNING] Output directory does not exist, or is inaccessible. No file (.swagger-codegen-ignore) will be evaluated.
[WARNING] 'host' not defined in the spec. Default to 'localhost'.
[INFO] writing file /tmp/openapi/target/generated-sources/swagger/src/main/java/io/swagger/client/model/InlineResponse200.java
[WARNING] 'host' not defined in the spec. Default to 'localhost'.
[INFO]
[INFO] --- build-helper-maven-plugin:3.2.0:add-source (default) # openapi ---
[INFO] Source directory: /tmp/openapi/target/generated-sources/restdsl-swagger added.
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # openapi ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) # openapi ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 3 source files to /tmp/openapi/target/classes
[INFO]
[INFO] --- exec-maven-plugin:3.0.0:java (default-cli) # openapi ---
[ App.main()] BaseMainSupport INFO Using properties from: classpath:application.properties;optional=true
[ App.main()] DefaultRoutesCollector INFO No additional Camel XML routes discovered from: classpath:camel/*.xml
[ App.main()] DefaultRoutesCollector INFO No additional Camel XML rests discovered from: classpath:camel-rest/*.xml
[ App.main()] AbstractCamelContext INFO Apache Camel 3.4.3 (camel-1) is starting
[ App.main()] AbstractCamelContext INFO StreamCaching is not in use. If using streams then its recommended to enable stream caching. See more details at http://camel.apache.org/stream-caching.html
[ App.main()] JettyHttpComponent WARN JMX disabled in CamelContext. Jetty JMX extensions will remain disabled.
[ App.main()] log INFO Logging initialized #8774ms to org.eclipse.jetty.util.log.Slf4jLog
[ App.main()] Server INFO jetty-9.4.29.v20200521; built: 2020-05-21T17:20:40.598Z; git: 77c232aed8a45c818fd27232278d9f95a021095e; jvm 11.0.8+10-post-Ubuntu-0ubuntu120.04
[ App.main()] ContextHandler INFO Started o.e.j.s.ServletContextHandler#4d9f9a55{/,null,AVAILABLE}
[ App.main()] AbstractConnector INFO Started ServerConnector#157aa401{HTTP/1.1, (http/1.1)}{0.0.0.0:44267}
[ App.main()] Server INFO Started #8938ms
[ App.main()] InternalRouteStartupManager INFO Route: route1 started and consuming from: jetty:http://0.0.0.0:0/api101/hello
[ App.main()] InternalRouteStartupManager INFO Route: Rest1Route started and consuming from: direct://rest1
[ App.main()] AbstractCamelContext INFO Total 2 routes, of which 2 are started
[ App.main()] AbstractCamelContext INFO Apache Camel 3.4.3 (camel-1) started in 0.225 seconds
[ qtp1580225589-17] Rest1Route INFO START:
[ qtp1580225589-17] Rest1Route INFO END:
^C[ad #0 - CamelHangupInterceptor] DefaultMainShutdownStrategy INFO Received hang up - stopping the main instance.
[ App.main()] AbstractCamelContext INFO Apache Camel 3.4.3 (camel-1) is shutting down
[ad #0 - CamelHangupInterceptor] DefaultMainShutdownStrategy INFO Waiting for CamelContext to graceful shutdown, elapsed: 0.000 seconds
[ App.main()] DefaultShutdownStrategy INFO Starting to graceful shutdown 2 routes (timeout 45 seconds)
[el-1) thread #1 - ShutdownTask] DefaultShutdownStrategy INFO Route: Rest1Route shutdown complete, was consuming from: direct://rest1
[el-1) thread #1 - ShutdownTask] AbstractConnector INFO Stopped ServerConnector#157aa401{HTTP/1.1, (http/1.1)}{0.0.0.0:0}
[el-1) thread #1 - ShutdownTask] ContextHandler INFO Stopped o.e.j.s.ServletContextHandler#4d9f9a55{/,null,UNAVAILABLE}
[el-1) thread #1 - ShutdownTask] DefaultShutdownStrategy INFO Route: route1 shutdown complete, was consuming from: rest://get:/api101:/hello
[ App.main()] DefaultShutdownStrategy INFO Graceful shutdown of 2 routes completed in 0 seconds
[ App.main()] MainLifecycleStrategy INFO CamelContext: camel-1 has been shutdown, triggering shutdown of the JVM.
[ App.main()] AbstractCamelContext INFO Apache Camel 3.4.3 (camel-1) uptime 44.386 seconds
[ App.main()] AbstractCamelContext INFO Apache Camel 3.4.3 (camel-1) is shutdown in 0.037 seconds
/tmp/openapi$
As you can see from the above the web server is available in port 44267:
Started ServerConnector#157aa401{HTTP/1.1, (http/1.1)}{0.0.0.0:44267}
And can be successfully accessed:
$ sudo netstat -tulpn | grep /java
tcp6 0 0 :::44267 :::* LISTEN 16926/java
$ curl http://0.0.0.0:44267/api101/hello
{hello: "Hello, World!"}
$
I found an answer to my secondary question: this is the way to define the port with the properties:
$ cat src/main/resources/application.properties
camel.rest.port=8081
$
This is also the method how to set all the other configuration options mention in the documentation. Might be obvious for Java veterans, but it was not obvious for me.

Apache Camel Route is working under Windows but not Linux

I am executing Camel code in Windows using Eclipse and it is working fine.
However, when I execute the same code in standalone from Linux, the route has print first log but when fetching file it stops without any error.
Here is my code:
from("timer://alertstrigtimer?period=90s&repeatCount=1")
.log(LoggingLevel.INFO, "*******************************Job-Alert-System: Started: alertstrigtimer******************************" + getFileURI(getWorkFilePath(), getWorkFileName()))
.pollEnrich(getFileURI(getWorkFilePath(), getWorkFileName()))
.log(LoggingLevel.INFO, "*******************************Job-Alert-System: Started: alertstrigtimer******************************" + getFileURI(getWorkFilePath(), getWorkFileName()))
.choice()
.when(header("CamelFileName").isNull())
.log(LoggingLevel.INFO, "No File")
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
log.info("Job-Alert-System: No Date File Exist!!!! Calculate 15 Minutes Back and fetching data from Masterdata");
// Do something
}
})
.otherwise()
.log(LoggingLevel.INFO, "Job Alert System: Date File Loaded: ${header.CamelFileName} at ${header.CamelFileLastModified}")
.process(new Processor() {
// Do something by a processor
})
public static String getFileURI(String filePath, String fileName) {
return "file://" + filePath + "?fileName=" + fileName
+ "&preMove=$simple{file:onlyname.noext}.$simple{date:now:yyyy-MM-dd'T'hh-mm-ss}";
}
Here are my logs from the Linux environment:
[main] INFO org.apache.camel.impl.DefaultCamelContext - Apache Camel 2.21.1 (CamelContext: camel-1) is starting
[main] INFO org.apache.camel.management.ManagedManagementStrategy - JMX is enabled
[main] INFO org.apache.camel.impl.converter.DefaultTypeConverter - Type converters loaded (core: 194, classpath: 0)
[main] INFO org.apache.camel.impl.DefaultCamelContext - StreamCaching is not in use. If using streams then its recommended to enable stream caching. See more details at http://camel.apache.org/stream-caching.html
[main] INFO org.apache.camel.impl.DefaultCamelContext - Route: route1 started and consuming from: timer://alertstrigtimer?period=90s&repeatCount=1
[main] INFO org.apache.camel.impl.DefaultCamelContext - Route: loadDataAndAlerts started and consuming from: direct://loadDataAndAlerts
[main] INFO org.apache.camel.impl.DefaultCamelContext - Total 2 routes, of which 2 are started
[main] INFO org.apache.camel.impl.DefaultCamelContext - Apache Camel 2.21.1 (CamelContext: camel-1) started in 0.664 seconds
[Camel (camel-1) thread #1 - timer://alertstrigtimer] INFO route1 - *******************************Job-Alert-System: Started: alertstrigtimer******************************file:///shared/wildfly/work-files/alerts?fileName=LastExecutionTime_JobAlerts.txt&preMove=.2020-10-12T06-48-16
It stops here. It creates a directory structure, but does not move forward.
Logs from My Local Machine:
[main] INFO org.apache.camel.impl.DefaultCamelContext - Apache Camel 2.21.1 (CamelContext: camel-1) is starting
[main] INFO org.apache.camel.management.ManagedManagementStrategy - JMX is enabled
[main] INFO org.apache.camel.impl.converter.DefaultTypeConverter - Type converters loaded (core: 194, classpath: 5)
[main] INFO org.apache.camel.impl.DefaultCamelContext - StreamCaching is not in use. If using streams then its recommended to enable stream caching. See more details at http://camel.apache.org/stream-caching.html
[main] INFO org.apache.camel.impl.DefaultCamelContext - Route: route1 started and consuming from: timer://alertstrigtimer?period=90s&repeatCount=1
[main] INFO org.apache.camel.impl.DefaultCamelContext - Route: loadDataAndAlerts started and consuming from: direct://loadDataAndAlerts
[main] INFO org.apache.camel.impl.DefaultCamelContext - Total 2 routes, of which 2 are started
[main] INFO org.apache.camel.impl.DefaultCamelContext - Apache Camel 2.21.1 (CamelContext: camel-1) started in 0.845 seconds
[Camel (camel-1) thread #1 - timer://alertstrigtimer] INFO route1 - *******************************Job-Alert-System: Started: alertstrigtimer******************************file://null?fileName=null&preMove=null.2020-10-12T10-28-51
[Camel (camel-1) thread #1 - timer://alertstrigtimer] INFO route1 - Job Alert System: Date File Loaded: null.2020-10-12T10-28-51 at 0
It creates directory structure in addition to a file, but the file is not present and it moves forward.

can not invoke chromedriver on Linux (debian) machine

Resources: VM -Debian Linux , Selenium 4 , Chrome V78, ChromeDriver , Jenkins , Maven, JAVA 8
**Issue:** I can not invoke chromedriver on Linux (debian) machine.
I can see message "Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code."
on Jenkins.
Maven command : clean install test
Log Trace:::
[JENKINS REMOTING CAPACITY]===>channel started
Executing Maven: -B -f /var/lib/jenkins/workspace/Maven/pom.xml clean install test
[INFO] Scanning for projects...
[WARNING]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # Land ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 8 source files to /var/lib/jenkins/workspace/Maven/target/test-classes
[INFO]
[INFO] --- maven-surefire-plugin:3.0.0-M3:test (default-test) # Land ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running TestSuite
[INFO ] 2019-09-18 21:51:26.644 [main] BaseClass - [32mINFO[m - Creating Screenshot folder for this current execution.
directory is : /var/lib/jenkins/workspace/Maven/screenshots
directory is exist /var/lib/jenkins/workspace/Maven/logs
directory is exist /var/lib/jenkins/workspace/Maven/test-output
[INFO ] 2019-09-18 21:51:26.655 [main] SetUpTest - [32mINFO[m - ============================================================
[INFO ] 2019-09-18 21:51:26.655 [main] SetUpTest - [32mINFO[m - ====== Initializing Driver, Starting Browser Session =========
[INFO ] 2019-09-18 21:51:26.655 [main] SetUpTest - [32mINFO[m - ============================================================
projectPath is: /var/lib/jenkins/workspace/Maven
[INFO ] 2019-09-18 21:51:26.656 [main] BaseClass - [32mINFO[m - projectPath is: /var/lib/jenkins/workspace/Maven
[INFO ] 2019-09-18 21:51:26.656 [main] BaseClass - [32mINFO[m - Driver value is : null
[INFO ] 2019-09-18 21:51:26.656 [main] BaseClass - [32mINFO[m - chrome driver is here
Starting ChromeDriver 78.0.3904.11 (eaaae9de6b8999773fa33f92ce1e1bbe294437cf-refs/branch-heads/3904#{#86}) on port 4878
Only local connections are allowed.
**Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.**
[INFO ] 2019-09-18 21:51:27.930 [main] SetUpTest -
[INFO ] 2019-09-18 21:51:27.930 [main] SetUpTest - ============ createAccount Test case is Started. ==============
[INFO ] 2019-09-18 21:51:27.931 [main] SetUpTest -
[INFO ] 2019-09-18 21:51:27.932 [main] TestListener -
[INFO ] 2019-09-18 21:51:27.933 [main] TestListener - ===== createAccount - Test case is Skipped =======
[INFO ] 2019-09-18 21:51:27.934 [main] TestListener -
[INFO ] 2019-09-18 21:51:27.934 [main] TestListener - ===== createAccount - Test case is Failed =======
[INFO ] 2019-09-18 21:51:27.941 [main] BaseClass - ******** Disposing Browser Driver **********
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[ERROR] There are test failures. This is the final result
----------------------------------------------------------------
**My code :**
This is my Selenium code:
if (browserName.equalsIgnoreCase("chrome")) {
System.setProperty("webdriver.chrome.driver", "/usr/bin/chromedriver");
ChromeOptions options = new ChromeOptions();
options.addArguments("--verbose");
options.addArguments("--whitelisted-ips=''");
options.addArguments("--disable-extensions");
options.addArguments("--disable-notifications");
options.addArguments("disable-infobars");
options.addArguments("--incognito");
options.addArguments("--disable-gpu");
options.addArguments("--no-sandbox");
options.addArguments("--disable-gpu --disable-software-rasterizer");
options.addArguments("--disable-gpu-sandbox");
options.addArguments("--disable-features=VizDisplayCompositor");
These are options I have tried on chromedriver so far
driver = new ChromeDriver(options); // This line is not being invoked successfully.
------------------------------------------
What I tried so far:
1. I tried firefox browser - which is not launching as well
2. I tried to "chmod 777" files, drivers and folders as per requirement
3. I set up few chrome "options.addArguments" to "disbale GPU" , "headless" and "no sandbox" as per google
4. I looked in VM that if there are already multiple instance opened for Chromedriver via "htop" and other commands to kill the older sessions but I did not see any chrome because it's never been launched
5. https://stgconsulting.com/running-automated-selenium-tests-from-jenkins-on-linux/
6. https://tecadmin.net/setup-selenium-chromedriver-on-ubuntu
Resources: Maven, Chrome,ChromeDriver, Linux(Debian), Java, Testng, jenkins
Link I followed for basic Linux (Debian) set up : https://stgconsulting.com/running-automated-selenium-tests-from-jenkins-on-linux/
Before solution we have been seeing this below error:
[INFO ] 2019-09-20 09:41:19.341 [main] BaseClass - browserName value is : chrome
[INFO ] 2019-09-20 09:41:19.341 [main] BaseClass - chrome driver is here
Starting ChromeDriver 78.0.3904.11 (eaaae9de6b8999773fa33f92ce1e1bbe294437cf-refs/branch-heads/3904#{#86}) on port 29688
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
[INFO ] 2019-09-20 09:41:23.904 [main] SetUpTest - ==========================================================
[INFO ] 2019-09-20 09:41:23.904 [main] SetUpTest - =========== createAccount Test case is Started.
After solution I am not seeing failure/error and I am able to execute lest on Linux (Debian):
[INFO ] 2019-09-20 08:46:30.675 [main] BaseClass - chrome driver is here
Starting ChromeDriver 75.0.3770.140 (2d9f97485c7b07dc18a74666574f19176731995c-refs/branch-heads/3770#{#1155}) on port 9770
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
[1568994392.814][WARNING]: This version of ChromeDriver has not been tested with Chrome version 76.
Sep 20, 2019 8:46:33 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
[INFO ] 2019-09-20 08:46:33.227 [main] BaseClass - Browser is Chrome
solution steps and information:
(1) You can have latest Chrome Linux Browser on your box
(2) Go here https://chromedriver.chromium.org/downloads and do bruteforce of ChromeDriver versions
(3) I am using Chrome linux 77 (as of now 9/20/2019) and chromedriver 76.0.3809.25 , worked for me
(4) "Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code" - got nothing with firewall
(5) Check your Chmod 777 permission for chromeDriver
It's a BROWSER AND CHROME DRIVER MISMTACH , ALL YOU NEED TO DO IS TO CHECK THE COMPATIBILITY

Zap export report is not working in Jenkins

Trying to export report using ZAP in Jenkins.
Getting below errors :-
[ZAP Jenkins Plugin] INITIALIZATION [ SUCCESSFUL ]
REQUIRED PLUGIN(S) ARE MISSING
[ZAP Jenkins Plugin] SHUTDOWN [ START ]
and in local OWASP ZAP/zap.log:-
2018-11-18 09:52:48,551 [main ] INFO Options ParamCertificate - Unsafe SSL renegotiation disabled.2018-11-18 09:52:49,684 [main ] INFO ENGINE - open start - state not modified 2018-11-18 09:52:50,085 [main ] INFO ENGINE - dataFileCache open start2018-11-18 09:52:50,134 [main ] INFO ENGINE - dataFileCache open end2018-11-18 09:52:50,498 [ZAP-daemon] INFO ExtensionFactory - Loading extensions2018-11-18 09:52:50,746 [ZAP-daemon] ERROR ExtensionAutoUpdate - Unable to load the configuration org.apache.commons.configuration.ConfigurationException: Unable to load the configuration
I resolved this issue:- Added add-on exportreport-alpha-5 plugin in the ZAP Home directory (in plugin directory) .

Apache camel file component not moving files

I'm using apache camel 2.12.1 to create a route and then move some files in my local directory, the exmple runs fine but the files are never moved, this is the code for the class.
public class MoveFilesTest {
private static final Log LOG = LogFactory.getLog(MoveFilesTest.class);
public static void main(String args[]) throws Exception {
LOG.debug("create CamelContext");
CamelContext context = new DefaultCamelContext();
// add our route to the CamelContext
context.addRoutes(new RouteBuilder() {
File file = null;
public void configure() {
from("file:data/inbox?delay=100&noop=true")
.process( new Processor() {
public void process(Exchange msg) throws Exception {
File file = msg.getIn().getBody(File.class);
LOG.debug("Processing file: " + file.getName());
}
})
.to("file:data/outbox").end();
}
});
LOG.debug("start the route and let it do its work");
context.start();
context.stop();
}
}
as a note, this code just to work, now i'm working on mac os x 10.7, this is the debug log. i added the noop=false and the delete=true, but the result is the same. thank you
DEBUG [main] (MoveFilesTest.java:24) - create CamelContext
DEBUG [main] (MoveFilesTest.java:45) - start the route and let it do its work
INFO [main] (DefaultCamelContext.java:1498) - Apache Camel 2.12.1 (CamelContext: camel-1) is starting
INFO [main] (ManagedManagementStrategy.java:187) - JMX is enabled
INFO [main] (DefaultTypeConverter.java:50) - Loaded 176 type converters
INFO [main] (DefaultCamelContext.java:1689) - StreamCaching is not in use. If using streams then its recommended to enable stream caching. See more details at http://camel.apache.org/stream-caching.html
INFO [main] (FileEndpoint.java:83) - Endpoint is configured with noop=true so forcing endpoint to be idempotent as well
INFO [main] (FileEndpoint.java:89) - Using default memory based idempotent repository with cache max size: 1000
INFO [main] (DefaultCamelContext.java:2183) - Route: route1 started and consuming from: Endpoint[file://data/inbox?delay=100&noop=true]
INFO [main] (DefaultCamelContext.java:1533) - Total 1 routes, of which 1 is started.
INFO [main] (DefaultCamelContext.java:1534) - Apache Camel 2.12.1 (CamelContext: camel-1) started in 8.936 seconds
INFO [main] (DefaultCamelContext.java:1706) - Apache Camel 2.12.1 (CamelContext: camel-1) is shutting down
INFO [main] (DefaultShutdownStrategy.java:172) - Starting to graceful shutdown 1 routes (timeout 300 seconds)
INFO [Camel (camel-1) thread #2 - ShutdownTask] (DefaultShutdownStrategy.java:600) - Route: route1 shutdown complete, was consuming from: Endpoint[file://data/inbox?delay=100&noop=true]
INFO [main] (DefaultShutdownStrategy.java:217) - Graceful shutdown of 1 routes completed in 0 seconds
INFO [main] (DefaultCamelContext.java:1780) - Apache Camel 2.12.1 (CamelContext: camel-1) uptime 8.953 seconds
INFO [main] (DefaultCamelContext.java:1781) - Apache Camel 2.12.1 (CamelContext: camel-1) is shutdown in 0.013 seconds
Yes, you start Camel and stop it immediately. So, when you put a file to a folder. It wont process cuz camel is already stopped.
Camel contains Main implementation to keep Camel running in standalone application.
There is link: http://camel.apache.org/running-camel-standalone-and-have-it-keep-running.html
CamelContext.start does not block, so basically you are starting the context and then immediately stopping it. You need to wait or block on something until the context should stop. You can reference this thread for some ways of doing this.
I had a similar problem but that was to do with streamCaching() not getting set properly and so the code below was failing
context.getStreamCachingStrategy().setSpoolDirectory(spoolDirectory);
from(uri.toString()).streamCaching().to(destination);
I set the Streaming directly on CamelContext and that solved the problem
CamelContext context = getContext();
context.setStreamCaching(true);
context.getStreamCachingStrategy().setSpoolDirectory(localSpoolDirectory);
context.getStreamCachingStrategy().setSpoolThreshold(Long.parseLong(spoolThreshold.trim()));
context.getStreamCachingStrategy().setBufferSize(Integer.parseInt(bufferSize.trim()));

Resources