thorntail microservice access from another microservice via proxy interface throws java.util.ServiceConfigurationError - interface

Two thorntail microservices have been deployed on my localhost ports 8080 [as rest api server] and 8180 [as rest-client one]. The client microservice can access the rest api on server if client project is deployed using $java -jar client-thorntail.jar and everything looks OK. But if client project is deployed using $mvn thorntail:run then client service is deployed without errors; but throws following exception when the rest api on itself that internally calls rest api via proxy interface on server microservice:
UT005023: Exception handling request to /client/getSum/70/10: org.jboss.resteasy.spi.UnhandledException: java.util.ServiceConfigurationError: org.eclipse.microprofile.rest.client.spi.RestClientBuilderResolver: Provider org.jboss.resteasy.microprofile.client.BuilderResolver not a subtype
I tried it using both thorntail version 2.5.0.Final and 2.6.0.Final. But, not fixed. Any fixes or workarounds would be helpful.

Unfortunately, mvn thorntail:run suffers from classloading problems, because it doesn't run the application from an uberjar, but from classpath. There's a JIRA somewhere for this exact problem (RestClient not working). I'd recommend always using mvn thorntail:run -Dthorntail.useUberJar, that should work.

Related

Create Service broker for Play Framework Api

I have created a sample play framework api which has one endpoint.
http://play-demo-broker.cfapps.io/say?number=20
Which just return me number that have passed.
I am able successfully deploy the service. Next want this service to Act like service broker
For same want to register this as by using below command
cf create-service-broker play-demo-broker admin admin http://play-demo-broker.cfapps.io --space-scoped
This command it giving me below error -
The service broker rejected the request. Status Code: 404 Not Found
Not sure what is causing this issue as there not much information available for Play Framework Service broker Setup.
The play framework is implemented above the akka packages. Akka rejects paths that are not implemented.
If I an not mistaken, cf create-service-broker command access the / endpoint. If you implemented only say?number=20 endpoint, then be default all other paths, such as the empty path, are rejected by Akka.
In order to open that endpoint you need to add it into the routes.
For example you can add:
GET / controllers.ControllerName.GetEmptyPath
And implement the GetEmptyPath method in ControllerName

Can a Spring Cloud Gateway App be Enabled as a Cloud Config Server?

