Labels

Tuesday, March 14, 2017

X11 connection rejected because of wrong authentication

Remote window forwarding for different user

When I try the remote window forwarding from the default user I was able to successfully forward the window. But when I try this in a different user (oracle) this failed with the below error.

[oracle@oracle-rac-setup-node1 wso2]$ xterm
X11 connection rejected because of wrong authentication.
X connection to localhost:10.0 broken (explicit kill or server shutdown).

This seems to be an issue with the cookie but I tried adding the cookie but didn't work so this will provide you an alternative to fix this issue.

1. Login as the super user
2. Copy the Xauthority file of the working user to the other user.
 
[wso2@oracle-rac-setup-node1 ~]$ sudo -i
[root@oracle-rac-setup-node1 ~]# cp /home/wso2/.Xauthority /home/oracle/.Xauthority
 
Login to the oracle user and try xterm to verify if the window forwarding works.
[wso2@oracle-rac-setup-node1 ~]$ xterm 
 
 


Friday, August 19, 2016

Sharing Subscribers' Application and Subscriptions with Other Subscribers + WSO2 APIM

Hi All,

It is really easy to share your subscriptions within your team or organization.  Please follow the below steps which shows how to configure and use.

STEPS
1.  Go to the api-manager.xml file and Uncomment the <GroupingExtractor> element.
  path - wso2am-1.10.0/repository/conf/api-manager.xml
2. Start the server.
3. If you dont have any API's created. Create and publish an API from the APIM publisher
4. Login to the API Store and go to the signup page. Fill the user details and click more details add an organization name

5. login using that and user and create application and subscribe
6. sign-out from that user and create a new user with the same organization name.  login from that user you can get the first users applications and subscriptions.


If you have any issues feel free to drop a comment.
Have Fun !!!

Tuesday, July 26, 2016

Retry when Call Mediator fails in In-Sequence WSO2 ESB

Hi All,
This blog post is to show how you could retry when the there is an issue in the in-sequence.

Flow
when the proxy is invoked it will hit the in-sequence(foo) and if there is an issue, onError sequence will be called(retryError).
In the bellow retryError sequence it will check if the error is occurred from login request failure, then it will retry (call back) the foo .
I have specified the retry count as 2 and have added a tread sleep between retries.

How to configure
1. Add this foo sequence as a seperate sequence and use in the proxy service In-Sequence
 Add an onError option to the sequence
e.g -

<sequence name="foo" onError="retryError" xmlns="http://ws.apache.org/ns/synapse">
    <log>
        <property name="Test" value="Inside the in sequence"/>
    </log>
    <call blocking="true">
        <endpoint>
            <address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
        </endpoint>
    </call>
</sequence>
2. Create a new sequence retryError and the bellow code
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="retryError" xmlns="http://ws.apache.org/ns/synapse">
    <filter xmlns:ns="http://org.apache.synapse/xsd"
        xmlns:ns3="http://org.apache.synapse/xsd" xpath="get-property('retry_count')">
        <then>
            <property expression="number(get-property('retry_count'))+1"
                name="retry_count" scope="default"/>
            <filter xpath="get-property('retry_count') > 2">
                <then>
                    <log/>
                    <drop/>
                </then>
                <else>
                    <script language="js"><![CDATA[java.lang.Thread.sleep(5000);]]></script>
                    <clone continueParent="true" sequential="false">
                        <target sequence="foo"/>
                    </clone>
                </else>
            </filter>
        </then>
        <else>
            <script language="js"><![CDATA[java.lang.Thread.sleep(5000);]]></script>
            <property name="retry_count" scope="default" type="STRING" value="1"/>
            <clone continueParent="true" sequential="false">
                <target sequence="foo"/>
            </clone>
        </else>
    </filter>
</sequence>

 If you have an easy way to do this feel free to comment

Have Fun !!!!

Friday, July 22, 2016

Transforming a Json Request In WSO2 API Cloud

Hi All,

If you require to transform an incoming Json request to a Json request  of a different format (Add extra values). You can simply do it by changing the default mediation flow.
This post is to show how you could archive that in a simple and easy steps.

Payload sent from user to the backend

  "tutorials": {
        "id": "wso2",
        "topic": "REST Service",
        "description": "This is REST Service Example by WSO2."
    }


Modified payload sent to backend - (Add the username of the user to the payload data )

{
  "data": {
    "tutorials": {
      "id": "wso2",
      "topic": "REST Service",
      "description": "This is REST Service Example by WSO2."
    }
  },
  "user": "vinurid.wso2.com@testuser"
}


All you have to do is write a custom sequence that modify the payload using PayloadFactory Mediator.
If you want to know more details about the mediator can follow this WSO2 Documentation - https://docs.wso2.com/display/ESB490/PayloadFactory+Mediator

This is a sample sequence that you can use to do the above Payload transformation. You have to save the bellow sequence to an xml file and add to the in-sequence in the API.

