Migrate files from one esb to other - wso2

I have created few proxies, sequences and endpoints in wso2 esb in my system. I want to transfer these proxies, sequences and endpoints to another esb hosted at server. How to do this successfully?
Looking forward to your answers. Thanks in advance.

Lets say you have your first ESB located at ESB01_HOME directory and it contains all your defined proxy services, endpoints and other configurations. Now you took another fresh copy of the WSO2 ESB and extract that to a folder called ESB02_HOME.
You can copy the configuration files which were stored in ESB01_HOME/repository/deployment/server/synapse-configs/default (entire folder) in to the same directory in the ESB02 (ESB02_HOME/repository/deployment/server/synapse-configs/default). Now you can start the ESB02 and you can observe that all the configurations are installed in the ESB02.
If you are starting both the servers (ESB01 and ESB02), then you need to change the Offset parameter of the ESB02 carbon.xml configuration file which is located in the (ESB02_HOME/repository/conf/carbon.xml)
If you are copying the configurations from an older version of WSO2 ESB (3.x.x) then these configurations are located at ESB01_HOME/repository/conf/synapse-configs folder.

If both are in a clustered setup you can use deployment synchronizer/registry based synchronizer..If both are separate instances, copy the synapse-config folder(inside that, you can find proxy/seq/endpoint folders) to another home directpry

you can use the checkin-client tool inside the GREG.
With this tool you can move information from registry in ESB1 to registry in ESB2. information like dynamic sequences and endpoints for example.

Related

Migrating WSO2 api manager databases

I'm trying to migarte my API from one environment to another environment by copying H2 databases from wso2am-2.1.0/repository/database.
I know there is an utility for import/export but I have a lot of API and this utility is only processing by one API.
After copying databases , my APIs and tags are not shown in the store/publisher dashboard.
But if I check applications-->subscriptions, I can see theses API.
Any explication about this behaviour please?
Basically, WSO2 does not recommend to run production in H2 database. I hope this is a testing/ try out scenario. When you are running in production please use a production-ready databases such as oracle, mysql, mssql, etc.
The issue here is things you have listed as missing comes from the indexing. In your case, if there are lots of APIs, it would take time to index. WSO2 uses solr to index resources. If you copy the solr directory which resides in the WSO2 server folder to the new environment would work. Before replacing the folder please delete the complete folder in the new environment.
If this is not working you can re-index resources by following - https://stackoverflow.com/a/42646742/3176125.
When you are moving from one environment to another you need to copy the content which resides in the /repository/deployment/server/ folder. It contains synapse configs of the APIs, custom sequences, etc.

Deploy Rule Service WSO2 Business Rule Server

I was trying to deploy a rule service with WSO2 Business Rule Server
I exactly followed this link
http://docs.wso2.org/wiki/display/BRS200/Creating+and+Deploying+the+Rule+Service#CreatingandDeployingtheRuleService-RuleServiceWizard
I also made the jar file from 3 different class files:
OrderAccept.class OrderReject.class and PlaceOrder.class
I am trying to deploy the server with wizard in the end I got this error
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask. runPeriodic(ScheduledThreadPoolExecutor.java:181)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.
run(ScheduledThreadPoolExecutor.java:205)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
utor.java:885)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:907)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassNotFoundException: Class Not found : samples.userguide
.PlaceOrder
at org.apache.axis2.deployment.DeploymentClassLoader.findClass(Deploymen
tClassLoader.java:92)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at org.apache.axis2.deployment.DeploymentClassLoader.loadClass(Deploymen
tClassLoader.java:280)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at org.wso2.carbon.rule.common.config.HelperUtil.processFactDefaultValue
s(HelperUtil.java:43)
Anyone could help me where I might make mistakes?
It seems your jar files are not properly picked. One reason I can think of it, your axis2 archive has wrong folder structure. I am talking about the rule service upload mechanism. You may see there is a folder structure recommended in the documentation. After creating the .aar file, extract it and see whether you have the same folder structure. If it differs from the recommended one, your jar files will not get picked.
I've tried the same example and it's also giving me the same error(both methods, Rule service Upload and Rule Service Wizard). The folder structure that #Amila was suggesting seems to be ok according to the documentation. What I recently found is this link http://wso2.com/library/articles/2013/05/eclipse-plugin-wso2-business-rules-server from which I quote "Previously WSO2 BRS artifacts (aar/car) were created using the web UI rule wizard or creating the artifact by combining several artifacts. With the new WSO2 Developer Studio plug-in for rule services, one can easily create a complete deployable BRS artifact using the Eclipse IDE. Developers can easily create WSO2 BRS artifacts using this tool, and deploy it in the WSO2 Business Rules Server." What I'm guessing is that this new method/tool would substitute the "old" methods(upload and wizard). Give it a try.

Create a virtual directory in wso2

