Cannot deserialize value of type when getting CertificateRequest - fabric8

I am working on fabric8 CertificateRequest, I followed https://github.com/rohankanojia-forks/cert-manager-java-extension-demo/blob/main/src/main/java/io/fabric8/demo/CertificateRequestGet.java to try to get an existing CertificateRequest, but I got error as following.
My test environment:
Kubernetes Cluster: OpenShift 4.7.32
my app environment: Java 11
java version "11.0.12" 2021-07-20
IBM Semeru Runtime Certified Edition 11.0.12.0 (build 11.0.12+7)
Eclipse OpenJ9 VM 11.0.12.0 (build openj9-0.27.0, JRE 11 Mac OS X amd64-64-Bit Compressed References 20210901_134 (JIT enabled, AOT enabled)
OpenJ9 - 1851b0074
OMR - 9db1c870d
JCL - 54d2067eec based on jdk-11.0.12+7)
certmanager-client version
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>certmanager-client</artifactId>
<version>5.9.0</version>
</dependency>
Source code
try (CertManagerClient certManagerClient = new DefaultCertManagerClient()) {
CertificateRequest certificateRequest = certManagerClient.v1()
.certificateRequests()
.inNamespace("default")
.withName("aaaaa")
.get();
System.out.println(String.format("%s found in default namespace", certificateRequest.getMetadata().getName()));
System.out.println(SerializationUtils.dumpAsYaml(certificateRequest));
} catch (Exception e) {
e.printStackTrace();
}
Error:
io.fabric8.kubernetes.client.KubernetesClientException: An error has occurred.
at io.fabric8.kubernetes.client.KubernetesClientException.launderThrowable(KubernetesClientException.java:103)
at io.fabric8.kubernetes.client.KubernetesClientException.launderThrowable(KubernetesClientException.java:97)
at io.fabric8.kubernetes.client.utils.Serialization.unmarshal(Serialization.java:263)
at io.fabric8.kubernetes.client.utils.Serialization.unmarshal(Serialization.java:215)
at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse(OperationSupport.java:569)
at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse(OperationSupport.java:527)
at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleGet(OperationSupport.java:494)
at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleGet(OperationSupport.java:476)
at io.fabric8.kubernetes.client.dsl.base.BaseOperation.handleGet(BaseOperation.java:788)
at io.fabric8.kubernetes.client.dsl.base.BaseOperation.getMandatory(BaseOperation.java:187)
at io.fabric8.kubernetes.client.dsl.base.BaseOperation.get(BaseOperation.java:154)
at io.fabric8.kubernetes.client.dsl.base.BaseOperation.get(BaseOperation.java:87)
at com.ibm.si.osprey.App.main(App.java:66)
Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type `java.util.ArrayList<java.lang.Integer>` from String value (token `JsonToken.VALUE_STRING`)
at [Source: (BufferedInputStream); line: 1, column: 2603] (through reference chain: io.fabric8.certmanager.api.model.v1.CertificateRequest["status"]->io.fabric8.certmanager.api.model.v1.CertificateRequestStatus["ca"])
at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:59)
at com.fasterxml.jackson.databind.DeserializationContext.reportInputMismatch(DeserializationContext.java:1741)
at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1515)
at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1462)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.handleNonArray(CollectionDeserializer.java:392)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer._deserializeFromString(CollectionDeserializer.java:326)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:250)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:28)
at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:129)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:313)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:176)
at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:129)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:313)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:176)
at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:322)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4675)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3675)
at io.fabric8.kubernetes.client.utils.Serialization.unmarshal(Serialization.java:261)
... 10 more

this is our outpurt yaml file, for your request.
apiVersion: cert-manager.io/v1
kind: CertificateRequest
metadata:
name: barrycertificaterequest
namespace: barry
spec:
duration: 2160h0m0s
issuerRef:
group: cert-manager.io
kind: Issuer
name: barry-dlc-cert-issuer
request: >-<here is your csr>
status:
ca: >-<here is returned ca>
certificate: >-<here is returned certificate>
conditions:
- lastTransitionTime: '2021-10-25T20:13:03Z'
message: Certificate request has been approved by cert-manager.io
reason: cert-manager.io
status: 'True'
type: Approved
- lastTransitionTime: '2021-10-25T20:13:04Z'
message: Certificate fetched from issuer successfully
reason: Issued
status: 'True'
type: Ready

