Я пытаюсь разработать простой Java программу, которая вызывает веб-служб DFS, и я получаю эту ошибку во время выполнения:ClassNotFoundException: ObjectServiceDescriptor в OSGi
Caused by: com.emc.documentum.fs.rt.impl.servicemodel.ServiceModelException: Service descriptor class not found: "java.lang.ClassNotFoundException: com.emc.documentum.fs.services.core.client.ObjectServiceDescriptor".
at com.emc.documentum.fs.rt.impl.servicemodel.JavaBeanTreeFactory.getDescriptor(JavaBeanTreeFactory.java:218)
at com.emc.documentum.fs.rt.impl.servicemodel.JavaBeanTreeFactory.getModule(JavaBeanTreeFactory.java:41)
at com.emc.documentum.fs.rt.context.ServiceFactory.makeServiceUrl(ServiceFactory.java:332)
at com.emc.documentum.fs.rt.context.ServiceFactory.getRemoteService(ServiceFactory.java:143)
at com.emc.documentum.fs.rt.context.ServiceFactory.getRemoteService(ServiceFactory.java:197)
at info.hartmann.dfs.impl.Handler.init(Handler.java:112)
Я использую Maven построить проект и установить он находится в контейнере OSGi Adobe CQ5. Я пробовал этот же код в обычном приложении Java в Eclipse, и он сработал.
Странная вещь для меня заключается в том, что этот класс ObjectServiceDescriptor находится в одной из библиотек .jar, которые я включаю через зависимости maven. Имя баннера: emc-dfs-services-remote-1.0.jar. Если я открою свой .jar, сгенерированный maven, я вижу там emc-dfs-services-remote-1.0.jar.
Проект компиляция проходит без каких-либо проблем, но во время выполнения я получаю ошибку на этой линии:
IObjectService objectService = serviceFactory.getRemoteService(com.emc.documentum.fs.services.core.client.IObjectService.class, serviceContext, module, host);
Мой pom.xml ниже. Как вы видите, я объявляю некоторые из пакетов как необязательные в Imported-Packages. Если я этого не сделаю, мой пакет может быть скомпилирован, но не может быть запущен. Не могли ли объявить эти пакеты как необязательные?
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>CXF-example-ievgen</groupId>
<artifactId>CXF-example-ievgen</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>Ievgeng sample bundle</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.sling</groupId>
<artifactId>maven-sling-plugin</artifactId>
<executions>
<execution>
<id>install-bundle</id>
<goals>
<goal>install</goal>
</goals>
</execution>
</executions>
<configuration>
<slingUrl>http://192.168.56.101:4502/system/console</slingUrl>
<user>user</user>
<password>password</password>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-scr-plugin</artifactId>
<version>1.7.2</version>
<executions>
<execution>
<id>generate-scr-scrdescriptor</id>
<goals>
<goal>scr</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.1.0</version>
<extensions>true</extensions>
<executions>
<execution>
<id>wrap-my-dependency</id>
<goals>
<goal>wrap</goal>
</goals>
<configuration>
<wrapImportPackage>;</wrapImportPackage>
</configuration>
</execution>
</executions>
<configuration>
<instructions>
<Export-Package>info.hartmann.dfs.api</Export-Package>
<Private-Package>info.hartmann.dfs.impl
</Private-Package>
<!-- bundle supplied resource prefixes -->
<Include-Resource>{maven-resources}</Include-Resource>
<!-- Do not inline jars, include as jar files -->
<Embed-Dependency>*;scope=compile|runtime;inline=false</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
<!-- use _exportcontents instead of Export-Package to avoid conflict with Embed-Dependency an inline=true -->
<!-- <_exportcontents> -->
<!-- org.apache.cxf.*;version=${project.version} -->
<!-- </_exportcontents> -->
<!-- declare optional dependencies -->
<Import-Package>
com.documentum.fc.client.search;resolution:=optional,
com.documentum.fc.client.impl.session;resolution:=optional,
com.documentum.fc.common;resolution:=optional,
com.documentum.fc.client;resolution:=optional,
com.documentum.com;resolution:=optional,
com.documentum.ci;resolution:=optional,
com.documentum.ucf.*;resolution:=optional,
com.documentum.operations.*;resolution:=optional,
com.documentum.registry;resolution:=optional,
com.documentum.xerces_2_8_0.xerces.impl.dv.util;resolution:=optional,
org.slf4j.*;resolution:=optional,
org.osgi.*;resolution:=optional,
com.emc.documentum.kerberos.*;resolution:=optional,
javax.xml.registry.*;resolution:=optional,
jp.co.swiftinc.relax.*;resolution:=optional,
junit.framework;resolution:=optional,
org.apache.xerces.*;resolution:=optional,
org.apache.xml.*;resolution:=optional,
sun.io;resolution:=optional,
sun.misc;resolution:=optional,
sun.nio.cs;resolution:=optional,
sun.security.action;resolution:=optional,
com.sun.tools.javadoc;resolution:=optional,
org.apache.regexp;resolution:=optional,
org.apache.tools.*;resolution:=optional,
org.apache.xerces.*;resolution:=optional,
org.apache.xml.*;resolution:=optional,
org.aspectj.bea.jvm;resolution:=optional,
org.eclipse.jface.text;resolution:=optional,
org.eclipse.osgi.framework.*;resolution:=optional,
org.eclipse.osgi.internal.profile;resolution:=optional,
org.eclipse.osgi.service.*;resolution:=optional,
org.eclipse.osgi.util;resolution:=optional,
org.eclipse.update.configurator;resolution:=optional,
*
</Import-Package>
</instructions>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.apache.felix
</groupId>
<artifactId>
maven-scr-plugin
</artifactId>
<versionRange>
[1.7.2,)
</versionRange>
<goals>
<goal>scr</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore/>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<dependency>
<groupId>activation</groupId>
<artifactId>activation</artifactId>
<!-- actually it is version 1.1 but i didnt get how to resolve error -->
<version>1.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.5.2a</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.emc</groupId>
<artifactId>emc-collaboration</artifactId>
<version>1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>1.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.4</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.emc</groupId>
<artifactId>emc-admin-services-remote</artifactId>
<version>1.0</version>
<scope>compile</scope>
<!--<systemPath>${project.basedir}/src/main/resources/emc-admin-services-remote.jar</systemPath>-->
</dependency>
<dependency>
<groupId>com.emc</groupId>
<artifactId>emc-bpm-services-remote</artifactId>
<version>1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.emc</groupId>
<artifactId>emc-ci-services-remote</artifactId>
<version>1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.emc</groupId>
<artifactId>emc-dfs-rt-remote</artifactId>
<version>1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.emc</groupId>
<artifactId>emc-dfs-services-remote</artifactId>
<version>1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.emc</groupId>
<artifactId>emc-search-services-remote</artifactId>
<version>1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.sun.xml.fastinfoset</groupId>
<artifactId>FastInfoset</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>com.emc</groupId>
<artifactId>http</artifactId>
<version>1.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb1-impl</artifactId>
<version>2.1.4</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>javax.xml</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.1.11</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>javax.xml</groupId>
<artifactId>jaxws-api</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.1.7</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jsr173_api</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>javax.jws</groupId>
<artifactId>jsr181-api</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>jsr250-api</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.jvnet</groupId>
<artifactId>mimepull</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>com.sun.org.apache.xml.internal</groupId>
<artifactId>resolver</artifactId>
<version>20050927</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>javax.xml</groupId>
<artifactId>saaj-api</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>com.sun.xml.messaging.saaj</groupId>
<artifactId>saaj-impl</artifactId>
<version>1.3.3</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>com.sun.xml.stream</groupId>
<artifactId>sjsxp</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.jvnet.staxex</groupId>
<artifactId>stax-ex</artifactId>
<version>1.0</version>
<scope>runtime</scope>
<!--<systemPath>${project.basedir}/src/main/resources/stax-ex.jar</systemPath>-->
</dependency>
<dependency>
<groupId>com.sun.xml.stream.buffer</groupId>
<artifactId>streambuffer</artifactId>
<version>0.8</version>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.5.0</version>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr.annotations</artifactId>
<version>1.6.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<version>4.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.commons.osgi</artifactId>
<version>2.0.2-incubator</version>
<type>bundle</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.osgi.compendium</artifactId>
<version>1.4.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.commons.log</artifactId>
<version>2.0.6</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
Bundle после установки пути к классам в OSGi консоли:
Bundle Classpath ., sjsxp-1.0.jar, emc-collaboration-1.0.jar, FastInfoset-1.2.jar,
aspectjrt-1.5.2a.jar,stax-api-1.0.jar,jsr250-api-1.0.jar,activation-1.0.jar,
resolver-20050927.jar,streambuffer-0.8.jar,jsr181-api-1.0.jar,
jsr173_api-1.0.jar,jaxb1-impl-2.1.4.jar, emc-dfs-rt-remote-1.0.jar,
commons-lang-2.4.jar,commons-io-1.2.jar,stax-ex-1.0.jar,saaj-impl-1.3.3.jar,
jaxws-rt-2.1.7.jar,xercesImpl-2.5.0.jar,jaxb-api-2.0.jar,mimepull-1.4.jar,
emc-bpm-services-remote-1.0.jar,emc-search-services-remote-1.0.jar,activation-1.1.jar,http-1.0.jar,
jaxb-impl-2.1.11.jar,jaxws-api-2.1.jar,emc-ci-services-remote-1.0.jar,
emc-admin-services-remote-1.0.jar, emc-dfs-services-remote-1.0.jar,servlet-api-1.0.jar,saaj-api-1.3.jar
Мой Java-код:
public void init() throws Exception {
ContextFactory contextFactory = ContextFactory.getInstance();
serviceContext = contextFactory.newContext();
RepositoryIdentity repositoryIdentity = new RepositoryIdentity();
repositoryIdentity.setRepositoryName(repository);
repositoryIdentity.setUserName(user);
repositoryIdentity.setPassword(pass);
serviceContext.addIdentity(repositoryIdentity);
ServiceFactory serviceFactory = ServiceFactory.getInstance();
//ERROR is thrown here:
objectService = serviceFactory.getRemoteService(IObjectService.class, serviceContext, module, host);
queryService = serviceFactory.getRemoteService(IQueryService.class, serviceContext, module, host);
}
Я видел подобную проблему здесь: https://community.emc.com/thread/82798 но решение при условии Ждут» Я помогу мне. Я попытался
- Изменение JRE версии для более чем 1,5
- Убедившись убедитесь, что я создаю класс типа com.emc.documentum.fs.services.core.client.IObjectService (а не ком. emc.documentum.fs.services.core.impl.IObjectService).
- Попытка с более полной параметризацией версии getRemoteService, которая удалит любые амбиции с вызовом.
- И многое другое, например, установка всех внешних банок в отдельном комплекте, а затем их импорт.
Похоже, проблема с Maven зависимостей, но я не могу понять, как я включил все .jars в моем проекте, который я использовал в моем проекте затмений, поэтому он должен работать так же, не должен» это?
Я ценю любую помощь.
EDIT: Я попытался изменить экспорт-пакетов:. info.hartmann.dfs.api, com.emc.documentum * Другими словами, я пытался экспортировать все пакеты Documentum. Выше перечисленные ошибки исчезли, но я получил новый:
Caused by: com.emc.documentum.fs.rt.impl.servicemodel.ServiceModelException: Service descriptor file not found: "services-core-service-model.xml".
at com.emc.documentum.fs.rt.impl.servicemodel.JavaBeanTreeFactory.getModuleByName(JavaBeanTreeFactory.java:65)
at com.emc.documentum.fs.rt.impl.servicemodel.JavaBeanTreeFactory.getModule(JavaBeanTreeFactory.java:42)
at com.emc.documentum.fs.rt.context.ServiceFactory.makeServiceUrl(ServiceFactory.java:332)
at com.emc.documentum.fs.rt.context.ServiceFactory.getRemoteService(ServiceFactory.java:143)
at com.emc.documentum.fs.rt.context.ServiceFactory.getRemoteService(ServiceFactory.java:197)
at info.hartmann.dfs.impl.Handler.init(Handler.java:112)
Unfortunatelly, я даже не знаю, если это трогает меня один шаг вперед или один шаг позади.
Вы получаете ту же ошибку на следующей строке, используя IQueryService? –
Кроме того, странно, что он ищет '... client.ObjectServiceDescriptor', когда вы используете удаленные .jars? Вы пробовали включить оба? –
@unicron, на следующей строке, используя IQueeryService Я получаю сообщение об ошибке java.lang.ClassNotFoundException: com.emc.documentum.fs.services.core.client.QueryServiceDescriptor " – Ievgen