I'm trying to enable a Spring Cloud Gateway app to automatically refresh its routing config yml on the fly. I have been able to set up a Cloud Config server to host the route YAML and enabled the Spring Cloud Gateway to automatically refresh its config via a #Scheduled contextRefresher.refresh() usage. However, this requires two running apps, and we want to try to minimize the number of additional servers needed to support this requirement.
The Spring Cloud Config Server documentation suggests any boot app can be embedded with a config server via the #EnableConfigServer annotation: https://cloud.spring.io/spring-cloud-static/spring-cloud.html#_spring_cloud_config_server
However, when attempting to introduce the spring-cloud-config-server module in my Gateway's build.gradle, I run into the following error on startup:
org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.http.codec.ServerCodecConfigurer' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
From the discussion here (https://github.com/spring-cloud/spring-cloud-gateway/issues/319) it seems that the issue above arises because spring-boot-starter-web is incompatible w/ Gateway; Gateway is a Netty app and spring-boot-starter-web uses tomcat/servlets. When trying to exclude spring-boot-starter-web from the cloud-config-server module, the app fails again w/:
onfigReactiveWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [org.springframework.cloud.config.server.config.ConfigServerAutoConfiguration]; nested exception is java.io.FileNotFoundException: class path resource [org/springframework/web/servlet/config/annotation/WebMvcConfigurerAdapter.class] cannot be opened because it does not exist
Is it the case that a Spring Cloud Gateway app cannot be enabled as a CloudConfig server? Or am I missing something.
FWIW my sprincCloudVersion is Finchley.SR1
They can not. Config server is based on spring MVC (servlets), gateway is based on spring webflux and Netty. They are not compatible and cannot be run together.

Jboss fuse- running route with cxf endpoint in local camel context

I am working on a fuse project in Jbds. I am running a route as local camel context. It has cxf endpoint(soap), route started and started listening at /order/. If anyone has experience running camel context with cxf end point locally in the jbds, would you please let me know how to send soap message to this route which running in local camel context in jbds?
Are you looking to invoke webservice from java (client)?
you can use Service.create to create Service instances, the following code illustrates this process:
import java.net.URL;
import javax.xml.ws.Service;
URL wsdlURL = new URL("http://localhost/hello?wsdl");
QName SERVICE_NAME = new QName("http://apache.org/hello_world_soap_http", "SOAPService");
Service service = Service.create(wsdlURL, SERVICE_NAME);
Greeter client = service.getPort(Greeter.class);
For More info refer apache cxf documentation [1]
[1]http://cxf.apache.org/docs/how-do-i-develop-a-client.html
Please follow the steps to test the SOAP service exposed. The steps details are mentioned in the image link.Image for the steps to be taken.
See all the services exposed by CXF service (SOAP).
See the WSDL for the services exposed by CXF (SOAP).
Open SOAPUI and create new SOAP project.
Enter the details i.e WSDL URL in project detail.
The project will be displayed on the left-hand side.
Open the request in SOAPUI.
Fill the request and hit the green submit button.

Weblogic 12c kerberos application

I have written an application which extends CAS 3.5.3
CAS supports Kerberos protocol for authentication. So when I deploy this application on tomcat/jboss etc, I am able to login to my application via Kerberos. I have done settings on jboss. However wasn't able to find any concrete documentation for weblogic.
The documents I have found is
http://www.oracle.com/technetwork/articles/idm/weblogic-sso-kerberos-1619890.html - but this seems to be for securing the Weblogic console and now for my application.
When I try to login, getting the following error :-
Caused by: java.lang.IllegalArgumentException: No Configuration was registered that can handle the configuration named jcifs.spnego.accept
at com.bea.common.security.jdkutils.JAASConfiguration.getAppConfigurationEntry(JAASConfiguration.java:130)
at javax.security.auth.login.LoginContext.init(LoginContext.java:259)
at javax.security.auth.login.LoginContext.(LoginContext.java:425)
... 144 more
It took quiet a long time to get this right, the steps are pretty simple. If you application is using jaas and you already have Kerberos authentication code (cas) in your webapp, the following solved my issue :-
1)Keep your jaas file inside /WEB-INF/classes dir.
2) pass this as an java opt, in startweblogic.cmd
set JAVA_OPTIONS=%JAVA_OPTIONS% -Djava.security.auth.login.config=\WEB-INF\classes\jaas.conf
reboot the server and try to login.
Set the following property to JAVA_OPTIONS in your domains\your_domain\bin\startWebLogic.cmd file, or alternatively set it in weblogic console at Environment/Servers/Control/your_domain/Server Start/Arguments.
-DUseSunHttpHandler=true

Apache Tomcat - Axis2: Returning custom objects

I am using Eclipse Mars, Apache Tomcat, Axis2, and Maven with its axis2-java2wsdl and axis2-aar plugins to create web service and its client.
The web service is simple at the moment: it has a list of Users (with User attributes: nickname and Id) and allows someone to create, search, get and delete a user.
Everything seems to run OK on the server side. I implemented the service and tested that it works OK with SOAP UI (the functions operate as they should).
Error:
However, when I run the Java code for the client, I get the following error:
Exception in thread "main" org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException:
Unexpected subelement {http://user.ws.soar}nickName
The problems occurs when I return a custom User object to the client.
Here is the service.xml excerpt:
<operation name="getUser" mep="http://www.w3.org/ns/wsdl/in-out" namespace="http://user.ws.soar/xsd">
<actionMapping>http://user.ws.soar/xsd/getUser</actionMapping>
<messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
</operation>
I found a similar post but this solution did not work for me.
Any ideas how to resolve this issue are appreciated.