How to use Oracle jdbc driver fixedString property in datasource.xml? - oc4j

I try configured fixedString property in the datasource.xml but doesnt work, this is in oc4j
<data-source
location="jdbc/prueba"
class="com.evermind.sql.DriverManagerDataSource"
password="dagrof" max-connect-attempts="3"
xa-location="jdbc/xa/prueba"
ejb-location="jdbc/prueba"
wait-timeout="1800"
connection-driver="oracle.jdbc.driver.OracleDriver"
username="dagrof"
min-connections="35"
max-connections="300"
url="jdbc:oracle:thin:#144.1.0.54:1521:nodox"
inactivity-timeout="300"
name="jdbc/prueba">
<property name="fixedString" value="true"/>
</data-source>
i Solved this problem in tomcat:
<Resource name="jdbc/testsql"
auth="Container"
type="javax.sql.DataSource"
driverClassName="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:#144.1.0.54:1521:nodox"
username="dandorrasc"
password="dandorrasc"
maxActive="8"
maxIdle="4"
connectionProperties="fixedString=true;"
/>
but here doesnt work

It's a bug that is corrected in version 10.1.2.3 OAS
Bug 10222534: UNABLE TO SET FIXEDSTRING PROPERTY IN DATASOURCE

Related

ESB WSO2 | Trying to send an email through email connector and getting "org.wso2.carbon.connector.email.send cannot be found" error