I am using wso2 application server v4.0 on Linux.
I have a webapp and I want to have a folder to store files. The folder size can be huge and the application could be redeployed as well, so directory is not inside the webapp.
How do I create a virtual directory or similar in wso2? That directory can be general, i mean it is not needed to be related to the webapp examples: localhost:80/myDirectory/ and localhost:80/myApplication/myDirectory/ are valid approaches to me.
There are some clear instructions to do it in tomcat but I can't find out how to translate this to tomcat in wso2.
Please checkout the sample available here.

WSO2 ESB - Data Services Server Feature - How to use Data Sources to swap data source on fly

I am using WSO2 ESB 4.0.3. I have installed WSO2 Data Services Feature on it and I have created DS.
There is feature in the ESB under "Configure" tab under admin UI where you can define the "Data Source".
My question is while creating new Data Service I am not able to use this "Data Source" which I have configured in ESB. We have different environments DEV / TEST / UAT / PROD. Each environment has different data base for same data service.
Currently I have manually change the DS XML file to point to new DB and then deploy.
Is there a way to point to the DB configured in ESB and change the DB for DS on the fly?
thanks
ABhijit
07/01/2012 -
Any update on this please ? This is Apple POC in their big group. If suceedded WSO2 will have Apple implementation?
If you've installed the dataservices features in to the same ESB instance that you've already been using, then it should be possible for you to use the datasources created via "Configure > Data Sources" menu. Because, when you create a particular datasource via the aforesaid option, it is visible to all the other installed features (that use datasources). But if you're having ESB and DSS in two boxes, the datasources defined in let's say ESB are not visible the DSS node unless you're having those nodes mounted to the same registry. However, this functionality too will be there in the next immediate upcoming release.
However, I'd suggest you the following pattern to get your requirement done. I;m assuming you're having DataServices features installed into ESBs in all your environments DEV / TEST / UAT / PROD. If so, you can create datasources using the "same name" (for eg: assume you have a datasource named "ds1" created in all 4 environments) via the "Configure > DataSources" menu pointing to different database configurations that you'll be using in each of those environments. Then you can point to the created datasource inside the DBS (dataservice discripters) as shown below.
<data name="TestDataService">
<config id="default">
<property name="carbon_datasource_name">ds1</property>
</config>
.....
</data>
Once you're done with those steps, whenever you deploy your dataservice in any of your environments, it will point to the relevant datasource without requiring you to reconfigure the database configurations manually and the relevant database configurations specific to each environment will be loaded dynamically at the runtime.
Hope the above explanation helps!
Regards,
Prabath
#----- Start of the configuration -----
synapse.datasources=TestDS,TestDS1
synapse.datasources.icFactory=com.sun.jndi.rmi.registry.RegistryContextFactory
synapse.datasources.providerPort=2199
#TestDS Configuration
synapse.datasources.TestDS.registry=JNDI
synapse.datasources.TestDS.type=BasicDataSource
synapse.datasources.TestDS.driverClassName=com.mysql.jdbc.Driver
synapse.datasources.TestDS.url=jdbc:mysql://localhost:3306/testDB
synapse.datasources.TestDS.username=dummy_username
synapse.datasources.TestDS.password=dummy_password
synapse.datasources.TestDS.dsName=TestDS
synapse.datasources.TestDS.maxActive=100
synapse.datasources.TestDS.maxIdle=20
synapse.datasources.TestDS.maxWait=10000
#TestDS1 configuration
synapse.datasources.TestDS1.registry=JNDI
synapse.datasources.TestDS1.type=BasicDataSource
synapse.datasources.TestDS1.driverClassName=com.mysql.jdbc.Driver
synapse.datasources.TestDS1.url=jdbc:mysql://localhost:3306/testDB1
synapse.datasources.TestDS1.username=dummy_username
synapse.datasources.TestDS1.password=dummy_password
synapse.datasources.TestDS1.dsName=TestDS1
synapse.datasources.TestDS1.maxActive=100
synapse.datasources.TestDS1.maxIdle=20
synapse.datasources.TestDS1.maxWait=10000
#----- End of the configuration -----

Where to put a configuration file for an Axis2 web service?

I'd like to have my Axis2 Web Service read from a configuration file, whose name is sent as a parameter to the service.
Where is the best place to put this file? And How to best access it? Examples welcome.
I've checked the current directory is the Apache/Tomcat/bin file, I could put it in the parent directory, or put it into a Apache/Tomcat/conf, although this looks like it's more reserved for apache configuration itself.
You don't want to load a configuration file on each request, which means configuration needs to be loaded ideally on startup.
In my experience that leaves you with two choices:
Embedded Spring container
JNDI
The former approach is described in the Axis2 documentation, the latter approach depends on the appserver/container you're using.
An example if JNDI configuration for jetty is here: