WSO2 DSS - Cassandra / DynamoDb - 检索项目

WSO2 DSS - Cassandra / DynamoDb - Retrieving Item

我们正在实施一个使用 WSO2 DSS 的解决方案。 我们不想摆脱它,因为我们组织中的许多参与者都在使用它公开的接口。 在下面,我们计划迁移到 Cassandra 或 DynamoDB,它们都部署在 AWS 上。 我们正面临一个阻塞问题,因为我们能够连接。 我们被迫使用 Amazon SDK,我们必须在其中使用比 v.2 更新的 joda-time 库版本 当我们尝试检索一个项目时,我们遇到了下一个异常。

java.lang.NoSuchMethodError: org.joda.time.format.DateTimeFormatter.withZoneUTC()Lorg/joda/time/format/DateTimeFormatter

所以我们猜测这是因为 WSO2 使用了这个库的不同版本。


WSO2 v.3.2.1
乔达时间 v.2.8.1

谢谢。

我有同样的问题,但我做了一些测试,我认为这并不是真正的 joda-time 库问题。

我已经编译了一个包含所有依赖项的组装 jar,并且至少运行了一次。

关于pom.xml文件配置:

<build>
    <plugins>
       ...
        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.6</version>
            <configuration>
                <descriptorRefs>
                    <descriptorRef>jar-with-dependencies</descriptorRef>
                </descriptorRefs>
            </configuration>
        </plugin>
    </plugins>
</build>

并使用以下命令编译 jar:

mvn assembly:assembly

我在 $WSO_INSTALATION_DIR/repository/components/lib 上复制了 jar 并启动了 wso2 服务器,它工作了!

但现在我在更改数据源代码并重新部署时遇到问题。

如果我再次复制 lib 上的 .jar,则没有我对数据源代码的最后更改,如果我从 lib/ 中删除 jar dropin/ 文件夹我收到以下错误:

java.lang.ClassCastException: org.wso2.dss.connectors.dynamodb.DynamoDBDataSource cannot be cast to org.wso2.carbon.dataservices.core.custom.datasource.CustomQueryBasedDS

    at org.wso2.carbon.dataservices.core.description.config.InlineCustomQueryBasedDSConfig.<init>(InlineCustomQueryBasedDSConfig.java:66)
    at org.wso2.carbon.dataservices.core.description.config.ConfigFactory.getCustomQueryConfig(ConfigFactory.java:143)
    at org.wso2.carbon.dataservices.core.description.config.ConfigFactory.createConfig(ConfigFactory.java:73)
    at org.wso2.carbon.dataservices.core.DataServiceFactory.createDataService(DataServiceFactory.java:137)
    at org.wso2.carbon.dataservices.core.DBDeployer.createDBService(DBDeployer.java:764)
    at org.wso2.carbon.dataservices.core.DBDeployer.processService(DBDeployer.java:1127)
    at org.wso2.carbon.dataservices.core.DBDeployer.deploy(DBDeployer.java:178)
    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.loadServices(CarbonAxisConfigurator.java:464)
    at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:95)
    at org.wso2.carbon.core.CarbonConfigurationContextFactory.createNewConfigurationContext(CarbonConfigurationContextFactory.java:65)
    at org.wso2.carbon.core.init.CarbonServerManager.initializeCarbon(CarbonServerManager.java:398)
    at org.wso2.carbon.core.init.CarbonServerManager.start(CarbonServerManager.java:219)
    at org.wso2.carbon.core.internal.CarbonCoreServiceComponent.activate(CarbonCoreServiceComponent.java:77)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260)
    at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
    at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:347)
    at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
    at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
    at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343)
    at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222)
    at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107)
    at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
    at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
    at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819)
    at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771)
    at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
    at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)
    at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)
    at org.eclipse.equinox.http.servlet.internal.Activator.registerHttpService(Activator.java:81)
    at org.eclipse.equinox.http.servlet.internal.Activator.addProxyServlet(Activator.java:60)
    at org.eclipse.equinox.http.servlet.internal.ProxyServlet.init(ProxyServlet.java:40)
    at org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.init(DelegationServlet.java:38)
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1267)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1186)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1081)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5027)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5314)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassCastException: org.wso2.dss.connectors.dynamodb.DynamoDBDataSource cannot be cast to org.wso2.carbon.dataservices.core.custom.datasource.CustomQueryBasedDS
    at org.wso2.carbon.dataservices.core.description.config.InlineCustomQueryBasedDSConfig.<init>(InlineCustomQueryBasedDSConfig.java:48)
    ... 54 more

我希望这个技巧能帮助你解决这个问题,我会继续尝试找到一个完整的解决方案。

已编辑:我发现如果将两个 jar 复制到 lib 目录、组装的 jar 和无依赖项的 jar,它会工作正常。