WSO2 - MSSQL causes error for commits - api

When configuring WSO2 API Manager version 1.5.0 to use SQL Server as my database the instructions at:
http://docs.wso2.org/display/AM150/Setting+up+with+MS+SQL
For step 1 for Setup Configuration File, they tell you to update the master-datasources.xml file to match their example.
After updating and starting the API Manager, I got the following error in the logs:
ERROR {org.wso2.carbon.apimgt.impl.dao.ApiMgtDAO} - Failed to rollback getting user ratings {org.wso2.carbon.apimgt.impl.dao.ApiMgtDAO}
java.sql.SQLException: commit() should not be called while in auto-commit mode.

We tried a couple of things. First we disabled auto-commit on our SQL Server (2008r2).
That did not help and the error continued. After researching jdbc connections at: http://people.apache.org/~fhanik/jdbc-pool/jdbc-pool.html
I discovered that a setting for:
<defaultAutoCommit>false</defaultAutoCommit>
was needed for each database definition in master-datasources.xml
For example:
<datasource>
<name>WSO2_CARBON_DB</name>
<description>The datasource used for registry and user manager</description>
<jndiConfig>
<name>jdbc/WSO2CarbonDB</name>
</jndiConfig>
<definition type="RDBMS">
<configuration>
<defaultAutoCommit>false</defaultAutoCommit>
<url>jdbc:jtds:sqlserver://server:port/db_name</url>
<username>user</username>
<password>pwd</password>
<driverClassName>net.sourceforge.jtds.jdbc.Driver</driverClassName>
<maxActive>50</maxActive>
<maxWait>60000</maxWait>
<testOnBorrow>true</testOnBorrow>
<validationQuery>SELECT 1</validationQuery>
<validationInterval>30000</validationInterval>
</configuration>
</definition>
</datasource>
The documentation from WSO2 does not reference this setting that I have found. It 'might' set it correctly when using the ../carbon admin site for your product.

Related

JNDI lookup error for name: java:comp/env/jdbc/DynaPropDB

Am getting below error while starting the liberty server:
[ERROR ]
com.it.properties.PropertyResourceException for user [UnKnown] self logged on Jan 23, 2019 12:43:12 PM.
Exception instance reference code [13EE91EC-BCA0-49C1-7ABC-5F537ABC5F53].
I have DynaPropAdminWeb Access for the application
Correctly placed lookup-name and binding-name in web.xml file and ibm-web-bnd.xml file
It would be helpful if you provide the relevant web.xml, ibm-web-bnd.xml, and server.xml config snippets for the resource reference and data source. Absent that, taking your word that the deployment descriptor and binding file are correct, then the problem will be in the server config, either in incorrectly specifying the dataSource/jdbcDriver/library or with feature enablement. A common mistake in Liberty is forgetting to enable the jndi-1.0 feature (which is needed for JNDI lookups) alongside the jdbc-4.x feature. In case that is the problem, here is an example,
<server>
<featureManager>
<feature>jdbc-4.2</feature>
<feature>jndi-1.0</feature>
<feature>servlet-4.0</feature>
</featureManager>
<dataSource jndiName="jdbc/DynaPropDB">
<jdbcDriver libraryRef="jdbcLib"/>
<properties serverName="localhost" portNumber="1234" databaseName="exampleDB"/>
</dataSource>
<library id="jdbcLib">
<file name="C:/drivers/jdbc/myJdbcDriver.jar"/>
</library>
</server>
Also, here is a link to a knowledge center page with configuration examples for various commonly-used databases.

Invalid data source error (oracle) in Pentaho 8.0

