Camel JBang Error : imported package/class does not exist in the Camel Router program - apache-camel

I am using CXF SOAP to invoke a SOAP webservice. Here I am attaching the sample code from GitHub. and the command i use to run is as below.
Git Repository
https://github.com/gtata007/camel-k-soap/tree/develop
JBang run command below :
camel run TestWeb.java --deps=camel-cxf:3.14.0
While I am trying to build/run the application with the camel Jbang command to test this webservice locally, it started throwing an error. Because it is unable to reference the java package/classes from in my route builder java code. What are the possible ways to build this application by referring to the class files?
Below is the error stack trace for reference.
org.joor.ReflectException: Compilation error:
/TestWeb.java:5: error: package org.oorsprong.websamples_countryinfo does not exist
import org.oorsprong.websamples_countryinfo.CountryInfoService;
^
at org.apache.camel.dsl.java.joor.MultiCompile.compileUnit(MultiCompile.java:144)
at org.apache.camel.dsl.java.joor.JavaRoutesBuilderLoader.doLoadRoutesBuilders(JavaRoutesBuilderLoader.java:122)
at org.apache.camel.dsl.support.ExtendedRouteBuilderLoaderSupport.loadRoutesBuilders(ExtendedRouteBuilderLoaderSupport.java:48)
at org.apache.camel.impl.engine.DefaultRoutesLoader.findRoutesBuilders(DefaultRoutesLoader.java:119)
at org.apache.camel.main.DefaultRoutesCollector.collectRoutesFromDirectory(DefaultRoutesCollector.java:148)
at org.apache.camel.main.RoutesConfigurer.configureRoutes(RoutesConfigurer.java:187)
at org.apache.camel.main.BaseMainSupport.configureRoutes(BaseMainSupport.java:652)
at org.apache.camel.main.MainSupport.initCamelContext(MainSupport.java:404)
at org.apache.camel.main.KameletMain.doInit(KameletMain.java:265)
at org.apache.camel.support.service.BaseService.init(BaseService.java:83)
at org.apache.camel.support.service.BaseService.start(BaseService.java:111)
at org.apache.camel.dsl.jbang.core.commands.Run.run(Run.java:560)
at org.apache.camel.dsl.jbang.core.commands.Run.call(Run.java:208)
at org.apache.camel.dsl.jbang.core.commands.Run.call(Run.java:75)
at picocli.CommandLine.executeUserObject(CommandLine.java:2041)
at picocli.CommandLine.access$1500(CommandLine.java:148)
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
at picocli.CommandLine.execute(CommandLine.java:2170)
at org.apache.camel.dsl.jbang.core.commands.CamelJBangMain.run(CamelJBangMain.java:129)
at main.CamelJBang.main(CamelJBang.java:36)
For your information, I have completed the setup of Camel Jbang in my system to test my Camel routes locally before it is deployed to the container. I am using CamelK version 1.10.2.

Related

Apache CXF Plugin 3.3.12 & 3.4.5 not working under Java 11?

I am trying to update my tool chain from Java 8 to 11.
Doing so I run into issues compiling WSDLs to java using the Apache CXF maven plugin.
I tried with the latest two available versions:
org.apache.cxf:cxf-codegen-plugin:3.3.12 and
org.apache.cxf:cxf-codegen-plugin:3.4.5
When I run the wsdl2java goal (phase generate-sources) it first seems to read all the WSDLs and XSDs ok but at the end it invariably ends in compile errors (see below). So it seems as if it generates code that can't be compiled under Java 11!?!
What dependencies do I need to add? Or what other steps are necessary to get this working again?
Error:
...
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /D:/Projects/KStA_ZH_ZHQuest/code/application/zhquest-sam-web-service/target/generated-sources/cxf/ch/adnovum/nevisidm/ws/services/v1_37/AdminServicePortImpl.java:[10,17] package javax.jws does not exist
...
[ERROR] /D:/Projects/KStA_ZH_ZHQuest/code/application/zhquest-sam-web-service/target/generated-sources/cxf/ch/adnovum/nevisidm/ws/services/v1_37/AdminServicePortImpl.java:[14,22] package javax.jws.soap does not exist
[ERROR] /D:/Projects/KStA_ZH_ZHQuest/code/application/zhquest-sam-web-service/target/generated-sources/cxf/ch/adnovum/nevisidm/ws/services/v1_37/AdminServicePortImpl.java:[15,33] package javax.xml.bind.annotation does not exist
Note: I am aware of these threads: CXF codegen maven plugin doesn't work OpenJDK 11 and What dependencies do I need to run Apache CXF with Spring Boot on Java 11? but the dependencies suggested in either did not fix my issue.

