原因:java.lang.ClassNotFoundException:org.apache.chemistry.opencmis.server.shared.AbstractCmisHttpServlet
我正在做一个使用opencmis的现成cmis项目。我成功地构建了maven,但当我尝试在本地运行这个springboot应用程序时,我得到了上面的类AbstractCmisHttpServlet not found error,但我可以在IDE/m2存储库中看到该文件。在Application java主文件中,当我尝试初始化此对象new CustomCmisBrowserBindingServlet()时,方法dispatcherServletRegistration()中出现错误。该类扩展了AbstractCmisHttpServlet。这里说找不到类 这是我的opencmis的POM详细信息`原因:java.lang.ClassNotFoundException:org.apache.chemistry.opencmis.server.shared.AbstractCmisHttpServlet,java,apache,spring-boot,opencmis,Java,Apache,Spring Boot,Opencmis,我正在做一个使用opencmis的现成cmis项目。我成功地构建了maven,但当我尝试在本地运行这个springboot应用程序时,我得到了上面的类AbstractCmisHttpServlet not found error,但我可以在IDE/m2存储库中看到该文件。在Application java主文件中,当我尝试初始化此对象new CustomCmisBrowserBindingServlet()时,方法dispatcherServletRegistration()中出现错误。该类扩展
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<overlays>
<overlay />
<overlay>
<groupId>org.apache.chemistry.opencmis</groupId>
<artifactId>chemistry-opencmis-server-bindings-war</artifactId>
<excludes>
<!-- exclude everything you don't need -->
<exclude>index.html</exclude> <!-- default index page -->
<exclude>css/**</exclude> <!-- CSS for the default index page -->
<exclude>images/**</exclude>
<exclude>web/**</exclude> <!-- sample JavaScript application -->
<exclude>WEB-INF/classes/sample-repository.properties</exclude>
</excludes>
</overlay>
</overlays>
</configuration>
</plugin>
<dependency>
<groupId>org.apache.chemistry.opencmis</groupId>
<artifactId>chemistry-opencmis-server-bindings-war</artifactId>
<version>${opencmis.version}</version>
<type>war</type>
</dependency>
<dependency>
<groupId>org.apache.chemistry.opencmis</groupId>
<artifactId>chemistry-opencmis-server-support</artifactId>
<version>${opencmis.version}</version>
</dependency>
<dependency><!-- for development only -->
<groupId>org.apache.chemistry.opencmis</groupId>
<artifactId>chemistry-opencmis-server-bindings</artifactId>
<version>${opencmis.version}</version>
<scope>provided</scope>
</dependency>
org.apache.maven.plugins
maven战争插件
2.3
org.apache.chemistry.opencmis
化学opencmis服务器绑定战争
index.html
css/**
图像/**
web/**
WEB-INF/classes/sample-repository.properties
org.apache.chemistry.opencmis
化学opencmis服务器绑定战争
${opencmis.version}
战争
org.apache.chemistry.opencmis
化学opencmis服务器支持
${opencmis.version}
org.apache.chemistry.opencmis
opencmis服务器绑定
${opencmis.version}
假如
这是我的主要应用程序java文件`
public static void main(String[] args) {
//System.setProperty("spring.profiles.active", "local");
SpringApplication.run(CMISApplication.class, args);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(CMISApplication.class, WebConfigurerAdapter.class);
}
@Bean
public ServletRegistrationBean dispatcherServletRegistration() {
ServletRegistrationBean registration = new ServletRegistrationBean(new
CustomCmisBrowserBindingServlet(),
"/api/cmis/browser/*");
Map<String, String> params = new HashMap<String, String>();
params.put("callContextHandler",
"com.sbs.digimags.browser.BearerAuthCallContextHandler");
registration.setInitParameters(params);
return registration;
}
@Override
public void onStartup(ServletContext servletContext) throws ServletException
{
// Added code to delete the cached files in the server during server start
File folder = new File(cacheFolder+key);
LOG.info("Deleting cache files from"+ cacheFolder+key);
File[] listOfFiles = folder.listFiles();
if(listOfFiles!=null ){
for (int fileNumber = 0; fileNumber < listOfFiles.length; fileNumber++) {
if (listOfFiles[fileNumber].isFile()) {
boolean deletionSuccess =listOfFiles[fileNumber].delete();
if(!deletionSuccess)
throw new CmisStorageException("Unable to delete the file");
}
}
}
servletContext.addListener(new CustomCmisRepositoryContextListener(env));
}
@Override
public void contextInitialized(ServletContextEvent sce) {
}
@Override
public void contextDestroyed(ServletContextEvent sce) {
}
publicstaticvoidmain(字符串[]args){
//System.setProperty(“spring.profiles.active”、“local”);
run(CMISApplication.class,args);
}
@凌驾
受保护的SpringApplicationBuilder配置(SpringApplicationBuilder应用程序){
返回application.sources(CMISApplication.class、WebConfigureAdapter.class);
}
@豆子
public ServletRegistrationBean Dispatchers ServletRegistration(){
ServletRegistrationBean注册=新建ServletRegistrationBean(新建
CustomCmisBrowserBindingServlet(),
“/api/cmis/browser/*”;
Map params=新的HashMap();
params.put(“callContextHandler”,
“com.sbs.digimags.browser.BeareAuthCallContextHandler”);
registration.setInitParameters(params);
申报登记;
}
@凌驾
启动时公共void(ServletContext ServletContext)引发ServletException
{
//添加了在服务器启动期间删除服务器中缓存文件的代码
文件夹=新文件(缓存文件夹+密钥);
LOG.info(“从“+cacheFolder+key”删除缓存文件);
File[]listOfFiles=folder.listFiles();
if(listOfFiles!=null){
对于(int fileNumber=0;fileNumber
从opencmis服务器绑定
依赖项中删除提供的。在您的设置中,您需要这个jar。代码格式。