Related

Getting "rpc error: code = Unavailable desc = error reading from server: EOF" when trying to create a new etcdv3 client

I'm trying to access my ETCD database from a K8s controller, but getting rpc error/EOF when trying to open ETCD client.
My setup:
ETCD service is deployed in my K8s cluster and included in my Istio service mesh (its DNS record: my-etcd-cluster.my-etcd-namespace.svc.cluster.local)
I have a custom K8s controller developed with use of Kubebuilder framework and deployed in the same cluster, different namespace, but configured to be a part of the same Istio service mesh
I'm trying to connect to ETCD database from the controller, using Go client SDK library for ETCD
Here's my affected Go code:
cli, err := clientv3.New(clientv3.Config{
Endpoints: []string{"http://my-etcd-cluster.my-etcd-namespace.svc.cluster.local:2379"},
DialTimeout: 5 * time.Second,
Username: username,
Password: password,
})
if err != nil {
return nil, fmt.Errorf("opening ETCD client failed: %v", err)
}
And here's an error I'm getting when clientv3.New(...) gets executed:
{"level":"warn","ts":"2022-03-16T23:37:42.174Z","logger":"etcd-client","caller":"v3#v3.5.0/retry_interceptor.go:62","msg":"retrying of unary invoker failed",
"target":"etcd-endpoints://0xc00057f500/#initially=[http://my-etcd-cluster.my-etcd-namespace.svc.cluster.local:2379]","attempt":0,
"error":"rpc error: code = Unavailable desc = error reading from server: EOF"}
...
1.647473862175209e+09 INFO controller.etcdclient Finish reconcile loop for some-service/test-svc-client {"reconciler group": "my-controller.something.io", "reconciler kind": "ETCDClient", "name": "test-svc-client", "namespace": "some-service", "reconcile-etcd-client": "some-service/test-svc-client"}
1.6474738621752858e+09 ERROR controller.etcdclient Reconciler error {"reconciler group": "my-controller.something.io", "reconciler kind": "ETCDClient", "name": "test-svc-client", "namespace": "some-service", "error": "opening ETCD client failed: rpc error: code = Unavailable desc = error reading from server: EOF"}
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem
/go/pkg/mod/sigs.k8s.io/controller-runtime#v0.11.0/pkg/internal/controller/controller.go:266
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2
/go/pkg/mod/sigs.k8s.io/controller-runtime#v0.11.0/pkg/internal/controller/controller.go:227
The same error happens when I'm passing some dummy, invalid credentials.
However, when I tried to access the database in a HTTP API manner:
postBody, _ := json.Marshal(map[string]string{
"name": username,
"password": password,
})
responseBody := bytes.NewBuffer(postBody)
resp, err := http.Post("http://my-etcd-cluster.my-etcd-namespace.svc.cluster.local:2379/v3/auth/authenticate", "application/json", responseBody)
if err != nil {
return ctrl.Result{}, fmt.Errorf("an error occured %w", err)
}
l.Info(fmt.Sprintf("code: %d", resp.StatusCode))
defer resp.Body.Close()
...I got 200 OK and a proper token (which is expected), so I believe my Istio configuration is ok and my controller should be able to see the ETCD db service. I have no clue why this doesn't work when following the client SDK approach.
When I'm using port-forwarding of the ETCD service and accessing it locally, clientv3.New() and other client SDK methods work like a charm. What am I missing? I'd really appreciate any suggestions.
EDIT:
I've also added a simple pod to try accessing my etcd db via etcdctl:
apiVersion: v1
kind: Pod
metadata:
name: test-pod
namespace: my-controller-namespace
spec:
containers:
- name: etcdctl
image: bitnami/etcd
command:
- sleep
- infinity
When logged into the container via kubectl exec, I was able to access my db:
$ etcdctl --endpoints=my-etcd-cluster.my-etcd-namespace.svc.cluster.local:2379 --user="user" --password="password" put foo bob
OK
I guess the problem is somewhere in the SDK?
Turned out to be version mismatch - my ETCD db is v3.5.2 and the clientv3 library that I used was v3.5.0.
As seen in ETCD changelog (https://github.com/etcd-io/etcd/blob/main/CHANGELOG/CHANGELOG-3.5.md):

Thorntail - WildFly Elytron Security remote connection getting authentication failed: none of the mechanisms presented by the server are supported

I have configured WildFly Elytron Security on thorntail application using project-defaults.yml. However the application is failing to invoke or connect to the remote secured EJB's
Here is the yaml configuration for Elytron - Am not sure if this is correctly configured.
thorntail:
elytron:
sasl-authentication-factories:
application-sasl-authentication:
mechanism-configurations:
- mechanism-name: 'GSSAPI'
- mechanism-name: 'PLAIN'
- mechanism-name: 'JBOSS-LOCAL-USER'
- mechanism-name: 'DIGEST-MD5'
- mechanism-realm-configurations:
- realm-name: ApplicationRealm
security-domain: ApplicationDomain
sasl-server-factory: configured
authentication-configurations:
default:
security-domain: ApplicationDomain
sasl-mechanism-selector: 'PLAIN'
security-domains:
ApplicationDomain:
realms:
- realm: ApplicationRealm
default-realm: ApplicationRealm
remoting:
http-connectors:
http-remoting-connector:
sasl-security:
policy-sasl-policy:
no-plain-text: false
include-mechanisms:
- 'PLAIN'
sasl-authentication-factory: application-sasl-authentication
security-realm: ApplicationRealm
connector-ref: default
management:
https:
port: 9993
http:
port: 9990
security-realms:
ApplicationRealm:
jaas-authentication:
name: AppSecDom
ssl-server-identity:
alias: 'alias'
keystore-provider: PKCS12
keystore-path: ${javax.net.ssl.keyStore}
keystore-password: ${javax.net.ssl.keyStorePassword}
From the client side this is how i try to connect to the EJB.
public final static AuthenticationContext authenticationContext() throws Exception{
LOG.info("***********Start AUTHENTICATION*****************." );
try{
AuthenticationConfiguration config = AuthenticationConfiguration.empty().setSaslMechanismSelector(SaslMechanismSelector.NONE.addMechanism("#ALL")).
useName("username").usePassword("password");
final AuthenticationContext authCtx = AuthenticationContext.empty().
with(MatchRule.ALL, config);
ContextManager<AuthenticationContext> contextManager = authCtx.getInstanceContextManager();
contextManager.setThreadDefault(authCtx);
return contextManager.get();
}catch (Exception e){
LOG.error("Error authentication : " + e);
throw new Exception(e);
}
}
Error from the console.
Suppressed: org.jboss.ejb.client.RequestSendFailedException: Destination # remote+http://127.0.0.1:8080
at org.jboss.ejb.protocol.remote.RemoteEJBReceiver$1.handleFailed(RemoteEJBReceiver.java:104)
at org.jboss.ejb.protocol.remote.RemoteEJBReceiver$1.handleFailed(RemoteEJBReceiver.java:76)
at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:89)
at org.xnio.nio.WorkerThread.run(WorkerThread.java:591)
Caused by: javax.security.sasl.SaslException: Authentication failed: none of the mechanisms presented by the server (GSSAPI, JBOSS-LOCAL-USER, GS2-KRB5-PLUS, GS2-KRB5, ANONYMOUS) are supported
at org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities.handleEvent(ClientConnectionOpenListener.java:444)
at org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities.handleEvent(ClientConnectionOpenListener.java:242)
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66)
at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:89)
at org.xnio.nio.WorkerThread.run(WorkerThread.java:591)
at ...asynchronous invocation...(Unknown Source)
Please assist with this issue as am not sure what i need to do next.
The below yaml configuration worked.
thorntail:
elytron:
simple-role-decoders:
from-roles-attribute:
attribute: roles
jdbc-realms:
app-jdbc-realm:
principal-query:
- sql: SELECT PASSWORD FROM USERS WHERE USERNAME = ?
data-source: TestDS
clear-password-mapper:
password-index: 1
- sql: SELECT R.NAME, 'Roles' FROM USERS_ROLES UR INNER JOIN ROLES R ON R.ID = UR.ROLE_ID INNER JOIN USERS U ON U.ID = UR.USER_ID WHERE U.USERNAME = ?
data-source: TestDS
attribute-mapping:
- index: 1
to: roles
sasl-authentication-factories:
application-sasl-authentication:
mechanism-configurations:
- mechanism-name: 'PLAIN'
- mechanism-realm-configurations:
- realm-name: app-jdbc-realm
security-domain: ApplicationDomain
sasl-server-factory: configured
security-domains:
ApplicationDomain:
realms:
- realm: app-jdbc-realm
role-decoder: from-roles-attribute
default-realm: app-jdbc-realm
remoting:
http-connectors:
http-remoting-connector:
sasl-authentication-factory: application-sasl-authentication
security-realm: ApplicationRealm
connector-ref: default
For more detailed explanation - including the sql script to create schema tables for user authentication details.
https://developer.jboss.org/thread/280474
https://github.com/wildfly-security-incubator/elytron-examples

