简体   繁体   中英

Method in Java showing error in Eclipse, builds fine with Maven

I cant get rid of this error in Eclipse. The project is using Java 8 and so is Eclipse so I am at a stand still why I am getting this error below.

The method setTomcatContextCustomizers(Collection<? extends TomcatContextCustomizer>) in the type TomcatEmbeddedServletContainerFactory is not applicable for the arguments (List<Object>)

 tomcatFactory.setTomcatContextCustomizers(Arrays.asList(context -> {
                    JDBCStore store = new JDBCStore();
                    store.setDriverName(tomcatConfig.getStoreDriverName());
                    store.setConnectionURL(jdbcUrl);
                    store.setConnectionName(jdbcUser);
                    store.setConnectionPassword(jdbcPassword);
                    store.setSessionAppCol(tomcatConfig.getStoreSessionAppCol());
                    store.setSessionDataCol(tomcatConfig.getStoreSessionDataCol());
                    store.setSessionIdCol(tomcatConfig.getStoreSessionIdCol());
                    store.setSessionLastAccessedCol(tomcatConfig.getStoreSessionLastAccessedCol());
                    store.setSessionMaxInactiveCol(tomcatConfig.getStoreSessionMaxInactiveCol());
                    store.setSessionTable(tomcatConfig.getStoreSessionTable());
                    store.setSessionValidCol(tomcatConfig.getStoreSessionValidCol());
                    PersistentManager pm = new PersistentManager();
                    pm.setDistributable(true);
                    pm.setProcessExpiresFrequency(tomcatConfig.getPersistenceManagerProcessExpiresFrequency());
                    pm.setMaxIdleBackup(tomcatConfig.getPersistenceManagerMaxIdleBackup());
                    pm.setStore(store);
                    context.setManager(pm);
                }));

Have you tried cleaning up your eclipse workspace by going to Project->Clean and then refreshing it by going to File->Refresh?

This usually works for me when I encounter the same behavior with errors showing up in eclipse but not while building with maven.

通过Eclipse Kepler和Java 7在发生这种情况时,通过Eclipse的菜单窗口→首选项→Maven→安装和添加外部Maven安装总是对我有帮助。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM