wso2ei 6.6 scheduler gets stopped automatically - wso2-enterprise-integrator

I am using WSO2 EI 6.6.0, sometimes the following task gets stopped automatically and it starts working again only after a restart. No error found in the logs. The task which I am using is a injectTo proxy service.
Please find the task configurations given below.
<?xml version="1.0" encoding="UTF-8"?>
<task xmlns="ws.apache.org/ns/synapse" name="Bank_Invoice_plan_out_xml_Task" class="org.apache.synapse.startup.tasks.MessageInjector" group="synapse.simple.quartz">
<trigger interval="5" />
<property xmlns:task="wso2.org/products/wso2commons/tasks" name="message">
<Input>Start</Input>
</property>
<property xmlns:task="wso2.org/products/wso2commons/tasks" name="proxyName" value="Bank_Invoice_plan_out_xml" />
<property xmlns:task="wso2.org/products/wso2commons/tasks" name="injectTo" value="proxy" />
</task>

Related

Ensure ordered shutdown of bundles in karaf

For a simple use-case, I have two bundles in Karaf as:
Bundle-Shared-Library
Bundle-My-Implementation -> depends on (1) Bundle-Shared-Library, mentioned in blueprint via depends-on attribute of the bean
Steps that I am following:
Load Bundle(1)
Load Bundle(2)
Shutdown karaf
It is evident that (2) is dependent on (1). While shutting down Karaf, Bundle(1) gets removed first, this results in the loss of in-flight messages as it cannot find its dependency and cannot process further.
I tried setting the start level of (1) both higher and lower than that of bundle(2). This did not help.
Also, I tried setting org.apache.aries.blueprint.preemptiveShutdown=false in etc/config.properties. This did not help as well.
Am I missing something here?
-- EDIT 1 --
After looking a bit over here and there, I found out that we can set a custom value for timeout in DefaultShutdownStrategy. So, as a workaround, I have done following:
<bean id="shutdownStrategy" class="org.apache.camel.impl.DefaultShutdownStrategy">
<property name="timeout" value="1" />
</bean>
I understand that this is not a clean and optimal way to do. For the time being, it somehow helps me from losing a lot of in-flight messages.
But, any suggestion or feedback would be great.
-- EDIT 2 -- Adding Blueprint File of Bundle 1
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.3.0"
xmlns:camel="http://camel.apache.org/schema/blueprint"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd
http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.3.0 http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.3.0.xsd
">
<!-- persistent-id for shared context -->
<cm:property-placeholder persistent-id="xxx.shared" update-strategy="none" >
<cm:default-properties>
...
</cm:default-properties>
</cm:property-placeholder>
<!--jms broker connection-->
<reference id="jmsProducerConnectionFactory" interface="javax.jms.ConnectionFactory" filter="(osgi.jndi.service.name=jms/xxx.producer)" availability="mandatory" />
<bean id="xxx-producer" class="org.apache.camel.component.jms.JmsComponent">
<property name="connectionFactory" ref="jmsProducerConnectionFactory"/>
</bean>
<!-- Source DB Reference -->
<reference id="XDataSource" interface="javax.sql.DataSource" filter="(osgi.jndi.service.name=xxx-datasource)" availability="mandatory"/>
<!-- Datawarehouse DB Reference -->
<reference id="dw" interface="javax.sql.DataSource" filter="(osgi.jndi.service.name=xdb-datasource)" availability="mandatory"/>
<bean id="prs" class="org.apache.camel.component.sql.SqlComponent">
<property name="dataSource" ref="XDataSource"/>
</bean>
<bean id="timestamp" class="org.library.shared.TimestampImplementation" destroy-method="synchronize" depends-on="dw">
<argument index="0" ref="dw" />
<argument index="2" value="Orders" />
</bean>
<bean id="shutdownStrategy" class="org.apache.camel.impl.DefaultShutdownStrategy">
<property name="timeout" value="1" />
</bean>
<camelContext id="camel-context" xmlns="http://camel.apache.org/schema/blueprint" depends-on="timestamp">
<packageScan>
<package>org.xyz.orders.routing</package>
</packageScan>
</camelContext>
</blueprint>
The other bundle is simply a collection of few classes (a shared library), which I have included as a maven dependency. There is no blueprint file for that bundle.
Due to organizational issues, I have used dummy names at some places.