Adding IoT rule with an error action through cloudformation yaml

I am trying to add an iot rule with error action using following cloudformation yaml file
extract from yaml:
DaIoTRule:
Type: AWS::IoT::TopicRule
Properties:
RuleName: sda
TopicRulePayload:
RuleDisabled: false
Sql: SELECT *, topic(2) AS source FROM 'topic/sensors/+'
Actions:
- Lambda:
FunctionArn: !GetAtt LambdaFunction.Arn
ErrorAction:
S3:
RoleArn: !GetAtt DAIoTRuleErrorActionIamRole.Arn
Bucket: iot-message-dump
Key: "errors/${topic()}/${timestamp()}"
But I keep getting this error:
{
"StackId": "arn:aws:cloudformation:us-east-1:961234632786:stack/wx-da-lambda/91423s00-4e97-11ea-aedd-0ee829hbc650",
"EventId": "DAIoTRule-CREATE_FAILED-2020-02-17T06:51:38.299Z",
"StackName": "da-lambda",
"LogicalResourceId": "DaIoTRule",
"PhysicalResourceId": "",
"ResourceType": "AWS::IoT::TopicRule",
"Timestamp": "2020-02-17T06:51:38.299Z",
"ResourceStatus": "CREATE_FAILED",
"ResourceStatusReason": "Encountered unsupported property bucket"
}
I created this yaml using https://docs.aws.amazon.com/iot/latest/developerguide/rule-error-handling.html as reference.
Can someone point me to what I am doing wrong ?
CloudFormation uses the BucketName property instead of Bucket for S3 actions (including error actions).
See https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-s3action.html#cfn-iot-topicrule-s3action-bucketname

