java.lang.ClassCastException: com.marklogic.xcc.jndi.ContentSourceBeanFactory cannot be cast to javax.naming.spi.InitialContextFactory]

Im having an error while creating JNDI datasource in WSO2 Data Services Server, I'm using the MarkLogic XCC/J connector as may JNDI Context Class but i got an error..

DS Fault Message: Naming error occurred while trying to retrieve JDBC Connection from JNDI tree. DS Code: UNKNOWN_ERROR Source Data Service:- Name: marklogicserver Location: /marklogicserver.dbs Description: N/A Default Namespace: Nested Exception:- javax.naming.NoInitialContextException: Failed to create InitialContext using factory specified in hash table. [Root exception is java.lang.ClassCastException: com.marklogic.xcc.jndi.ContentSourceBeanFactory cannot be cast to javax.naming.spi.InitialContextFactory] at org.wso2.carbon.dataservices.core.description.config.JNDIConfig.createDataSource(JNDIConfig.java:95) at org.wso2.carbon.dataservices.core.description.config.JNDIConfig.(JNDIConfig.java:49) at org.wso2.carbon.dataservices.core.description.config.ConfigFactory.getJNDIConfig(ConfigFactory.java:98) at org.wso2.carbon.dataservices.core.description.config.ConfigFactory.createConfig(ConfigFactory.java:62) at org.wso2.carbon.dataservices.core.DataServiceFactory.createDataService(DataServiceFactory.java:150) at org.wso2.carbon.dataservices.core.DBDeployer.createDBService(DBDeployer.java:785) at org.wso2.carbon.dataservices.core.DBDeployer.processService(DBDeployer.java:1139) at org.wso2.carbon.dataservices.core.DBDeployer.deploy(DBDeployer.java:195) at org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy(DeploymentFileData.java:136) at org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:807) at org.apache.axis2.deployment.repository.util.WSInfoList.update(WSInfoList.java:144) at org.apache.axis2.deployment.RepositoryListener.update(RepositoryListener.java:377) at org.apache.axis2.deployment.RepositoryListener.checkServices(RepositoryListener.java:254) at org.apache.axis2.deployment.DeploymentEngine.loadServices(DeploymentEngine.java:135) at org.wso2.carbon.core.CarbonAxisConfigurator.deployServices(CarbonAxisConfigurator.java:567) 

Here is my configuration file

<data name="marklogicserver" transports="http https local"> <config enableOData="false"> <property name="jndi_context_class">com.marklogic.xcc.jndi.ContentSourceBeanFactory</property> <property name="jndi_provider_url"></property> <property name="jndi_resource_name">marklogic/ContentSource</property> </config> <query useConfig="mlsource"> <sql>let $x := cts:search(fn:collection(""),cts:and-query(("","")))&#xd;&#xd;return $x</sql> <result element="Documents" rowName="Document"> <element column="Data" name="Data" xsdType="string"/> </result> </query> <operation name="getQueryOperation"> <call-query href="getQuery"/> </operation> <resource method="GET" path="getQuery"> <call-query href="getQuery"/> </resource> </data> 

What wrong with my configuration? Please help

2

1 Answer

Looks like WSO2 wants something that implements javax.naming.spi.InitialContextFactory, but the ContentSourceFactoryBean only implements javax.naming.spi.ObjectFactory.

I have not tried this, but I imagine you can write an implementation of InitialContextFactory that produces a Context that will ensure that ContentSourceFactoryBean is used as the ObjectFactory implementation.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like