java - 由 : java. lang.ClassNotFoundException : org. apache.chemistry.opencmis.server.shared.AbstractCmisHttpServlet 引起

标签 java apache spring-boot opencmis

我正在开发一个使用 opencmis 的现成 cmis 项目。我确实成功构建了 Maven,但是当我尝试在本地运行此 springboot 应用程序时,我收到上述类 AbstractCmisHttpServlet 未找到错误,但我可以在 IDE/m2 存储库中看到该文件。在应用程序java主文件中,当我尝试初始化此对象时,在方法dispatcherServletRegistration()中出现错误 new CustomCmisBrowserBindingServlet() 该类扩展了AbstractCmisHttpServlet。这里说找不到该类。

这是我的 opencmis 的 POM 详细信息`

<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>

这是我的主应用程序 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) {

    }

最佳答案

删除<scope>provided</scope>来自chemistry-opencmis-server-bindings依赖性。在您的设置中,您需要这个 jar。

关于java - 由 : java. lang.ClassNotFoundException : org. apache.chemistry.opencmis.server.shared.AbstractCmisHttpServlet 引起,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51591102/

相关文章:

Linux 端点上的 Node.js 适用于 'api//method' 但不适用于 'api/method'

javascript - 为什么我从 Express 服务器收到 "404 cannot POST"错误?

spring - 依赖项中的 JUnit 版本错误

java - 注释属性 GetMapping.products 的值必须是常量表达式

java - JPA/Hibernate order by of a Joda time of the day 在香港无法正常工作

java - 无法在 verify : too many invocations 的参数中使用模拟函数调用

java - 按住按钮进行重复操作——是否有 android :onClick for holds?(在 XML 文件中)

java - 如何设置jbutton的位置?

linux - 如何将所有流量重定向到维护页面

rest - 从 IntelliJ Idea 运行/调试 Spring Boot 应用程序