dropbox connector, no callback uri, Could not find connector with name 'connector.http.mule.default' - callback

i'm new to Mule and i'm trying to use the dropbox connector with my web application. I'm trying to make a flow to authorize the current user to upload a file, however the flow doesn't even run. All i did was set up an http connector, then placed the dropbox connector and set it up. I used the graphic interface but here is the code:
<?xml version="1.0" encoding="UTF-8"?>
<http:listener-config name="HTTP_Listener_Configuration" host="localhost" port="8081" doc:name="HTTP Listener Configuration"/>
<dropbox:config name="Dropbox" appKey="xxxxxxxxxxx" appSecret="xxxxxxxxxxx" doc:name="Dropbox">
<dropbox:oauth-callback-config domain="http://localhost" localPort="8081" path="callback" remotePort="8081"/>
</dropbox:config>
<dropbox:config name="Dropbox1" appKey="xxxxxxxxxxx" appSecret="xxxxxxxxxxx" doc:name="Dropbox">
<dropbox:oauth-callback-config domain="http://localhost" localPort="8081" remotePort="8081" path="callback"/>
</dropbox:config>
<flow name="dropbxFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/callback/" doc:name="HTTP"/>
<dropbox:authorize config-ref="Dropbox" doc:name="Dropbox"/>
</flow>
i keep getting this error when i run :
INFO 2015-05-05 16:09:53,688 [Mule.app.deployer.monitor.1.thread.1] org.mule.lifecycle.AbstractLifecycleManager: Starting model: _muleSystemModel
INFO 2015-05-05 16:09:53,688 [Mule.app.deployer.monitor.1.thread.1] org.mule.construct.FlowConstructLifecycleManager: Starting flow: dropbxFlow
INFO 2015-05-05 16:09:53,688 [Mule.app.deployer.monitor.1.thread.1] org.mule.processor.SedaStageLifecycleManager: Starting service: dropbxFlow.stage1
ERROR 2015-05-05 16:09:53,694 [Mule.app.deployer.monitor.1.thread.1] org.mule.modules.dropbox.process.DefaultHttpCallback: Could not find connector with name 'connector.http.mule.default'
INFO 2015-05-05 16:09:53,694 [Mule.app.deployer.monitor.1.thread.1] org.mule.processor.SedaStageLifecycleManager: Stopping service: dropbxFlow.stage1
ERROR 2015-05-05 16:09:53,890 [Mule.app.deployer.monitor.1.thread.1] org.mule.module.launcher.application.DefaultMuleApplication: null
org.mule.api.DefaultMuleException: Could not find connector with name 'connector.http.mule.default'
This only happens when i use the Authorize attribute on the dropbox connector, as it needs a callback uri(which i think it the problem here), the callback http endpoint isn't being set up. Any insight would be greatly appreciated.

These are normal version issues with some of the libraries. I had the same issue while using dropbox connector 3.3.0 so after a lot of R&D I figured out where was actually the problem. I went to pom.xml, there I changed version to 3.3.3 and all was fine and running and no more issue at all.
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-dropbox</artifactId>
<version>3.3.3</version>
</dependency>
And regarding that "no callback uri", you should have same redirect uri in dropbox developer account and in dropbox global element Oauth configuration.
Let's say you have provided "http://localhost:8081/callback" as Redirect URI in Dropbox account so your Oauth configuration should be like as following
Domain : localhost
Local Port : 8081
Remote Port : 8081
Path : callback

Related

Kafka connector error on connecting WSO2 Micro Integrator with Kafka