<sequence xmlns="http://ws.apache.org/ns/synapse" name="CustomerSequence">
         <payloadFactory media-type="json">
            <format>{"data":$1, "user":"$2"}</format>
            <args>
               <arg evaluator="json" expression="json-eval($)"/>
            <arg expression="$ctx:api.ut.userId"/>
            </args>
         </payloadFactory>
</sequence>


You could follow the bellow video on step by step guidance on how to do this in WSO2 Cloud.
Content in the video
1. Creating an API in WSO2 Cloud.
2. Change the mediation flow in the API in-sequence
3. Show the sequence that added to the in-sequence
4. publish the API
5. Subscribe to the newly created API in WSO2 API Cloud
6. Invoke the API. (Video shows the payload which user sent to the backend)
7. Shows the output for the request
8. Shows the in-coming request in the backend logs. (Request that sent to the backend from the WSO2 API Cloud)




Sunday, June 26, 2016

Enabling APIM - BPS Workflow Integration In a Cluster + WSO2

Hi All,

This Post show how you could configure WSO2 APIM workflows in a cluster.
Please Note this post is based on the bellow documentation, more like a summary of what you really should do.
https://docs.wso2.com/display/AM1100/Configuring+Workflows+in+a+Cluster
https://docs.wso2.com/display/AM1100/Adding+an+Application+Creation+Workflow

WSO2 Product Versions -
wso2bps 3.5.1
wso2am 1.10.0

Setup Information

  1. 2 bps nodes clustered with a LB
  • <bps1 IP> hostname /IP of the bps node 1
  • <bps2 IP> hostname /IP of the bps node 2
  • <bpsLB IP> hostname /IP of the bps LB
  1. 2 APIM store nodes clustered  with a LB

Important Notes -

  • Assuming that the admin role is not changed.
  • All bps and apim nodes are running in a separate servers and started using offset 0
  • Configuring the Admin Dashboard in store side.
  • Please note both nodes should have the correct server certificates and the client-truststore should know both sides as well

Setting up APIM store node

  1. Change the workFlowServerURL in the admin dashboard configuration. wso2am-1.10.0/repository/deployment/server/jaggeryapps/admin-dashboard/site/conf/site.json
"workFlowServerURL": "https://<bpsLB>:9443/services/",
  1. Changed the WorkflowCallbackService.xml to point the store node.
Since we are configuring the admin-dashboard of the store side, keeping it as  localhost:9443
/wso2am-1.10.0/repository/deployment/server/synapse-configs/default/proxy-services/WorkflowCallbackService.xml
  1. Login to the API Store management console and change the WorkFlowExtensions callbackURL and serviceEndpoint in the registry.
/_system/governance/apimgt/applicationdata/workflow-extensions.xml
E.g - comment the simple workflow executor and enable WS Workflow Executor

<ApplicationCreation executor="org.wso2.carbon.apimgt.impl.workflow.ApplicationCreationWSWorkflowExecutor">
        <Property name="serviceEndpoint"> http://<bpsLB IP>:9763/services/ApplicationApprovalWorkFlowProcess/  </Property>
        <Property name="username">userName</Property>
        <Property name="password">Password</Property>
        <Property name="callbackURL">https://<storeLB IP>:8243/services/WorkflowCallbackService</Property>
    </ApplicationCreation>

Setting Up BPS Node


  1. <BPS_HOME>/repository/conf/humantask.xml file and <BPS_HOME>/repository/conf/b4p-coordination-config.xml file and set the TaskCoordinationEnabled property to true.