How to Define Enum as Query Params in OpenAPI Spec

I want to define an enum value in the query string parameter of a function in an OpenAPI specification.
Here is an example of how I specify the parameter in my OpenAPI specification (yaml):
openapi: 3.0.0
info:
description: Vends sodas
version: 1.0.0
title: VendingMachineService
paths:
/soda/{bill}:
get:
summary: Provides a soda for a provided amount of money
description: Provides a soda for a provided amount of money
operationId: getSoda
parameters:
- name: bill
in: path
description: Money (e.g. one, two, five)
required: true
schema:
$ref: "#/components/schemas/Bill"
responses:
"200":
description: Success
content:
application/json:
schema:
$ref: "#/components/schemas/Result"
"404":
description: Templates for Source not found
servers:
- url: http://localhost:8080/
components:
schemas:
Bill:
type: string
enum:
- one
- two
- five
Result:
type: string
The key part of the OpenAPI spec is that I define the enum in a schema object at the bottom, type string, and refer to it in the parameters section of the function, also defining it as part of the path /{bill}
I then use openapi-generator to generate the spring server:
openapi-generator generate -i ~/vending-machine.yaml -g spring -o ~/output
I then spin up the server (importing the project into Intellij and running in a spring-boot configuration) and go to localhost:8080/ to open the Swagger UI. I try to exercise the api and get the following error:
{ "timestamp": "2019-03-29T15:43:14.737Z", "status": 400,
"error": "Bad Request", "message": "Failed to convert value of type
'java.lang.String' to required type 'org.openapitools.model.Bill';
nested exception is
org.springframework.core.convert.ConversionFailedException: Failed to
convert from type [java.lang.String] to type
[#javax.validation.constraints.NotNull
#io.swagger.annotations.ApiParam #javax.validation.Valid
#org.springframework.web.bind.annotation.RequestParam
org.openapitools.model.Bill] for value 'null'; nested exception is
java.lang.IllegalArgumentException: No enum constant
org.openapitools.model.Bill.null", "path": "/soda/%7Bbill%7D" }
(501 Not Implemented expected)
What is the proper way to define the query params & enum in the OpenAPI spec to use enum values?

WSO2 data service (DS) in ESB 4.0.3 returns wrong fault message

I work at Apple and we are working on the prototype using WSO2 ESB with Data Services Feature. I am using WSO2 ESB 4.0.3 with DSS feature. I have deployed data service and calling the data service from proxy service in ESB. I am using MAC OS X 10.7.4 and java version details are as below.
java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b04-415-11M3635)
Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01-415, mixed mode)
My DS service is expecting certain parameter say parameter A and I do not pass that this parameter in the Input XML I see following error on the WSO2 ESB console.
[2012-06-07 09:49:11,348] ERROR - DataService DS Fault Message: Error in 'CallQuery.extractParams', cannot find parameter with type:query-param name:Hw_Serial_Nr
DS Code: INCOMPATIBLE_PARAMETERS_ERROR
Source Data Service:-
Name: OWCHECK
Location: /TQS_OWCHECK.dbs
Description: N/A
Default Namespace: http://ws.wso2.org/dataservice
Current Request Name: OWCHECK_OP
Current Params: {COUNTRYORIGIN=US, SUBDT=20090428}
DS Fault Message: Error in 'CallQuery.extractParams', cannot find parameter with type:query-param name:Hw_Serial_Nr
DS Code: INCOMPATIBLE_PARAMETERS_ERROR
Source Data Service:-
Name: OWCHECK
Location: /TQS_OWCHECK.dbs
Description: N/A
Default Namespace: http://ws.wso2.org/dataservice
Current Request Name: OWCHECK_OP
Current Params: {COUNTRYORIGIN=US, SUBDT=20090428}
at org.wso2.carbon.dataservices.core.engine.CallQuery.extractParams(CallQuery.java:214)
at org.wso2.carbon.dataservices.core.engine.CallQuery.execute(CallQuery.java:183)
at org.wso2.carbon.dataservices.core.engine.CallQueryGroup.execute(CallQueryGroup.java:110)
at org.wso2.carbon.dataservices.core.description.operation.Operation.execute(Operation.java:71)
at org.wso2.carbon.dataservices.core.engine.DataService.invoke(DataService.java:592)
at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.execute(DSOMDataSource.java:99)
at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.serialize(DSOMDataSource.java:110)
at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.getReader(DSOMDataSource.java:116)
at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.getDirectReader(OMSourcedElementImpl.java:225)
at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.forceExpand(OMSourcedElementImpl.java:254)
at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.getFirstOMChild(OMSourcedElementImpl.java:867)
at org.apache.axiom.om.impl.OMNavigator._getFirstChild(OMNavigator.java:196)
at org.apache.axiom.om.impl.OMNavigator.updateNextNode(OMNavigator.java:140)
at org.apache.axiom.om.impl.OMNavigator.getNext(OMNavigator.java:112)
at org.apache.axiom.om.impl.SwitchingWrapper.updateNextNode(SwitchingWrapper.java:1113)
at org.apache.axiom.om.impl.SwitchingWrapper.updateLastNode(SwitchingWrapper.java:1104)
at org.apache.axiom.om.impl.SwitchingWrapper.next(SwitchingWrapper.java:1041)
at javax.xml.stream.util.StreamReaderDelegate.next(StreamReaderDelegate.java:47)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:681)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:214)
at org.apache.axiom.om.impl.llom.OMSerializableImpl.build(OMSerializableImpl.java:78)
at org.apache.axiom.om.impl.llom.OMElementImpl.build(OMElementImpl.java:722)
at org.apache.axiom.om.impl.llom.OMElementImpl.cloneOMElement(OMElementImpl.java:1065)
at org.wso2.carbon.tracer.module.handler.AbstractTracingHandler.storeMessage(AbstractTracingHandler.java:81)
at org.wso2.carbon.tracer.module.handler.TracingMessageOutObservationHandler.invoke(TracingMessageOutObservationHandler.java:94)
at org.apache.axis2.engine.Phase.invokeHandler(Phase.java:340)
at org.apache.axis2.engine.Phase.invoke(Phase.java:313)
at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:262)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:427)
at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.invokeBusinessLogic(AbstractInOutSyncMessageReceiver.java:45)
at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:110)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
at org.apache.synapse.transport.nhttp.ServerWorker.processEntityEnclosingMethod(ServerWorker.java:409)
at org.apache.synapse.transport.nhttp.ServerWorker.run(ServerWorker.java:261)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:173)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
[2012-06-07 09:49:11,352] ERROR - OMSourcedElementImpl Could not get parser from data source for element {http://ws.wso2.org/dataservice}EVENT
javax.xml.stream.XMLStreamException: DS Fault Message: Error in 'CallQuery.extractParams', cannot find parameter with type:query-param name:Hw_Serial_Nr
DS Code: INCOMPATIBLE_PARAMETERS_ERROR
Source Data Service:-
Name: OWCHECK
Location: /TQS_OWCHECK.dbs
Description: N/A
Default Namespace: http://ws.wso2.org/dataservice
Current Request Name: OWCHECK_OP
Current Params: {COUNTRYORIGIN=US, SUBDT=20090428}
at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.execute(DSOMDataSource.java:105)
at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.serialize(DSOMDataSource.java:110)
at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.getReader(DSOMDataSource.java:116)
at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.getDirectReader(OMSourcedElementImpl.java:225)
at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.forceExpand(OMSourcedElementImpl.java:254)
at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.getFirstOMChild(OMSourcedElementImpl.java:867)
at org.apache.axiom.om.impl.OMNavigator._getFirstChild(OMNavigator.java:196)
at org.apache.axiom.om.impl.OMNavigator.updateNextNode(OMNavigator.java:140)
at org.apache.axiom.om.impl.OMNavigator.getNext(OMNavigator.java:112)
at org.apache.axiom.om.impl.SwitchingWrapper.updateNextNode(SwitchingWrapper.java:1113)
at org.apache.axiom.om.impl.SwitchingWrapper.updateLastNode(SwitchingWrapper.java:1104)
at org.apache.axiom.om.impl.SwitchingWrapper.next(SwitchingWrapper.java:1041)
at javax.xml.stream.util.StreamReaderDelegate.next(StreamReaderDelegate.java:47)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:681)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:214)
at org.apache.axiom.om.impl.llom.OMSerializableImpl.build(OMSerializableImpl.java:78)
at org.apache.axiom.om.impl.llom.OMElementImpl.build(OMElementImpl.java:722)
at org.apache.axiom.om.impl.llom.OMElementImpl.cloneOMElement(OMElementImpl.java:1065)
at org.wso2.carbon.tracer.module.handler.AbstractTracingHandler.storeMessage(AbstractTracingHandler.java:81)
at org.wso2.carbon.tracer.module.handler.TracingMessageOutObservationHandler.invoke(TracingMessageOutObservationHandler.java:94)
at org.apache.axis2.engine.Phase.invokeHandler(Phase.java:340)
at org.apache.axis2.engine.Phase.invoke(Phase.java:313)
at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:262)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:427)
at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.invokeBusinessLogic(AbstractInOutSyncMessageReceiver.java:45)
at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:110)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
at org.apache.synapse.transport.nhttp.ServerWorker.processEntityEnclosingMethod(ServerWorker.java:409)
at org.apache.synapse.transport.nhttp.ServerWorker.run(ServerWorker.java:261)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:173)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
[2012-06-07 09:49:11,355] ERROR - ServerWorker Error processing POST request
org.apache.axis2.AxisFault: javax.xml.stream.XMLStreamException
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:180)
at org.apache.synapse.transport.nhttp.ServerWorker.processEntityEnclosingMethod(ServerWorker.java:409)
at org.apache.synapse.transport.nhttp.ServerWorker.run(ServerWorker.java:261)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:173)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
Caused by: org.apache.axiom.om.OMException: javax.xml.stream.XMLStreamException
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:296)
at org.apache.axiom.om.impl.llom.OMSerializableImpl.build(OMSerializableImpl.java:78)
at org.apache.axiom.om.impl.llom.OMElementImpl.build(OMElementImpl.java:722)
at org.apache.axiom.om.impl.llom.OMElementImpl.cloneOMElement(OMElementImpl.java:1065)
at org.wso2.carbon.tracer.module.handler.AbstractTracingHandler.storeMessage(AbstractTracingHandler.java:81)
at org.wso2.carbon.tracer.module.handler.TracingMessageOutObservationHandler.invoke(TracingMessageOutObservationHandler.java:94)
at org.apache.axis2.engine.Phase.invokeHandler(Phase.java:340)
at org.apache.axis2.engine.Phase.invoke(Phase.java:313)
at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:262)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:427)
at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.invokeBusinessLogic(AbstractInOutSyncMessageReceiver.java:45)
at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:110)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
... 6 more
Caused by: javax.xml.stream.XMLStreamException
at org.apache.axiom.om.impl.SwitchingWrapper.updateLastNode(SwitchingWrapper.java:1106)
at org.apache.axiom.om.impl.SwitchingWrapper.next(SwitchingWrapper.java:1041)
at javax.xml.stream.util.StreamReaderDelegate.next(StreamReaderDelegate.java:47)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:681)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:214)
... 19 more
[2012-06-07 09:49:11,375] WARN - ClientHandler Received an internal server error : Internal Server Error For : 127.0.0.1:8280 For Request : Axis2Request [Message ID : urn:uuid:55a4d59a-2be2-43ee-99b5-8943b1ff2b91] [Status Completed : true] [Status SendingCompleted : true]
How ever the fault message it returned to the proxy service is as below
2012-06-07 09:49:11,081 [-] [HttpServerWorker-1] TRACE OWCHECK_RPOXY To: /services/OWCHECK_RPOXY.OWCHECK_RPOXYHttpSoap12Endpoint, WSAction: urn:mediate, SOAPAction: urn:mediate, MessageID: urn:uuid:1f8cb9bf-ab10-40a4-b75d-6b3d4805322c, Direction: request, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><OWCHECK_OP spec="IDL:com/apple/vitria/idl/sapamr_rfcevents/RfcCallEvents:1.0#Z_WARR_VALIDATION_GROUP"><TAB_SERNHDR><SERIALNR>YM6191TJSCH</SERIALNR><SUBDT>20090428</SUBDT><COUNTRYORIGIN>US</COUNTRYORIGIN></TAB_SERNHDR></OWCHECK_OP></soapenv:Body></soapenv:Envelope>
2012-06-07 09:49:11,398 [-] [HttpClientWorker-1] TRACE OWCHECK_RPOXY To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:55a4d59a-2be2-43ee-99b5-8943b1ff2b91, Direction: response, MESSAGE = In-to-OutSequence !!!!!!!!!!!!!!!!!!!!!!!!!!!!, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><soapenv:Fault><soapenv:Code><soapenv:Value>soapenv:Receiver</soapenv:Value></soapenv:Code><soapenv:Reason><soapenv:Text xml:lang="en-US">javax.xml.stream.XMLStreamException</soapenv:Text></soapenv:Reason><soapenv:Detail><Exception>org.apache.axis2.AxisFault: javax.xml.stream.XMLStreamException
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:180)
at org.apache.synapse.transport.nhttp.ServerWorker.processEntityEnclosingMethod(ServerWorker.java:409)
at org.apache.synapse.transport.nhttp.ServerWorker.run(ServerWorker.java:261)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:173)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
Caused by: org.apache.axiom.om.OMException: javax.xml.stream.XMLStreamException
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:296)
at org.apache.axiom.om.impl.llom.OMSerializableImpl.build(OMSerializableImpl.java:78)
at org.apache.axiom.om.impl.llom.OMElementImpl.build(OMElementImpl.java:722)
at org.apache.axiom.om.impl.llom.OMElementImpl.cloneOMElement(OMElementImpl.java:1065)
at org.wso2.carbon.tracer.module.handler.AbstractTracingHandler.storeMessage(AbstractTracingHandler.java:81)
at org.wso2.carbon.tracer.module.handler.TracingMessageOutObservationHandler.invoke(TracingMessageOutObservationHandler.java:94)
at org.apache.axis2.engine.Phase.invokeHandler(Phase.java:340)
at org.apache.axis2.engine.Phase.invoke(Phase.java:313)
at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:262)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:427)
at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.invokeBusinessLogic(AbstractInOutSyncMessageReceiver.java:45)
at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:110)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
... 6 more
Caused by: javax.xml.stream.XMLStreamException
at org.apache.axiom.om.impl.SwitchingWrapper.updateLastNode(SwitchingWrapper.java:1106)
at org.apache.axiom.om.impl.SwitchingWrapper.next(SwitchingWrapper.java:1041)
at javax.xml.stream.util.StreamReaderDelegate.next(StreamReaderDelegate.java:47)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:681)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:214)
... 19 more
</Exception></soapenv:Detail></soapenv:Fault></soapenv:Body></soapenv:Envelope>
Looking at the SOAP fault I have to return the error message to client but even thought the correct error message must "Parameter Missing" SOAP fault's reason text is "javax.xml.stream.XMLStreamException"
Is there any thing wrong I am doing or is it BUG in DSS?
By looking at the stacktrace, I can see that you've enabled the SOAP tracer in invoking the service, disable the SOAP tracer and you should get the proper fault message.
Cheers,
Anjana.
As error message explains itself, it is expecting input parameters, which is not coming int the request. It can be fixed by two ways:
Passing empty tag from ESB without value.
Set default value in DSS.
First option works with all versions, here is the example for setting default value.
<payloadFactory media-type="xml">
<format>
<ds:DATA_SERVICE_REQUST xmlns:ds="http://ws.wso2.org/dataservice">
<ds:INPUT_PARAM_1>$1</ds:INPUT_PARAM_1>
</ds:DATA_SERVICE_REQUST>
</format>
<args>
<arg xmlns:ds="http://ws.wso2.org/dataservice" evaluator="xml" expression="get-property('INPUT_PARAMETER')"/>
</args>
</payloadFactory>
<call>
<endpoint>
<address uri="DSS_END_POINT"/>
</endpoint>
</call>
For 2nd option, please check your DSS version if this supports null values
Latest Version of DSS Supports default parameter values in the query param list.
Could you please give a try by adding defaultValue="#{NULL}" in query param list in your data service (dbs) file?
<query id="QUERY-ID" useConfig="DATA-SOURCE-ID">
<sql>-------------SQL QUERY HERE -----</sql>
<result ----------- >
<element ------------ />
</result>
<param defaultValue="#{NULL}" name="PARAM-NAME" ordinal="1" sqlType="INTEGER"/>
</query>
If this issue is still not resolved then it would be good if you can provide your API details.

Resources