How can I enhance classes for openJPA with gradle

I am stuck setting up a simple test program with
- eclipse
- gradle (Eclipse Buildship plugin)
- openjpa
When I try to run my application I get this error, when I call the entityManager.persist(...) method:
Exception in thread "main" org.apache.openjpa.persistence.ArgumentException: Attempt to cast instance "test.jpa.Person#27c6e487" to PersistenceCapable failed. Ensure that it has been enhanced.
FailedObject: test.jpa.Person#27c6e487
The program is simple, it just has one entity (Person.java).
My persistence.xml looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="ptest"
transaction-type="RESOURCE_LOCAL">
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<properties>
<property name="openjpa.ConnectionURL" value="jdbc:mysql://localhost:3306/ptest" />
<property name="openjpa.ConnectionDriverName" value="com.mysql.jdbc.Driver" />
<property name="openjpa.ConnectionUserName" value="..." />
<property name="openjpa.ConnectionPassword" value="..." />
<property name="openjpa.RuntimeUnenhancedClasses" value="unsupported" />
<property name="openjpa.DynamicEnhancementAgent" value="false" />
<property name="openjpa.Log" value="SQL=ERROR" />
<property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
<property name="openjpa.ConnectionFactoryProperties"
value="PrettyPrint=true, PrettyPrintLineLength=72, PrintParameters=true, MaxActive=10, MaxIdle=5, MinIdle=2, MaxWait=60000" />
</properties>
</persistence-unit>
</persistence>
I have used RuntimeUnenhancedClasses=unsupported and DynamicEnhancementAgent=false, for it was recommended by apache. But I have tried with "supported" and "true" and I still get the same error (for openjpa version 2.1.0 - for higher versions I get a LinageError with "supported/true").
I have tried different versions of jpa, currently using 2.4.2.
I have goodled for gradle scripts to enhance my class, I tried
'at.schmutterer.oss.gradle:gradle-openjpa:0.2.0'
'neva.openjpa'
and some more, but I just cannot enhance the class.
Of course I have goodled for quite some time. I am thankful for any idea I can follow...
Thanks in advance!
Just in case someone else has the same struggle. I have found a solution to this problem:
TomEE ships with JPA and everything that is needed. The eclipse "gradle buildship" plugin can be used to compile code. So the combination of the following components works perfectly fine for me:
apache-tomee-plus-7.0.2
tomcat v8.5 server (pointing to the apache-tommee installation)
Dynamic Web Project (using Dynamic Web Module 3.1)
Java Runtime Environment v1.8
The gradle script reduces simply to this:
apply plugin: 'war'
repositories {
mavenCentral()
}
dependencies {
providedCompile "javax:javaee-api:7.0"
}
I suppose it also works with TomEE 1.7.x and javaee-api:6.0, but I have not tried it.

How to attach the Sonar JUnitListener when not using maven?