I'm trying to make a multi-tenancy application. I've followed this tutorial, and also this one. So, what I have in context.xml is:
<Resource
name="jdbc/DB-xxx"
auth="Container"
type="javax.sql.DataSource"
factory="org.apache.commons.dbcp.BasicDataSourceFactory"
maxActive="20"
maxIdle="5"
maxWaitMillis="10000"
username="xxx"
password="pass"
driverClassName="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:#//xxxurl:1521:ORCL"
/>
<Resource
name="jdbc/DB-aaa"
auth="Container"
type="javax.sql.DataSource"
factory="org.apache.commons.dbcp.BasicDataSourceFactory"
maxActive="20"
maxIdle="5"
maxWaitMillis="10000"
username="aaa"
password="pass"
driverClassName="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:#//aaaurl:1521:ORCL"
/>
I also have the JNDI pointing to those above in defaut.properties and jdbc.properties.
When I try to connect to the JNDI using the Pentaho Report Design, I receive these erros:
Error connecting to database [DB] :org.pentaho.di.core.exception.KettleDatabaseException:
Error occurred while trying to connect to the database
javax.naming.NamingException: Invalid data source:'DB'
Invalid data source:'DB'
org.pentaho.di.core.exception.KettleDatabaseException:
Error occurred while trying to connect to the database
javax.naming.NamingException: Invalid data source:'DB'
Invalid data source:'DB'
I have the ojdbc6 in all libs, so I think that this is not the problem. Does someone have any idea?
Thanks!
Ok, I've found the solution. I was changing the code in the wrong directory. The right one is C:\Users\user\.pentaho\simple-jndi. I've put, in the default file, the database infos and it worked. Now I'm able to connect to the database.

No process engine found. camunda Webapp cannot work without a process engine

When I set up a camunda BPMN platform, I got the following error
HTTP Status 500 -
org.camunda.bpm.webapp.impl.IllegalWebAppConfigurationException: No
process engine found. camunda Webapp cannot work without a process
engine
Confirming that the both the '/camunda' and '/engine-rest' is deployed and running in Tomcat.
But /engine-rest returns 404 with following error.
description : The requested resource is not available.
Please help!.
You need to configure the shared process engine for your server as described in https://docs.camunda.org/manual/7.5/installation/full/tomcat/manual/#add-bpm-platform-xml
Have added bpm-platform.xml to '/conf'
<?xml version="1.0" encoding="UTF-8"?>
<bpm-platform xmlns="http://www.camunda.org/schema/1.0/BpmPlatform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.camunda.org/schema/1.0/BpmPlatform http://www.camunda.org/schema/1.0/BpmPlatform ">
<job-executor>
<job-acquisition name="default" />
</job-executor>
<process-engine name="default">
<job-acquisition>default</job-acquisition>
<configuration>org.camunda.bpm.engine.impl.cfg.StandaloneProcessEngineConfiguration</configuration>
<datasource>java:jdbc/ProcessEngine</datasource>
<properties>
<property name="history">full</property>
<property name="databaseSchemaUpdate">true</property>
<property name="authorizationEnabled">true</property>
<property name="jobExecutorDeploymentAware">true</property>
</properties>
</process-engine>
</bpm-platform>

Configuration of XA dataSources on Jboss eap 6.4 with sql server