I'm trying to connect Kafka with wso2 Micro Integrator by following this instructions. I used WSO2's Integration Studio to develop this. Here is the code,
<?xml version="1.0" encoding="UTF-8"?>
<api context="/create-customer" name="create-customer" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="POST">
<inSequence>
<kafkaTransport.init>
<bootstrapServers>localhost:9092</bootstrapServers>
<keySerializerClass>org.apache.kafka.common.serialization.StringSerializer</keySerializerClass>
<valueSerializerClass>org.apache.kafka.common.serialization.StringSerializer</valueSerializerClass>
</kafkaTransport.init>
<kafkaTransport.publishMessages>
<topic>customer</topic>
</kafkaTransport.publishMessages>
<respond/>
</inSequence>
<outSequence/>
<faultSequence/>
</resource>
</api>
But when I send the request, I got following Error.
[2023-01-14 21:27:36,570] INFO {KafkaProduceConnector} - {api:create-customer} SEND : send message to Broker lists
[2023-01-14 21:27:36,583] ERROR {KafkaProduceConnector} - {api:create-customer} Kafka producer connector : Error sending the message to broker org.wso2.carbon.connector.exception.InvalidConfigurationException: Connection name is not set.
at org.wso2.carbon.connector.KafkaProduceConnector.getConnectionName(KafkaProduceConnector.java:262)
at org.wso2.carbon.connector.KafkaProduceConnector.publishMessage(KafkaProduceConnector.java:237)
at org.wso2.carbon.connector.KafkaProduceConnector.connect(KafkaProduceConnector.java:138)
at org.wso2.carbon.connector.core.AbstractConnector.mediate(AbstractConnector.java:32)
at org.apache.synapse.mediators.ext.ClassMediator.updateInstancePropertiesAndMediate(ClassMediator.java:178)
at org.apache.synapse.mediators.ext.ClassMediator.mediate(ClassMediator.java:97)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:110)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:72)
at org.apache.synapse.mediators.template.TemplateMediator.mediate(TemplateMediator.java:136)
at org.apache.synapse.mediators.template.InvokeMediator.mediate(InvokeMediator.java:170)
at org.apache.synapse.mediators.template.InvokeMediator.mediate(InvokeMediator.java:93)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:110)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:72)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158)
at org.apache.synapse.api.Resource.process(Resource.java:342)
at org.apache.synapse.api.API.process(API.java:477)
at org.apache.synapse.api.AbstractApiHandler.apiProcess(AbstractApiHandler.java:93)
at org.apache.synapse.api.AbstractApiHandler.dispatchToAPI(AbstractApiHandler.java:71)
at org.apache.synapse.api.rest.RestRequestHandler.dispatchToAPI(RestRequestHandler.java:90)
at org.apache.synapse.api.rest.RestRequestHandler.process(RestRequestHandler.java:76)
at org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:54)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:344)
at org.apache.synapse.core.axis2.SynapseMessageReceiver.receive(SynapseMessageReceiver.java:101)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:376)
at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:435)
at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:183)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
I'm using MI 4.1.0 version and kafka 2.12 as required in the documentation. The Kafka connector used inside Integration studio is 3.12. As I noticed, according to this reference, inside <kafkaTransport.init> we can send a connection name. But Integration Studio doesn't allows me to add it inside it. When I checked the properties of <kafkaTransport.init>, it doesn't have a connection name field. Can anyone help me to get over this?
Indeed in <kafkaTransport.init> there should be name field usable. That may be a bug. In sourceCode it looks like can be retrieve from message context. Try declare this as property name, like below:
<property name="name" value="Kafka_Sample" scope="default"/>
Set this before <kafkaTransport.publishMessages>

How to share the session in multiple WAR in EAR file in JBOSS-7.3.6

How to share the session in multiple WAR in EAR file in JBOSS-7.3.6 ?
we have following entry in jboss-all.xml JBoss 7.2 version (before migration)
<jboss xmlns="urn:jboss:1.0">
<shared-session-config xmlns="urn:jboss:shared-session-config:1.0">
<max-active-sessions>10</max-active-sessions>
<session-config>
<session-timeout>0</session-timeout>
<cookie-config>
<name>JSESSIONID</name>
<domain>domainName</domain>
<path>/cookiePath</path>
<comment>cookie comment</comment>
<http-only>true</http-only>
<secure>true</secure>
<max-age>-1</max-age>
</cookie-config>
<tracking-mode>COOKIE</tracking-mode>
</session-config>
<replication-config>
<cache-name>web</cache-name>
<replication-granularity>SESSION</replication-granularity>
</replication-config>
</shared-session-config>
</jboss>
But now I'm putting the same xml.. or below xml snippet but could not work in JBOSS-7.3.6
<shared-session-config xmlns="urn:jboss:shared-session-config:2.0">
<distributable/>
<max-active-sessions>10</max-active-sessions>
-- rest copy from above
getting the following exception
21:50:31,221 ERROR [io.undertow.request] (default task-1) UT005023: Exception handling request to URL: java.lang.IllegalStateException: WFLYCLWEBUT0001: Session idKL5QLs4873uTTnzT6JFg03_avxMEa8Q1-B4Jy4 is invalid
at org.wildfly.clustering.web.undertow.session.DistributableSession.validate(DistributableSession.java:265)
at org.wildfly.clustering.web.undertow.session.DistributableSession.validate(DistributableSession.java:257)
Can anyone suggest how to achieve ?
Thanks in advance !
First of all you have to know that sharing sessions between web applications would violate the JavaEE Servlet specification! That means your applications may not be portable! However you can check the coresponding documentation for more info: Development Guide / Configuring Session Sharing Between Subdeployments In Enterprise Archives