I have a Sonar analysis configured to use sonar-ant-task.
JUnit tests are executed with the Eclipse test framework (as a JUnit Plug-in test, using the PDE) and it uses the JaCoCo agent for the on-the-fly instrumentation.
The results are then stored in the directory ./junit/results/ in JUnit XML format.
Here is the configuration for the Sonar (using Ant):
<property name="sonar.projectKey" value="my-project" />
<property name="sonar.projectName" value="My Project" />
<property name="sonar.working.directory" value="./.sonar" />
<property name="sonar.sources" value="$./src" />
<property name="sonar.java.binaries" value="./bin" />
<property name="sonar.java.libraries" value="./lib" />
<property name="sonar.tests" value="./tests" />
<property name="sonar.dynamic" value="reuseReports" />
<property name="sonar.junit.reportsPath" value="./junit/result" />
<property name="sonar.java.coveragePlugin" value="jacoco" />
<property name="sonar.jacoco.reportPath" value="./jacoco/jacoco.exec" />
In the directory junit/result there is a file with name AllTests.xml that has this content (sensitive part in the properties section was ommitted):
<?xml version="1.0" encoding="UTF-8" ?>
<testsuites>
<testsuite errors="0" failures="0" hostname="vmtnetci002" id="0" name="AllTests" package="com.example.company.project.tests" tests="2" time="100.000" timestamp="2015-07-09T17:31:51">
<properties>
<!-- ... -->
</properties>
<testcase classname="com.example.company.project.tests.MyTest" name="test1" time="50.000" />
<testcase classname="com.example.company.project.tests.MyTest" name="test2" time="50.000" />
<system-out><![CDATA[]]></system-out>
<system-err><![CDATA[]]></system-err>
</testsuite>
</testsuites>
Code coverage is reported correctly to Sonar but during the Sonar analysis it shows this message in the log:
...
INFO - Sensor SurefireSensor
INFO - parsing ./junit/results
INFO - Sensor SurefireSensor (done) | time=23ms
...
INFO - No information about coverage per test.
And then I don't have information about JUnit tests result in Sonar, so I think it might be related with the message above.
How can I attach the sonar JUnitListener when running the tests?

Create vcs root using Teamcity REST API

I am trying to create a VCS Root using Teamcity REST API. Following the REST Documentation, I am posting below XML to http://TeamcityServer/httpAuth/app/rest/vcs-roots
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<vcs-root name="TestVCS" vcsName="svn" modificationCheckInterval="5" href="/httpAuth/app/rest/vcs-roots/id:TestVCS">
<project id="TestProject" name="<Root project>" href="/httpAuth/app/rest/projects/id:TestProject"/>
<properties>
<property name="externals-mode" value="externals-full"/>
<property name="labelingMessage" value="Labeled automatically by TeamCity"/>
<property name="labelingPatterns" value="trunk=>tags"/>
<property name="svn-config-directory" value="C:\Windows\system32\config\systemprofile\AppData\Roaming\Subversion"/>
<property name="svn-use-default-config-directory" value="true"/>
<property name="url" value="https://svn-uat.net/TestProject"/>
<property name="user" value="testuser"/>
<property name="password" value="testpwd"/>
<property name="working-copy-format" value="1.6"/>
</properties>
<vcsRootInstances href="/httpAuth/app/rest/vcs-root-instances?locator=vcsRoot:(id:TestVCS)"/>
</vcs-root>
This creates VCS root but the password property remains empty. I tried setting password explicitly using http://TeamcityServer/httpAuth/app/rest/vcs-roots/VCSId/properties/password , but even this doesn't seem to set the password for the VCS root.
So I found the answer on Jetbrains Developer Community. This is because Teamcity for security reasons uses "secure:svn-password" for SVN and "secure:passwd" for Perforce rather than simple password. So I changed my XML to something like:
<property name="secure:svn-password" value="testpwd"/>

How Wso2CEP pick the messages in JMS