I have configured the XA-datasources on sql server by the following ways:
https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Application_Platform/6/html/Administration_and_Configuration_Guide/Example_Microsoft_SQLServer_XA_Datasource.html
enter code here
<datasources>
<xa-datasource jndi-name="java:/jdbc/MyDataSource" pool-name="SQLServerPool">
<driver>sqlserver</driver>
<xa-datasource-property name="ServerName">localhost</xa-datasource-property>
<xa-datasource-property name="DatabaseName">mydb</xa-datasource-property>
<xa-datasource-property name="SelectMethod">cursor</xa-datasource-property>
<security>
<user-name>admin</user-name>
<password>admin</password>
</security>
<xa-pool>
<is-same-rm-override>false</is-same-rm-override>
</xa-pool>
<validation>
<valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mssql.MSSQLValidConnectionChecker"></valid-connection-checker>
</validation>
</xa-datasource>
<drivers>
<driver name="sqlserver" module="com.microsoft">
<xa-datasource-class>com.microsoft.sqlserver.jdbc.SQLServerXADataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
And enabled XA transaction database side by following
https://technet.microsoft.com/en-us/library/aa342335%28v=sql.105%29.aspx
But the Database I have been using for my project is not a master database .Since XA-transactions are enabled on master, by default data is taking from master db and not from my database.
Is it that I need to configure XA-transactions on "my database" for the problem to be resolved?
How to give the server name under inorder to fetch from "my database "
My loginUserName is the owner of both master schema and "mydatabase" schema and have created Role SqlJDBCXA user both in master and "mydatabase".
Referred the following but couldnot help
Exception with MS-SQL Server,JDBC and XA Transactions
I'm using sqljdbc4.jar and driver class is "com.microsoft.sqlserver.jdbc.SQLServerDriver"
The JDBC jar is being detected in the jboss Management console and when i test it ,i'm getting the following error:
"failed to create JDBC connection.There are no running servers bound to this datasource"
Can anyone Suggest?
ThankYou

Infinispan Cluster

I need to form a infinispan cluster in distributed mode. This cache is used for storing session data. Currently I am using tomcatInfinispanSessionManager developed by Manik from Jboss team.
I have created the infinispan xml in distributed mode and using two tomcats for testing. Using apache as a load balancer. Each machine has its own copy of infinispan cache entry. When any of the tomcat is shut down the session is retrieved from other infinispan cache.
My question is: how to make this cache entry into an infinispan server (either using hotrod/memcached) that is running on a separate machine?
If you add a remote cache loader to the cache configuration you have, it'll back up the data in a remote Hot Rod server, assuming you configure the IP:Port address of the Hot Rod server(s) correctly.
However, if you're trying to cluster your session data, I'd highly recommend you download JBoss EAP 6.1, which comes with Infinispan-based cluster-ready session data storage out of the box. The session cache can still be configured with a remote cache loader too, but the configuration will be slightly different since it uses JBoss EAP configuration format.
I am using ispn 5.1 version and started the server in hotrod mode. My cache config xml is as follows.
<?xml version="1.0" encoding="UTF-8"?>
<infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:infinispan:config:5.3 http://www.infinispan.org/schemas/infinispan-config-5.3.xsd
urn:infinispan:config:remote:5.3 http://www.infinispan.org/schemas/infinispan-cachestore-remote-config-5.3.xsd"
xmlns="urn:infinispan:config:5.3" xmlns:remote="urn:infinispan:config:remote:5.3">
<global>
<transport clusterName="tomcatSession">
<properties>
<property name="configurationFile"
value="E:/Software/apache-tomcat-7.0.34/conf/jgroups.xml">
</property>
</properties>
</transport>
<globalJmxStatistics enabled="true" />
</global>
<namedCache name="tc_session_ispn-sess-mgr">
<clustering mode="distribution">
<l1 enabled="true" lifespan="600000" />
</clustering>
<loaders>
<remoteStore xmlns="urn:infinispan:config:remote:5.3"
fetchPersistentState="false" ignoreModifications="false"
purgeOnStartup="false" remoteCache="myCache" rawValues="true">
<servers>
<server host="10.145.4.172" port="11222" />
</servers>
<connectionPool maxActive="10" exhaustedAction="CREATE_NEW" />
<async enabled="true" />
</remoteStore>
</loaders>
</namedCache>
</infinispan>
While using this cache config xml I am gettong the following exception
Exception in thread "main" org.infinispan.config.ConfigurationException: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[39,104]
Message: Unexpected element '{urn:infinispan:config:remote:5.3}remoteStore' encountered
at org.infinispan.configuration.parsing.Parser.parse(Parser.java:168)
at org.infinispan.configuration.parsing.Parser.parse(Parser.java:130)
at org.infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:368)
at org.infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:340)
at org.infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:327)
Kindly correct me if I am wrong and suggest how to proceed further?