JMS 2.0 durable subscriptions topic best practice in Kubernetes

We are creating a Mule application which will be running in a container on Kubernetes and will be in a replica set that will be connecting to JMS 2.0 Red Hat AMQ 7 (based on ActiveMQ Artemis).
The pom.xml has been configured to get the jms client:
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>artemis-jms-client-all</artifactId>
<version>2.10.1</version>
</dependency>
And the JMS config is configured as:
<jms:config name="JMS_Config" doc:name="JMS Config" doc:id="8621b07d-b203-463e-bbbe-76eb03741a61" >
<jms:generic-connection specification="JMS_2_0" username="${mq.user}" password="${mq.password}" clientId="${mq.client.id}">
<reconnection >
<reconnect-forever frequency="${mq.reconnection.frequency}" />
</reconnection>
<jms:connection-factory >
<jms:jndi-connection-factory connectionFactoryJndiName="ConnectionFactory" >
<jms:name-resolver-builder jndiInitialContextFactory="org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory" jndiProviderUrl="${mq.brokerurl}"/>
</jms:jndi-connection-factory>
</jms:connection-factory>
</jms:generic-connection>
<jms:consumer-config>
<jms:consumer-type >
<jms:topic-consumer shared="true" durable="true"/>
</jms:consumer-type>
</jms:consumer-config>
<jms:producer-config persistentDelivery="true"/>
</jms:config>
Then in the JMS listener component:
<jms:listener doc:name="EMS JMS Listener" doc:id="318b4f08-daf6-41f4-944b-3ec1420d5c12" config-ref="JMS_Config" destination="${mq.incoming.queue}" ackMode="AUTO" >
<jms:consumer-type >
<jms:topic-consumer shared="true" subscriptionName="${mq.sub.name}" durable="true"/>
</jms:consumer-type>
<jms:response sendCorrelationId="ALWAYS" />
</jms:listener>
The variables are set as:
mq.client.id=client-id-135a9514-d4d5-4f52-b01c-f6ca34a76b40
mq.sub.name=my-sub
mq.incoming.queue=my-queue
Is this the best way to configure the client? As we have seen errors in the logs when deployed to K8s regarding connections to the AMQ server:
javax.jms.InvalidClientIDException: client-id-135a9514-d4d5-4f52-b01c-f6ca34a76b40 was already set into another connection
In JMS 2.0 you don't have to set the client identifier when creating a shared durable subscription. However, if you do set the client identifier then it must be unique per connection. For whatever reason (e.g. due to Mule or perhaps K8s) multiple connections are being created and since each connection is using the same client identifier you're receiving the javax.jms.InvalidClientIDException.
Remove clientId="${mq.client.id}" from your configuration and the javax.jms.InvalidClientIDException should go away.

OpenJPA PersistenceException in Liberty 8.5.5.3 Profile due to invalid URL