I am using wso2cep 3.0.0 and activemq5.8.0 As per CEP documents i wish to Publish events using CEP. For that i started activemq with 2 define QUEUES with the name jmsProxy for incoming message and JmsProxy for out message.I added required jars in CEP lib activemq-broker-5.8.0.jar,activemq-client-5.8.0.jar,axiom.jar,geronimo-j2ee-management_1.1_spec-1.0.1.jar,geronimo-jms_1.1_spec-1.1.1.jar,hawtbuf-1.2.jar,xpp3-1.1.4c.jar,xstream-1.4.4.jar
my configuration is like this InputEventAdaptor
<?xml version="1.0" encoding="UTF-8"?>
<inputEventAdaptor name="jmsProxy" statistics="disable" trace="enable"
type="jms" xmlns="http://wso2.org/carbon/eventadaptormanager">
<property name="java.naming.provider.url">tcp://localhost:61616</property>
<property name="transport.jms.SubscriptionDurable">true</property>
<property name="transport.jms.DurableSubscriberName">jmsProxy</property>
<property name="transport.jms.UserName">admin</property>
<property name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</property>
<property name="transport.jms.Password">admin</property>
<property name="transport.jms.ConnectionFactoryJNDIName">QueueConnectionFactory</property>
<property name="transport.jms.DestinationType">queue</property>
</inputEventAdaptor>
above for incoming messages which will pick the messages from jmsProxy queue But its unable to pick the message from jmsProxy Queue.How would i initiate this to get the message into CEP and outputEventAdaptor I need to intialize some thing for jms could pick the messages from jMS why because i have tried in many ways all the configuration is ok but unable to pick the message from JMS
<?xml version="1.0" encoding="UTF-8"?>
<outputEventAdaptor name="JmsProxy" statistics="disable" trace="disable"
type="jms" xmlns="http://wso2.org/carbon/eventadaptormanager">
<property name="java.naming.security.principal">admin</property>
<property name="java.naming.provider.url">tcp://localhost:61616</property>
<property name="java.naming.security.credentials">admin</property>
<property name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</property>
<property name="transport.jms.ConnectionFactoryJNDIName">QueueConnectionFactory</property>
<property name="transport.jms.DestinationType">queue</property>
</outputEventAdaptor>
event builder configuration like this
<?xml version="1.0" encoding="UTF-8"?>
<eventBuilder name="ReadingsDtoBuilder" statistics="disable"
trace="disable" xmlns="http://wso2.org/carbon/eventbuilder">
<from eventAdaptorName="jmsProxy" eventAdaptorType="jmsProxy">
<property name="transport.jms.Destination">JmsProxy</property>
</from>
<mapping customMapping="disable"
parentXpath="//ReadingsLiteTaildtos" type="xml">
<property>
<from xpath="//ReadingsLiteTaildto/ParameterId"/>
<to name="meta_parameterId" type="string"/>
</property>
<property>
<from xpath="//ReadingsLiteTaildto/Slno"/>
<to name="meta_slno" type="string"/>
</property>
<property>
<from xpath="//ReadingsLiteTaildto/FinalValue"/>
<to name="finalValue" type="int"/>
</property>
<property>
<from xpath="//ReadingsLiteTaildto/InputText"/>
<to name="inputText" type="string"/>
</property>
<property>
<from xpath="//ReadingsLiteTaildto/InputValue"/>
<to name="inputValue" type="double"/>
</property>
</mapping>
<to streamName="org.sample.readings.dto.stream" version="1.0.0"/>
</eventBuilder>
The execution plan can be as follows.like this
<?xml version="1.0" encoding="UTF-8"?>
<executionPlan name="ReadingsAnalyzer" statistics="disable"
trace="disable" xmlns="http://wso2.org/carbon/eventprocessor">
<description>This execution plan analyzes readings and triggers notifications based on threshold.</description>
<siddhiConfiguration>
<property name="siddhi.enable.distributed.processing">false</property>
<property name="siddhi.persistence.snapshot.time.interval.minutes">0</property>
</siddhiConfiguration>
<importedStreams>
<stream as="readings" name="org.sample.readings.dto.stream" version="1.0.0"/>
</importedStreams>
<queryExpressions><![CDATA[from readings[finalValue > 100]
select *
insert into notificationStream;]]></queryExpressions>
<exportedStreams>
<stream name="notificationStream" valueOf="notificationStream" version="1.0.0"/>
</exportedStreams>
</executionPlan
I defined streams inside stream-manager-config.xml similar to the following.
<streamDefinition name="org.sample.readings.dto.stream" version="1.0.0">
<metaData>
<property name="parameterId" type="STRING"/>
<property name="slno" type="STRING"/>
</metaData>
<payloadData>
<property name="finalValue" type="INT"/>
<property name="inputText" type="STRING"/>
<property name="inputValue" type="DOUBLE"/>
</payloadData>
</streamDefinition>
<streamDefinition name="notificationStream" version="1.0.0">
<metaData>
<property name="parameterId" type="STRING"/>
<property name="slno" type="STRING"/>
</metaData>
<payloadData>
<property name="finalValue" type="INT"/>
<property name="inputText" type="STRING"/>
<property name="inputValue" type="DOUBLE"/>
</payloadData>
</streamDefinition>
its look like all well while i am sending any message to my jmsProxy queue the message is not reflecting to CEP for event and i am getting this message in CEP.
Means its unable to get the message into CEP and i am getting errors like this
[2014-02-18 11:57:53,159] INFO - {EventBuilderDeployer} Event Builder undeployed successfully : ReadingsDtoBuilder.xml
[2014-02-18 11:57:53,160] INFO - {EventBuilderDeployer} Event builder deployment held back and in inactive state :ReadingsDtoBuilder, Waiting for Input Event Adaptor dependency :jmsProxy
[2014-02-18 12:03:58,006] INFO - {InputEventAdaptorConfigurationFilesystemInvoker} Input Event Adaptor configuration deleted from file system : jmsProxy.xml
[2014-02-18 12:03:58,006] INFO - {InputEventAdaptorDeployer} Input Event Adaptor undeployed successfully : jmsProxy.xml
[2014-02-18 12:03:58,008] INFO - {InputEventAdaptorConfigurationFilesystemInvoker} Input Event Adaptor configuration saved in th filesystem : jmsProxy
[2014-02-18 12:03:58,009] INFO - {InputEventAdaptorDeployer} Input Event Adaptor deployed successfully and in active state : jmsProxy
[2014-02-18 12:03:58,009] INFO - {EventBuilderDeployer} Event Builder undeployed successfully : ReadingsDtoBuilder.xml
[2014-02-18 12:03:58,009] INFO - {EventBuilderDeployer} Event builder deployment held back and in inactive state :ReadingsDtoBuilder, Waiting for Input Event Adaptor dependency :jmsProxy
I am really fed up with wso2 docs no proper explanation on any topic.How its wirk how INCOMING message will get into input event builder Please help me to get out from this issue.
Thanks in advance,
Faisal shaik
Looking at your configuration, it seems that you have specified the input adaptor type as 'jmsProxy' which is incorrect. It should be corrected as simply 'jms'. i.e.
<from eventAdaptorName="jmsProxy" eventAdaptorType="jms">
The way the JMS connection works is as follows. The connection details are specified by the Input event adaptor. But the subscription to a particular topic or listening on a particular queue happens only after the event builder configuration is specified since the topic/queue name is specified in the event builder configuration as the property 'transport.jms.Destination'.
So if you specified the Destination as 'JmsProxy' in the event builder configuration, make sure that a queue by the name of 'JmsProxy' exists in the ActiveMQ broker and that events are published to this queue.
The easiest way to troubleshoot the issue you are encountering would be to enable tracing of CEP artifacts. Each event goes through the sequence of Input Event Adaptor -> Event Builder -> Event Processor (Execution Plan) -> Event Formatter -> Output Event Adaptor. If you enable tracing of all 5 artifacts and tracing reports incoming and outgoing events at Input Event Adaptor and only incoming events at Event Builder, you can conclude that the issue is in the event builder configuration and so on.
If you still encounter an issue after fixing the Input Event Adaptor type, please enable tracing and share the relevant messages printed in the trace to identify in which artifact the issue is arising.
Hope this helps,

Resources