Maven cxf-codegen-plugin with NTLM Authentication - fails with java.io.IOException: Server returned HTTP response code: 401 for URL

I'm trying to generate java code using cxf-codegen-plugin for a SOAP webservice that is secured over NTLM. I'm not sure how do pass on the username/pwd/domain information to maven to connect to the remote server while generating the java code. I could open the wsdl using the browser using the username/pwd/domain combination I have. However, I'm wondering how to do it via command-line by passing some extra vm args to - mvn package. Or is there any other plugin config that I can do which helps me to do this?

How call GAE EndpointV2 from Java Client

How can I call GAE Endpoints V2 from my Java Client using google-api-client:1.23.0 library.
I followed the migration description (https://cloud.google.com/endpoints/docs/frameworks/java/migrating) for the backend . Deployment worked fine.
But using the generated endpoints client libs I get the error:
Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: java.lang.NoSuchMethodError: com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient$Builder.setBatchPath(Ljava/lang/String;)Lcom/google/api/client/googleapis/services/AbstractGoogleClient$Builder;
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:133)
Caused by: java.lang.NoSuchMethodError: com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient$Builder.setBatchPath(Ljava/lang/String;)Lcom/google/api/client/googleapis/services/AbstractGoogleClient$Builder;
at com.example.qwarks.backend.qwarksApi.QwarksApi$Builder.setBatchPath(QwarksApi.java:2098)
at com.example.qwarks.backend.qwarksApi.QwarksApi$Builder.<init>(QwarksApi.java:2077)
at com.example.qwarks.utility.Api.<clinit>(Api.java:24)
at com.example.qwarks.screens.SplashScreen.<init>(SplashScreen.java:105)
at com.example.qwarks.Qwarks.create(Qwarks.java:59)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:149)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:126)
I found the problem, I had to remove
compile project(path: ':backend', configuration: 'endpoints')
from my gradle dependencies

Apache CXF wadl2java could not find main class WADLToJava

I need to convert wadl to java pojo, for that i have downloaded apache cxf 3.0.1 version. But when i run wadl2java bat file in my command prompt, i am getting following exception
D:\software\apache-cxf-3.0.1\bin>wadl2java -h
Error: Could not find or load main class org.apache.cxf.tools.wadlto.WADLToJava
Here this script file is looking for WADLToJava class. i have downloaded the apache cxf source distribution, i can see that wadl2java class is there. Please suggest me how i can use apache cxf to generate java files from wadl url.
You need to set CFX_HOME and CLASSPATH environments variables.
CXF_HOME should be your installation dir, in your example;
CXF_HOME=D:\software\apache-cxf-3.0.1\
CLASSPATH is variable used for setting java classpath for wadl2java script, in your windows example;
CLASSPATH=.;%CXF_HOME%\lib\*

WSDL2Java tool error Apache CXF

We get the following error when we use WSDL2Java tool to generate stubs. The webservice is up and running.
WSDLToJava Error: org.apache.cxf.wsdl11.WSDLRuntimeException: Fail to create wsd
l definition from : http://scheduler.heartbeatsoftware.com/scheduler/WebServices
/SampleSNMWebService?wsdl
Caused by : WSDLException: faultCode=PARSER_ERROR: java.lang.IllegalArgumentExce
ption: InputSource must have a ByteStream or CharacterStream
If we donwload the wsdl and generate stubs from that wsdl, they are generated. But the java client using those stubs throws the same exception as above
Strangely when we deploy the same webservice on our LAN such a problem is not encountered stubs are generated sucessfully and the subsequent java client works well.
The webservice is created using apache cxf version 2.2.5 and hosted on tomcat 6
Any pointers would be appreciated
regards
Sameer
Found solution. Just need to modify the wsdl.java.bat to include proxy settings
-Dhttp.proxyHost= -Dhttp.proxyPort=8080

Resources