I have just found an annoying mistake I made during the configuration of the DB2 JCC Properties in the "server.xml" of my Liberty Profile v8.5.5.3 which I wanted to share with you since it took me a long time searching the Web for helpful hints.
I configured a DB2 Datasource for JPA access in the "server.xml" using the Liberty Developer Tools in Eclipse Luna (Design tab): The "DB2 JCC Properties" are not sorted very clearly in my opinion. The required DB user name and password are not listed next to each other and made it hard for me to identify the correct properties. I unfortunately entered the DB user name in the field "Client User" instead of in "User" which is located nearly at the end of the list.
The thrown exception was:
<openjpa-2.2.3-SNAPSHOT-r422266:1595313 nonfatal general error> org.apache.openjpa.persistence.PersistenceException: There were errors initializing your configuration: <openjpa-2.2.3-SNAPSHOT-r422266:1595313 fatal user error> org.apache.openjpa.util.UserException: A connection could not be obtained for driver class "null" and URL "null". You may have specified an invalid URL.
at org.apache.openjpa.jdbc.schema.DataSourceFactory.newConnectException(DataSourceFactory.java:255)
at org.apache.openjpa.jdbc.schema.DataSourceFactory.installDBDictionary(DataSourceFactory.java:241)
at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory(JDBCConfigurationImpl.java:733)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:94) ... ... at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1176)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:795) Caused by: java.sql.SQLNonTransientException: [jcc][t4][10205][11234][4.18.60] Null userid is not supported. ERRORCODE=-4461, SQLSTATE=42815 DSRA0010E: SQL State = 42815, Error Code = -4,461
at com.ibm.db2.jcc.am.kd.a(kd.java:747)}
This exception indicates an incorrect connection URL: "You may have specified an invalid URL." but "A connection could not be obtained for driver class 'null' and URL 'null'" really pointed me in the wrong direction.
I recommend using the Source tab instead of the Design tab in the Liberty profile configuration tools and edit the XML entries manually to avoid wrong configuration values that may lead to confusion, e.g.
<server description="new server">
<!-- Enable features -->
<featureManager>
<feature>jsp-2.2</feature>
<feature>jdbc-4.0</feature>
<feature>jpa-2.0</feature>
</featureManager>
<httpEndpoint httpPort="9080" httpsPort="9443" id="defaultHttpEndpoint"/>
<applicationMonitor updateTrigger="mbean"/>
<dataSource id="DB2Connection" jndiName="jdbc/DB2Connection">
<jdbcDriver libraryRef="DB2jdbc4libs"/>
<properties.db2.jcc user="Administrator" databaseName="CUSTDB" password="{xor}password" portNumber="50000" serverName="dbserver.mycompany.com"/>
</dataSource>
<library id="DB2jdbc4libs">
<fileset caseSensitive="true" dir="/opt/db2/V10.5/java" includes="db2jcc_license_cu.jar, db2jcc.jar"/>
</library>
<webApplication id="DynWebJPASample" location="DynWebJPASample.war" name="DynWebJPASample"/>

Post Deployment Configuration of MDB using JCA Inbound Socket Resource

I have a message driven bean that is being invoked from data received on a TCP socket via a JCA Resource Adapter in a GlassFish 3.1.1 application server. The deployment descriptor in the sun-ejb-jar.xml file, specifies the URL and port of the socket. When the MDB is deployed, I see the app server execute the endpointActivation() method in the resource adapter with the MessageEndpointFactory and ActivationSpec as parameters.
This works fine when the URL and port are known before deployment and can be specified in the XML file, but now I need the ability to change the TCP socket during runtime in my EJB code. I couldn't find any references in the JCA spec about how to do this during runtime.
For reference, I downloaded the specification from Oracle's website.
J2EE Connector Architecture Specification Version 1.5
Basically, I'd like to move the following XML code that populates the ActivationSpec into my EJB code.
<sun-ejb-jar>
<enterprise-beans>
<ejb>
<ejb-name>MyInboundSocketMDB</ejb-name>
<mdb-resource-adapter>
<resource-adapter-mid>jca-sockets-rar</resource-adapter-mid>
<activation-config>
<activation-config-property>
<activation-config-property-name>url</activation-config-property-name>
<activation-config-property-value>localhost</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>port</activation-config-property-name>
<activation-config-property-value>5006</activation-config-property-value>
</activation-config-property>
</activation-config>
</mdb-resource-adapter>
</ejb>
</enterprise-beans>
</sun-ejb-jar>
Thanks for any suggestions.
You can change your activation-config-property-value in the glassfish web admin.