I'm trying to send an email using email connector from esb wso2 but I'm getting this error:
Invoking Target EIP Sequence org.wso2.carbon.connector.email.send paramNames : [from, to, subject, content, contentType]
[2022-07-22 10:52:14,113] ERROR {org.apache.synapse.mediators.template.InvokeMediator} - Sequence template org.wso2.carbon.connector.email.send cannot be found
[2022-07-22 10:52:14,121] DEBUG {org.apache.synapse.debug.SynapseDebugManager} - Mediation flow terminated for id urn:uuid:3f3f9864-bbc1-4e95-a4bf-1574196dfb8c
[2022-07-22 10:52:14,121] WARN {org.apache.synapse.core.axis2.SynapseMessageReceiver} - Executing fault handler due to exception encountered
[2022-07-22 10:52:14,121] WARN {org.apache.synapse.FaultHandler} - ERROR_CODE : 0
[2022-07-22 10:52:14,121] WARN {org.apache.synapse.FaultHandler} - ERROR_MESSAGE : Sequence template org.wso2.carbon.connector.email.send cannot be found
[2022-07-22 10:52:14,122] WARN {org.apache.synapse.FaultHandler} - ERROR_DETAIL : org.apache.synapse.SynapseException: Sequence template org.wso2.carbon.connector.email.send cannot be found
This is my api which I use:
<?xml version="1.0" encoding="UTF-8"?>
<api context="/api/send/email" name="api.send.email" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="POST">
<inSequence>
<property expression="json-eval($.from)" name="from" scope="default" type="STRING"/>
<property expression="json-eval($.to)" name="to" scope="default" type="STRING"/>
<property expression="json-eval($.subject)" name="subject" scope="default" type="STRING"/>
<property expression="json-eval($.content)" name="content" scope="default" type="STRING"/>
<property expression="json-eval($.contentType)" name="contentType" scope="default" type="STRING"/>
<log level="custom">
<property expression="$ctx:from" name="Log_from:"/>
<property expression="$ctx:to" name="Log_to:"/>
<property expression="$ctx:subject" name="Log_subject:"/>
<property expression="$ctx:content" name="Log_content:"/>
<property expression="$ctx:contentType" name="Log_contentType:"/>
</log>
<email.send configKey="TEST_SMTP_CONNECTION">
<from>{json-eval($.from)}</from>
<to>{json-eval($.to)}</to>
<subject>{json-eval($.subject)}</subject>
<content>{json-eval($.content)}</content>
<contentType>{json-eval($.contentType)}</contentType>
</email.send>
<respond/>
</inSequence>
<outSequence/>
<faultSequence/>
</resource>
</api>
I think the problem is based on the fact that I don't think I added the connector on my project in the correct way.
So, first of all I added a connector on my main project (where I have APIs, endpoints etc) - Right Click - Add or Remove Connector/Module - then I added the email connector)
Then I created a new Connector Exporter on my project (Right Click on an empty space on my Project Explorer - I named the exporter 'test' - and I think here is the problem:
What Group ID, Parent Group ID and Parent Artifact ID I should choose? (same question when I'm making Composite Application for connector)
LATER EDIT*:
When I'm deploying de car. app for the email connector I'm getting these errors:
Error in instantiating class : org.wso2.carbon.connector.operations.list.EmailGetAttachment java.lang.NoClassDefFoundError: org/wso2/carbon/connector/core/exception/ContentBuilderException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
at java.lang.Class.getConstructor0(Class.java:3075)
at java.lang.Class.newInstance(Class.java:412)
Unable to update status for : {org.wso2.carbon.connector}email :: Template configuration : null cannot be builtfor Synapse Library artifact : getEmailAttachment org.apache.synapse.deployers.SynapseArtifactDeploymentException: Template configuration : null cannot be builtfor Synapse Library artifact : getEmailAttachment
To answer your questions, if you have a Maven MultiModule Project you can get the details of the parent project from the pom.xml of the parent project.(This is the root pom.xml typically)
The easiest way to resolve your problem is to create your project from an existing template which will make sure projects are created correctly. Inorder to do that, follow the steps below.
Open Integration Studio and Go to Help -> Getting Started.
Then select the Email Service sample project, give it a name and create the project.
Now you should have a full working project with a Connector Exported.
In the future for creating new projects, you can refer to this document.

Tracing messages through logs in WSO2 ESB 4.8.1

I need to get a unique ID to trace messages through logs.
I am using WSO2 ESB 4.8.1.
I have found an article related to WSO2 ESB 5.0.0. http://nuwanzone.blogspot.it/2016/12/wso2-esb-tracing-messages-through-logs.html .
It describes how setting a unique ID per each message using the MessageContext object so that I can access it from anywhere within the message flow.
Is it possible implement a similar solution in WSO2 ESB 4.8.1 too? (porting that) solution in WSO2 ESB 4.8.1?
Do you know different solutions?
You can save the MessageID in a property at startup, and add it to your log mediators. Example:
<property description="SetMessageUUID" expression="fn:substring-after(get-property('MessageID'), 'urn:uuid:')" name="MessageUUID" scope="default" type ="STRING"/>
<log>
<property name="Step" expression="Request service A"/>
<property name="ID" expression="get-property('MessageUUID')"/>
</log>
<call>
.....
</call>
<log>
<property name="Step" expression="Response service A"/>
<property name="ID" expression="get-property('MessageUUID')"/>
</log>

Error with WSO2 ESB when trying to connect to Jira and ElasticSearch

I have and scenario where I want to extract dynamically Issues from Jira in order to save them on ElasticSearch. I use a custom Proxy Service that connect with Jira (via Jira connector), get a project (first I want to save the project's information) and pass this information to Elastic. Following is the in Sequence of the proxy service:
<?xml version="1.0" encoding="UTF-8"?>
<inSequence xmlns="http://ws.apache.org/ns/synapse">
<property expression="json-eval($.username)" name="username"/>
<property expression="json-eval($.password)" name="password"/>
<property expression="json-eval($.uri)" name="uri"/>
<property expression="json-eval($.id)" name="id"/>
<property expression="json-eval($.uriEl)" name="uriEl"/>
<property expression="json-eval($.indexName)" name="indexName"/>
<property expression="json-eval($.type)" name="type"/>
<property expression="json-eval($.message)" name="message"/>
<jira.init>
<username>{$ctx:username}</username>
<password>{$ctx:password}</password>
<uri>{$ctx:uri}</uri>
</jira.init>
<jira.getProject>
<projectIdOrKey>{$ctx:id}</projectIdOrKey>
</jira.getProject>
<property expression="json-eval($.project)" name="project"
scope="default" type="STRING"/>
<elasticsearch.init>
<apiUrl>{$ctx:uriEl}</apiUrl>
</elasticsearch.init>
<elasticsearch.createDocumentWithIndex>
<indexName>{$ctx:indexName}</indexName>
<type>{$ctx:type}</type>
<message>{$ctx:message}</message>
<body>{$ctx:project}</body>
</elasticsearch.createDocumentWithIndex>
<respond/>
</inSequence>
And here is the sample request:
{
"username":"MyName",
"password":"AnStrongPassword",
"uri":"JiraURL",
"id":"MyProject",
"uriEl":"http://localhost:9200",
"indexName":"jira",
"type":"project",
"message":"Testing"
}
The other parameters (Endpoint, out Sequence and Fault Sequence) are by default.
The problem is that when I try to send this request via 'Try the Test service' option on WSO2 ESB, i get the following error:
Error connecting to the Tryit ajax proxy
I have tested the same code but only using the Jira connection (without get a project or connect to Elastic), and the same error occurs.
Looking to this error, I suppose that the problem is before to read the JSON request, but I don't know if it is related to the endpoint (I think that it is not necessary an endpoint for this scenario).
Thanks in advance.
This problem is totally independent of the jira connector etc. Problem is with the "try it" tool. This tool is not that much recommended for testing purposes. Instead of that, try invoking the proxy service via soap ui.
If you share a screenshot when the try it error occurs, I'll be able to comment on that as well.
After a few days I have found another solution to my problem without using proxy services. To connect ESB with Jira, I created this API on ESB:
<api xmlns="http://ws.apache.org/ns/synapse" name="transport_service" context="/transport_service">
<resource methods="GET">
<inSequence>
<jira.init>
<uri>MyURL</uri>
<username>MyUser</username>
<password>3MyPass</password>
</jira.init>
<jira.searchJira>
<query>project=MyProject</query>
<maxResults>50000</maxResults>
<fields>MyField1,MyField2,etc</fields>
</jira.searchJira>
<respond/>
</inSequence>
<outSequence>
<log level="full"/>
<property name="messageType" value="application/xml" scope="axis2"/>
<send/>
</outSequence>
</resource>
</api>
The command to call this API is simple:
curl -v -X GET http://localhost:8280/transport_service > jira-db.json
Finally, if you want to insert this json on elastic, you can follow the typical PUT via curl:
curl -XPUT 'http://localhost:9200/jira/jira/1' -d #jira-db.json
Additionally, you can write both commands on a daily bash script (using your scheduled task list), getting the same result that scheduling your proxy service on WSO2ESB:
#!/bin/bash
curl -v -X GET http://localhost:8280/transport_service > jira-db.json
curl -XPUT 'http://localhost:9200/jira-dev/jira/1' -d #jira-db.json
echo "Daily load completed"

Read body/Query parametr in wso2 esb 4.8 or 4.8.1?

How to read body param or query param in wso2 ESB 4.8 or 4.81.We tried with following format,
<property name="uri.var.name" expression="$url:name"></property>
<property name="uri.var.name" expression="$body/name"></property>
It succeeded with 4.7,But not working in WSO2 ESB 4.8 and 4.8.1 ..Any suggestion ?
To read request params :
Sample request : http://localhost:8280/services/MyService?param1=val1&param2=val2
<property name="PARAM1" expression="tokenize(substring-after(syn:get-property('To'),'param1='),'&')"/>
<property name="PARAM1" expression="tokenize(substring-after(syn:get-property('To'),'param2='),'&')"/>

WSO2 ESB: WARNING: EPRs are NULL. Transport configuration my be incorrect

When activating a proxy (with the Web UI), I always get following error message:
WARNING: EPRs are NULL. Transport configuration may be incorrect
But I just don't understand why and what it means?
The source of the proxy:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="patient_toMPI_pJMS_qPatientToMPI" statistics="disable" trace="disable" transports="jms">
<parameter name="transport.jms.Destination">patient_qPatientToMPI</parameter>
<parameter name="transport.jms.ConnectionFactory">queueNonBlocking</parameter>
<parameter name="transport.jms.DestinationType">queue</parameter>
<parameter name="transport.jms.ContentType">
<rules>
<jmsProperty>contentType</jmsProperty>
<default>application/xml</default>
</rules>
</parameter>
<target faultSequence="errorSequence">
<inSequence>
<log level="custom">
<property name="Patient/toMPI" value="proxy (patient_toMPI_pJMS_qPatientToMPI) called"/>
</log>
<sequence key="patient_toMPI_sTransform"/>
</inSequence>
</target>
</proxy>
Simple fix :) Simply go to "Edit Data Service" and tick http and https on "Transport Settings"
This has already been reported as a bug here. It will be resolved in future releases.
Are you logged in as the super tenant? If so you should not be getting this issue. Aforementioned bug, we experienced only in tenant-mode.
Please make sure, you have copied required (correct) client libraries into repository/components/lib directory in ESB to allow connection between the ESB and the JMS provider.
For eg: If the provider is active-mq, you need to copy following jar files.
activemq-core-xxx.jar AND geronimo-j2ee-management_xx_spec-xx.jar