<TaskCoordinationEnabled>true</TaskCoordinationEnabled>
  1. Copy the following from the <APIM_HOME>/business-processes/epr folder to the <BPS_HOME>/repository/conf/epr folder. If the <BPS_HOME>/repository/conf/epr folder does not exist, please create it.
  • In the *CallbackService.epr file change the Address to <storeLB ip> and  also change the username and password
  • In the *Service.epr change the  Address to store node ip or localhost and also change the username and password
  1. Unzip the <APIM_HOME>/business-processes/user-signup/BPEL/*  (Similar to all the other workflows)
  • Change the address port to 9443 in the ApprovalTask wsdl file e.g - UserApprovalTask.wsdl
  • In the CallbackService WSDL point the address elements to <storeLB IP>
  1. Zip back the files and upload it into the BPS.
  2. Unzip the <APIM_HOME>/business-processes/<workflow name>/HumanTask fie.
  • Change the port to 9763 in ApprovalTask WSDL
  1. Zip back the files and upload it into the BPS Human Task.

Create an Application In store side and login to the admin dashboard to check if workflows working properly.

Have Fun !!! 
 

Friday, June 24, 2016

Gadgets Wont display for the IP address ERROR {org.apache.shindig.gadgets.render.DefaultServiceFetcher} + WSO2 Dashboard

Hi All,
I got this error accessing the DAS Dashboard (Portal) from the IP address instead of localhost.

ERROR {org.apache.shindig.gadgets.render.DefaultServiceFetcher} -  Services methods from the https://IP:9443/shindig/rpc endpoint could not be fetched. The following error occurred: javax.net.ssl.SSLException: hostname in certificate didn't match: <IP> != <localhost>. {org.apache.shindig.gadgets.render.DefaultServiceFetcher}
TID: [-1] [] [2016-06-10 12:07:50,257]  INFO {org.apache.shindig.gadgets.http.BasicHttpFetcher} -  The following exception occurred when fetching https://IP:9443/portal/store/carbon.super/gadget/Message_Table/index.xml: 11 ms elapsed. {org.apache.shindig.gadgets.http.BasicHttpFetcher}
TID: [-1] [] [2016-06-10 12:07:50,259]  INFO {org.apache.shindig.gadgets.http.BasicHttpFetcher} -   {org.apache.shindig.gadgets.http.BasicHttpFetcher}
javax.net.ssl.SSLException: hostname in certificate didn't match: <IP> != <localhost>
        at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:238)
        at org.apache.http.conn.ssl.BrowserCompatHostnameVerifier.verify(BrowserCompatHostnameVerifier.java:54)
        at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:159)
        at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:140)
        at org.apache.http.conn.ssl.SSLSocketFactory.verifyHostname(SSLSocketFactory.java:561)
        at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:536)
        at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:403)
        at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:177)
        at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:144)
        at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:131)
        at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:611)
        at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:446)
        at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)
        at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:115)
        at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)
        at org.apache.shindig.gadgets.http.BasicHttpFetcher.fetch(BasicHttpFetcher.java:359)
        at org.apache.shindig.gadgets.http.DefaultRequestPipeline.fetchResponse(DefaultRequestPipeline.java:191)
        at org.apache.shindig.gadgets.http.DefaultRequestPipeline.execute(DefaultRequestPipeline.java:135)
        at org.apache.shindig.gadgets.AbstractSpecFactory.fetchFromNetwork(AbstractSpecFactory.java:134)
        at org.apache.shindig.gadgets.AbstractSpecFactory.getSpec(AbstractSpecFactory.java:94)
        at org.apache.shindig.gadgets.DefaultGadgetSpecFactory.getGadgetSpec(DefaultGadgetSpecFactory.java:75)
        at org.apache.shindig.gadgets.process.Processor.process(Processor.java:104)
        at org.apache.shindig.gadgets.servlet.GadgetsHandlerService.getMetadata(GadgetsHandlerService.java:210)
        at org.apache.shindig.gadgets.servlet.GadgetsHandler$5.call(GadgetsHandler.java:307)
        at org.apache.shindig.gadgets.servlet.GadgetsHandler$5.call(GadgetsHandler.java:304)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)


If you are also facing the same issueAll you have to do is add a self sign certificate for the server DAS is running.
You could use the bellow article on creating the certificate.
http://wso2.com/library/knowledge-base/2011/08/adding-ca-certificate-authority-signed-certificate-wso2-products/

Not Retrieving Pending Tasks. Check BPS Connectivity + WSO2 APIM 1.10

Hi All,
I got this issue when configuring the APIM workflow support.  Because of this issue APIM admin dashboard cannot retrieve any of the pending tasks which needed to be approve.

WARN {JAGGERY.site.blocks.user.login.ajax.login:jag}- Not Retrieving Pending Tasks. Check BPS Connectivity {JAGGERY.site.blocks.user.login.ajax.login:jag}

WSO2 Versions - 
API Manager 1.10
BPS 3.5.1

Please find the Bellow steps to Identify the correct issue (debug) and fix.

- This issue can mainly occur due to an incorrect bps path given for the workFlowServerURL in the Admin Dashboard.
Verify the workFlowServerURL in the site.json file.
 <APIM HOME>/repository/deployment/server/jaggeryapps/admin-dashboard/site/conf/site.json 

- If your issue is still exists, this can be occur due to a connection timeout or a certificate issues. Easiest way to verify the issue is by putting a log to the login.jag
<APIM HOME>/repository/deployment/server/jaggeryapps/admin-dashboard/modules/user/login.jag

grep the code and find the WARN message "Not Retrieving Pending Tasks" 
Add the bellow mention error log to the code and test again. You will get the full stack trace and it will be easy to identify the main issue.
} catch(e) {
    log.error(e);
    log.warn("Not Retrieving Pending Tasks. Check BPS Connectivity");
}

Thursday, September 3, 2015

Error - Cannot run program "chmod": CreateProcess error=2, The system cannot find the file specified in wso2 BAM

Hi,
I got this error when starting the WSO2 BAM in Windows Machine.
I had struggle with this error for a few hours and finally got it working.

ERROR {org.apache.hadoop.hive.ql.exec.ExecDriver} -  Job Submission failed with exception 'java.io.IOException(Cannot run program "chmod": CreateProcess error=2, The system cannot find the file specified)'
java.io.IOException: Cannot run program "chmod": CreateProcess error=2, The system cannot find the file specified
 at java.lang.ProcessBuilder.start(ProcessBuilder.java:1047)
 at org.apache.hadoop.util.Shell.runCommand(Shell.java:200)
 at org.apache.hadoop.util.Shell.run(Shell.java:182)
 at org.apache.hadoop.util.Shell$ShellCommandExecutor.execute(Shell.java:375)
 at org.apache.hadoop.util.Shell.execCommand(Shell.java:461)
 at org.apache.hadoop.util.Shell.execCommand(Shell.java:444)
 at org.apache.hadoop.fs.RawLocalFileSystem.execCommand(RawLocalFileSystem.java:553)
 at org.apache.hadoop.fs.RawLocalFileSystem.execSetPermission(RawLocalFileSystem.java:545)
 at org.apache.hadoop.fs.RawLocalFileSystem.setPermission(RawLocalFileSystem.java:531)
 at org.apache.hadoop.fs.RawLocalFileSystem.mkdirs(RawLocalFileSystem.java:324)
 at org.apache.hadoop.fs.FilterFileSystem.mkdirs(FilterFileSystem.java:183)
 at org.apache.hadoop.mapreduce.JobSubmissionFiles.getStagingDir(JobSubmissionFiles.java:116)
 at org.apache.hadoop.mapred.JobClient$2.run(JobClient.java:798)
 at org.apache.hadoop.mapred.JobClient$2.run(JobClient.java:792)
 at java.security.AccessController.doPrivileged(Native Method)
 at javax.security.auth.Subject.doAs(Subject.java:415)
 at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1123)
 at org.apache.hadoop.mapred.JobClient.submitJobInternal(JobClient.java:792)
 at org.apache.hadoop.mapred.JobClient.submitJob(JobClient.java:766)
 at org.apache.hadoop.hive.ql.exec.ExecDriver.execute(ExecDriver.java:460)
 at org.apache.hadoop.hive.ql.exec.ExecDriver.main(ExecDriver.java:733)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:606)
 at org.apache.hadoop.util.RunJar.main(RunJar.java:156)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
 at java.lang.ProcessImpl.create(Native Method)
 at java.lang.ProcessImpl.(ProcessImpl.java:385)
 at java.lang.ProcessImpl.start(ProcessImpl.java:136)
 at java.lang.ProcessBuilder.start(ProcessBuilder.java:1028)
 ... 25 more
 {org.apache.hadoop.hive.ql.exec.ExecDriver}
TID: [0] [BAM] [2015-09-03 12:58:12,130] ERROR {org.apache.hadoop.hive.ql.exec.Task} -  Execution failed with exit status: 2 {org.apache.hadoop.hive.ql.exec.Task}
TID: [0] [BAM] [2015-09-03 12:58:12,130] ERROR {org.apache.hadoop.hive.ql.exec.Task} -  Obtaining error information {org.apache.hadoop.hive.ql.exec.Task}
TID: [0] [BAM] [2015-09-03 12:58:12,130] ERROR {org.apache.hadoop.hive.ql.exec.Task} -  
Task failed!
Task ID:
  Stage-0

Logs:
 {org.apache.hadoop.hive.ql.exec.Task}
TID: [0] [BAM] [2015-09-03 12:58:12,130] ERROR {org.apache.hadoop.hive.ql.exec.Task} -  C:\Users\wso2\Desktop\ME\WSO2BA~1.0\WSO2BA~1.0\bin\../repository/logs//wso2carbon.log {org.apache.hadoop.hive.ql.exec.Task}
TID: [0] [BAM] [2015-09-03 12:58:12,130] ERROR {org.apache.hadoop.hive.ql.exec.ExecDriver} -  Execution failed with exit status: 2 {org.apache.hadoop.hive.ql.exec.ExecDriver}
TID: [0] [BAM] [2015-09-03 12:58:12,130] ERROR {org.apache.hadoop.hive.ql.Driver} -  FAILED: Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.MapRedTask {org.apache.hadoop.hive.ql.Driver}
TID: [0] [BAM] [2015-09-03 12:58:12,130] ERROR {org.wso2.carbon.analytics.hive.impl.HiveExecutorServiceImpl} -  Error executing query: Query returned non-zero code: 9, cause: FAILED: Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.MapRedTask {org.wso2.carbon.analytics.hive.impl.HiveExecutorServiceImpl}
java.sql.SQLException: Query returned non-zero code: 9, cause: FAILED: Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.MapRedTask
 at org.apache.hadoop.hive.jdbc.HiveStatement.executeQuery(HiveStatement.java:189)
 at org.wso2.carbon.analytics.hive.impl.HiveExecutorServiceImpl$ScriptCallable.executeHiveQuery(HiveExecutorServiceImpl.java:599)
 at org.wso2.carbon.analytics.hive.impl.HiveExecutorServiceImpl$ScriptCallable.call(HiveExecutorServiceImpl.java:304)
 at org.wso2.carbon.analytics.hive.impl.HiveExecutorServiceImpl$ScriptCallable.call(HiveExecutorServiceImpl.java:192)
 at java.util.concurrent.FutureTask.run(FutureTask.java:262)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
 at java.lang.Thread.run(Thread.java:745)
TID: [0] [BAM] [2015-09-03 12:58:12,130] ERROR {org.wso2.carbon.analytics.hive.impl.HiveExecutorServiceImpl} -  Error while executing Hive script.
Query returned non-zero code: 9, cause: FAILED: Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.MapRedTask {org.wso2.carbon.analytics.hive.impl.HiveExecutorServiceImpl}
java.sql.SQLException: Query returned non-zero code: 9, cause: FAILED: Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.MapRedTask
 at org.apache.hadoop.hive.jdbc.HiveStatement.executeQuery(HiveStatement.java:189)
 at org.wso2.carbon.analytics.hive.impl.HiveExecutorServiceImpl$ScriptCallable.executeHiveQuery(HiveExecutorServiceImpl.java:599)
 at org.wso2.carbon.analytics.hive.impl.HiveExecutorServiceImpl$ScriptCallable.call(HiveExecutorServiceImpl.java:304)
 at org.wso2.carbon.analytics.hive.impl.HiveExecutorServiceImpl$ScriptCallable.call(HiveExecutorServiceImpl.java:192)
 at java.util.concurrent.FutureTask.run(FutureTask.java:262)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
 at java.lang.Thread.run(Thread.java:745)
TID: [0] [BAM] [2015-09-03 12:58:12,130] ERROR {org.wso2.carbon.analytics.hive.task.HiveScriptExecutorTask} -  Error while executing script : am_stats_analyzer {org.wso2.carbon.analytics.hive.task.HiveScriptExecutorTask}


If you are facing the same error there is 2 main things you have to clarify in-order to get it working properly.

1. Check If you have correctly added the cygwin in the windows system Path variable. Check if there is any spaces and file path is correct.
2. If the 1st step is properly done and you still getting the above error then that means you haven't install cygwin properly.  When you install the cygwin make sure you have installed basic,  net (OpenSSH,tcp_wrapper packages)  and security related cygwin packages. 

using those 2 steps you can get rid of this unwanted error.
Hope this post saved your time 
Thanks,
~Vinu~

Monday, April 20, 2015

ERROR - MailTransportSender Error creating mail message or sending it to the configured server + wso2

Hi Friends,

If you are getting the below error, when trying to send a mail. This occurs due to a simple issue :)
I got this issue while configuring WSO2 ESB to send mails.

 ERROR - MailTransportSender Error creating mail message or sending it to the configured server  
 javax.mail.AuthenticationFailedException  
 at javax.mail.Service.connect(Service.java:306)  
 at javax.mail.Service.connect(Service.java:156)  
 at javax.mail.Service.connect(Service.java:105)  
 at javax.mail.Transport.send0(Transport.java:168)  
 at javax.mail.Transport.send(Transport.java:98)  
 at org.apache.axis2.transport.mail.MailTransportSender.sendMail(MailTransportSender.java:489)  
 at org.apache.axis2.transport.mail.MailTransportSender.sendMessage(MailTransportSender.java:175)  
 at org.apache.axis2.transport.base.AbstractTransportSender.invoke(AbstractTransportSender.java:112)  
 at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)  
 at org.apache.axis2.description.OutOnlyAxisOperationClient.executeImpl(OutOnlyAxisOperation.java:297)  
 at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)  
 at org.apache.synapse.core.axis2.Axis2FlexibleMEPClient.send(Axis2FlexibleMEPClient.java:482)  
 at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:59)  
 at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:338)  
 at org.apache.synapse.endpoints.AbstractEndpoint.send(AbstractEndpoint.java:333)  
 at org.apache.synapse.endpoints.AddressEndpoint.send(AddressEndpoint.java:59)  
 at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:97)  
 at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77)  
 at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47)  
 at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:131)  
 at org.apache.synapse.mediators.MediatorFaultHandler.onFault(MediatorFaultHandler.java:85)  
 at org.apache.synapse.FaultHandler.handleFault(FaultHandler.java:54)  
 at org.apache.synapse.endpoints.AbstractEndpoint.invokeNextFaultHandler(AbstractEndpoint.java:640)  
 at org.apache.synapse.endpoints.AbstractEndpoint.onFault(AbstractEndpoint.java:475)  
 at org.apache.synapse.endpoints.AddressEndpoint.onFault(AddressEndpoint.java:43)  
 at org.apache.synapse.FaultHandler.handleFault(FaultHandler.java:102)  
 at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:252)  
 at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:170)  
 at org.apache.synapse.transport.passthru.TargetErrorHandler$1.run(TargetErrorHandler.java:134)  
 at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)  
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)  
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)  
 at java.lang.Thread.run(Thread.java:745)  
 [2015-04-20 16:28:31,370] ERROR - MailTransportSender Error generating mail message  
 org.apache.axis2.AxisFault: Error creating mail message or sending it to the configured server  
 at org.apache.axis2.transport.base.AbstractTransportSender.handleException(AbstractTransportSender.java:226)  
 at org.apache.axis2.transport.mail.MailTransportSender.sendMail(MailTransportSender.java:500)  
 at org.apache.axis2.transport.mail.MailTransportSender.sendMessage(MailTransportSender.java:175)  
 at org.apache.axis2.transport.base.AbstractTransportSender.invoke(AbstractTransportSender.java:112)  
 at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)  
 at org.apache.axis2.description.OutOnlyAxisOperationClient.executeImpl(OutOnlyAxisOperation.java:297)  
 at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)  
 at org.apache.synapse.core.axis2.Axis2FlexibleMEPClient.send(Axis2FlexibleMEPClient.java:482)  
 at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:59)  
 at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:338)  
 at org.apache.synapse.endpoints.AbstractEndpoint.send(AbstractEndpoint.java:333)  
 at org.apache.synapse.endpoints.AddressEndpoint.send(AddressEndpoint.java:59)  
 at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:97)  
 at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77)  
 at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47)  
 at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:131)  
 at org.apache.synapse.mediators.MediatorFaultHandler.onFault(MediatorFaultHandler.java:85)  
 at org.apache.synapse.FaultHandler.handleFault(FaultHandler.java:54)  
 at org.apache.synapse.endpoints.AbstractEndpoint.invokeNextFaultHandler(AbstractEndpoint.java:640)  
 at org.apache.synapse.endpoints.AbstractEndpoint.onFault(AbstractEndpoint.java:475)  
 at org.apache.synapse.endpoints.AddressEndpoint.onFault(AddressEndpoint.java:43)  
 at org.apache.synapse.FaultHandler.handleFault(FaultHandler.java:102)  
 at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:252)  
 at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:170)  
 at org.apache.synapse.transport.passthru.TargetErrorHandler$1.run(TargetErrorHandler.java:134)  
 at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)  
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)  
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)  
 at java.lang.Thread.run(Thread.java:745)  
 Caused by: javax.mail.AuthenticationFailedException  
 at javax.mail.Service.connect(Service.java:306)  
 at javax.mail.Service.connect(Service.java:156)  
 at javax.mail.Service.connect(Service.java:105)  
 at javax.mail.Transport.send0(Transport.java:168)  
 at javax.mail.Transport.send(Transport.java:98)  
 at org.apache.axis2.transport.mail.MailTransportSender.sendMail(MailTransportSender.java:489)  
 ... 27 more  

First thing you should do is check if you have configure the MailTransportSender property correctly in the axis2.xml file
which is in $Carbon.Home/repository/conf/axis2/axis2.xml

   <transportSender name="mailto" class="org.apache.axis2.transport.mail.MailTransportSender">  
     <parameter name="mail.smtp.from">vinurip1@gmail.com</parameter>  
     <parameter name="mail.smtp.user">vinurip1</parameter>  
     <parameter name="mail.smtp.password">mypassword</parameter>  
     <parameter name="mail.smtp.host">smtp.gmail.com</parameter>c  
     <parameter name="mail.smtp.port">587</parameter>  
     <parameter name="mail.smtp.starttls.enable">true</parameter>  
     <parameter name="mail.smtp.auth">true</parameter>  
   </transportSender>  


If all you details are correct but still get the issue go to you mail account and check for the permission. In Gmail they send a mail saying "blocked a sign-in attempt" or similar.

If this is also not working feel free to put a comment and ask questions :)

Best Regards,
~Vinu~

Friday, April 17, 2015

How to Edit the Contents of a .Jar File Without Extracting on a Mac

Hi friends,

Well this post will show you how to edit the content of a jar file without extracting the jar file in 4 simple steps. Works most of the time and it will save time to extract jar and back aging creating so on.

You cannot edit the class files ONLY the config files like xmls

STEP 1

Go to the file location from the terminal and open it from the vi /vim editor

STEP 2

You will get a list of files in the jar after doing Step 1. Select the file you want to edit by using up and down keys and press ENTER

STEP 3

After completing the Step 2 you will be able to  open the file you chose. edit the content as you prefer and press "esc" escape key and ":wq!" to save and quit (Normal vi commands)

STEP 4 

You will be direct to the same screen in Step 2 after saving the content. press "esc" escape key and ":q!" to quit (Normal vi commands)


That is it. so you don't have to extract to edit the content and save the time :)
let me know if this works or you found much simpler way to do it

Thank you
Best Regards,
~Vinu~

Wednesday, February 4, 2015

How to access Carbon data-source from master-datasources.xml WSO2

This post is related to getting carbon datasource from master-datasource.xml file.

Accessing the carbon data-source is pretty much easy all you have to do is use Lookup to read the datasource


master-datasources.xml
 <datasource>  
             <name>test_db</name>  
             <description>The datasource used for </description>  
             <jndiConfig>  
                     <name>jdbc/test_db</name>  
             </jndiConfig>  
             <definition type="RDBMS">  
                     <configuration>  
                             <url>jdbc:mysql://localhost:3306/test_db?autoReconnect=true</url>  
                             <username>root</username>  
                             <password>root</password>  
                             <driverClassName>com.mysql.jdbc.Driver</driverClassName>  
                             <maxActive>50</maxActive>  
                             <maxWait>60000</maxWait>  
                             <testOnBorrow>true</testOnBorrow>  
                             <validationQuery>SELECT 1</validationQuery>  
                             <validationInterval>30000</validationInterval>  
                     </configuration>  
             </definition>  
 </datasource>  


When getting the master-datasource,we should do the lookup from carbon super tenant.
If currently in the carbon super tenant there are two ways to get the datasource 

but the Second way is much easier.

    Hashtable env = new Hashtable();  
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.rmi.registry.RegistryContextFactory");  
    env.put(Context.PROVIDER_URL, "rmi://localhost:2199");  
    InitialContext ctx = new InitialContext(env);  
    DataSource ds = (DataSource) ctx.lookup("jdbc/test_db");  

E.g. 2
 dataSource = (DataSource) InitialContext.doLookup("jdbc/test_db");  

If not in carbon super tenant, you should switch the tenant flow and get the datasource and switch it back.
(If you know any other easy way feel free to put a comment  :) )
  //super tenant credentials  
       int tenantId= MultitenantConstants.SUPER_TENANT_ID;  
       String tenantDomain=MultitenantConstants.SUPER_TENANT_DOMAIN_NAME;  
       //changing the tenant flow to the supper tenant  
       Connection conn=null;  
       try{  
         PrivilegedCarbonContext.startTenantFlow();  
         PrivilegedCarbonContext privilegedCarbonContext =    PrivilegedCarbonContext.getThreadLocalCarbonContext();  
         privilegedCarbonContext.setTenantId(tenantId);  
         privilegedCarbonContext.setTenantDomain(tenantDomain);  
         //getting the cloud-mgt datasource connection  
         DataSource ds = (DataSource) privilegedCarbonContext.getJNDIContext().lookup("jdbc/test_db");  
         conn = ds.getConnection();  
       } catch (NamingException e) {  
          log.error("Error while getting the DataSource" +e);  
          e.printStackTrace();  
       } catch (SQLException e) {  
          e.printStackTrace();  
       } finally {  
          //Ending the tenant flow  
          PrivilegedCarbonContext.endTenantFlow();  
          return conn;  
       }  

pretty simple hope this post help you,

Have fun friends.

Wednesday, January 7, 2015

Best Animes to watch


Hi,
I already have a post about best animes, but writing a review to all the animes will take lot of time so this is the simpler way to keep track of all the animes I watch. And if u are searching for anime to watch check the stars * . I have rated them in my own way.  NUMBERS HAVE NO MEANING i can't really rate which one is the best so check the number of stars :) 

1. One piece

Rating - ***** (5)
Favourite character - ACE ( love him ^_^ )
Notes- Adventure,powers
Luffy creates his own pirate crew and sail the seas to find the legendary one piece. Good friends and trust on each ability make the story more interesting. Few episodes will make you cry and some epis are so fun you will cry laughing. 

2. hunter x hunter 2011 

Rating - ***** (5)
Favourite character - Killua (gons best friend)
Notes- Adventure,powers



3. Naruto

Rating - ***** (5)
Favourite characters - naruto & hinata
Notes-  ninja, powers, adventure


4. fairy tail

Rating - ***** (5)
Favourite character - natsu
Notes- powers


5. Aikatsu

Rating - **** (4)
Favourite character - ran & ichigo
Notes- BEST FOR GIRLS (lovely) 

6. Death note

Rating - **** (4)
Favourite character - ryuk
Notes- SAD ENDING don't watch if u hate that. If I get hold of the death Note First thing I do is exchange 1/2 of my life for wings.




7. Fullmetal alchemist

Rating - **** (4)
Favourite character - Alphonse Elric  (like both brothers ^_^ )
Notes- quite interesting, didn't even want to stop watching till I finish the all episodes 




8. Diamond no Ace

Rating - ***** (5)
Favourite character -Haruichi (little brother)
Notes- I never knew baseball is this much interesting, loving the story 

9. Black Butler

Rating - *** (3)
Favourite character -  Ciel Phantomhive (love the name)
Notes-  even it was a sad ending, I thought he deserved it. butler is quite impressive.


10. Area no kishi

Rating - ****(4)
Favourite character -  kakeru
Notes - love the start of the anime but really cried alot in first few epis (Never expect the big bro die)



11. Sword Art Online

Rating - *****(5)
Favourite character -  Leafa
Notes - Wish I could really play a game like that, Love the anime. Wish to trap in the game :D


12. Fruit Basket

Rating - ****(4)
Favourite character -  Kyo
Notes - I loved this anime a lot. bit old but still a lot interesting (if you are into zodiac signs)


13. Avatar The Last Air Bender

Rating - *****(5)
Favourite characters - Aang & Zuko
Notes -  not sure if I can add this to anime list but who in the world will hate this cartoon. bending All 4 main elements water , fire, air and earth. Wish I could water bend and fly like a bird 





14.  Eyeshield 21

Rating - ****(4)
Favourite characters -   sena
Notes -  I loved the whole story and all, but the characters are not much attractive for the first time watchers. learned a lot about American football (never knew about that game before). really good anime. my advice it might take few episodes for you to get used to hiruma but its worth watching.


15.  Akatsuki no Yona

Rating - *****(5)
Favourite characters -   Son Hak
Notes - Dragons, Action, Adventure, Magical Powers
 This Anime reminds me of Avatar. Love it from the first episode. Annoying princess, caring bodyguard, Magic gain from the dragons and the best part of this story is red hair which princess hate the most help gain more power. After a long time interesting storyline.


16.  Akame ga Kill

Rating - ****(4)
Favourite characters - Wave , kinda like all the characters
Notes - Action,  Powers
what make me keep watching was this anime surprised me in the first few episodes. how could people be so cruel and going with the flow is wrong, we should make our own decisions even if its against the rules. I would have put 5 * rating to the anime if its before completing the whole series, but after completing even its not exactly a sad ending I feel bad about 'Esdeath' so its 4 * .





17. Attack on Titan

Rating - *****(5)
Favourite characters - Mikasa
Notes -  At first I was confuse and surprised to see main character get eating by titans, but great story line. Love it to the end. Hoping to watch the next season soon.



18.  Uta no☆prince-sama

Rating - ***(3)
Favourite characters -   Ichinose Tokiya
Notes -  Music, school
Haruka had one dream that one day her songs will be sing by her favorite idol. in-order to achieve her goal she join to the school of performing arts. Its quite nice when you watch it but story-line is quite boring just 6 guys like one girl. but still a good anime to watch. It contains 3 series. 
 

19. World Trigger

Rating - *****(5)
Favourite characters - Kuga yuma
Notes - Action,  Powers
Story begins when 4 years ago world is attacked from Monsters who called Neighbors and how the world is saved from the "border" agency. Real story begins with yuma who is a neighbor coming to this world. Its really funny when yuma started to do things on his own way. but story got interesting when yuma join the border with his 2 friends. 

20. Arslan senki

Rating - *****(5)
Favourite characters - Arslan
Notes - Action, Fantacy.
Story about the crown prince Arslan. Arslan's father the king, has never lost a battle but on Arslans maiden battle they were defeated so badly which the enemy has killed almost all the generals and capture the king. Arslan was able to escape but the home country was invaded by the neighboring nation of Lusitiania. Arslan character which led the story more intresting. How he struggle and way he treat his subjects. This story reminds me of the "Akatsuki no yona" but bit different from yona, Arslan  character can touch the peoples heart. 


21. Shokugeki no Souma

Rating - *****(5)
Favourite characters -  Souma Yukihira
Notes -School life, Cooking :) , talent


Its all about cooking and school life. A different kind of school life but quite interesting as long as you don't fail :). Best part of the anime is that yukihira and his dad cooking the top 10 worst dishes haha cannot stop laughing about those and wanted to try cooking my worst dish :D :D  Part I hate the MOST in this anime is that when ever some one eat they get naked ahhh every time :/ there are soo many ways to express that food is yummie but that entering to a food world part is the worst of all in the anime :/  Wish they change that, so that the anime is quite perfect and lovely. 




22. Kiseijuu: Sei no Kakuritsu

Rating - ****(4)
Favourite characters -  Migi (No idea why I like a monster the most maybe I wished I had some one like him with me )
Notes - horror
I dont know how in the world the author think of creating  this anime. monsters looks exactly like humans but eat humans for dinner. They are kinda superior to us so its a valid point they can eat humans. Because humans eat any kinda animals that are less superior to us. not sure if humans eat lions :/
 I hate the point that monster eats Shinichi's mom but then only the story started properly. also hate that migi goes to an deep sleep at the end even thou he is not. wish he stayed just like before. 
I normally hate horror anime's but this is kinda interesting due to migi.

23. One Punch Man

Rating - ****(4)
Favourite characters - mmm Genos
Notes - Action


I have no idea why people are so obsess with this anime. Saitama looks a bit like aged Aang (Aang is much better). I have only watched the first 7 episodes yet( All released epi till now). honestly this was just a guy who can beat anything not interesting at all

After Epi -8  Oki changed my mind this is  quite interesting. Like the fact that Saitama is quite down to earth person. even he was so strong. it dosen't quite matter to him that Genos is way above in ranking than him. 

24. Wolf Children

Rating - *****(5)(MUST WATCH)
Favourite characters -  Ame (I named my car Ame because of him).  Mom's great but love Ame lot more
Notes - Life, Movie (This is the first movie in my list)

No idea how to explain, Simply go and watch this. I cried lot watching, felt so bad about the mother. Yuki worst kinda daughter she could get but she is also quite lovely. Ame is weak but cares lot about his mother. 
 I'm so angry about Yuki, just because she ignores her wolf nature and I'm sad Ame decided only to be a wolf. I just wish Ame comes back at least once in a while to see his mother.
I wish they create a second movie of this.

25. Assassination Classroom

Rating - *****(5)

Favourite characters -  Nagisa
Notes - Action, School life
 
Best thing about this anime is if you want to graduate from school all you have to do is kill the class teacher. Wish I'm in class 3-E :D :D . Teacher Koro-sense is not a normal person. he destroyed half of the moon and planning to destroy the earth. But due to a promise to an unknown person he decided to teach the worst class room 3-E (I don't think 3 stands for grade 3 kids its more like Junior high school 3rd year). its quite interesting to watch how students try killing class room teacher :D :D