Hi Nikita

You were right. I'm just learning how to use Maven and the cayenne-di wasn't included in a sub-project that my project was dependent on even though the cayenne-di library "appeared" to be included automatically in my dependent project.

I also substituted your cleaner version of ServerModule and it worked perfectly. I sometimes struggle with trying to understand the configuration options of Cayenne especially between the releases. I don't pretend to get how Cayenne works at the lower levels but I'm very happy to use it as a simple user. ;-)

Thank you for your assistance.

Andrew



On 09/04/2017 11:32 AM, Nikita Timofeev wrote:
Hi Andrew,

java.lang.NoSuchMethodError: org.apache.cayenne.di.spi.Modu
leLoader.load(Ljava/lang/Class;)Ljava/util/List;
This seems like binary incompatibility with cayenne-di lib, have you tried
to rebuild whole project? And how do you include Cayenne, is it Maven?

binder.bindMap(Constants.PROPERTIES_MAP).put(Constants.SERVER_CONTEXTS_SYNC_PROPERTY,
"false");
This should be replaced with cleaner ServerModule.
contributeProperties(binder).put(Constants.SERVER_CONTEXTS_SYNC_PROPERTY,
"false");


On Mon, Sep 4, 2017 at 5:42 PM, Andrew Willerding <[email protected]>
wrote:

Hi,

I am trying to use a custom location for the cayenne configuration files
and I'm getting the exception below on the following code on the line that
executes ServerRuntime.builder() and I don't know what is missing.
I'm using version 4.0.B1.
I am also not sure how to replace the deprecated bindMap call with the
proper replacement method.

Any help and insight would be greatly appreciated,

Andrew

         if (!serverRuntimeList.containsKey(pathToCayenneXMLFile)) {
             Module myModule = (Binder binder) -> {
                 binder.bind(ResourceLocator.class).toInstance(new
FilesystemResourceLocator(pathForCayenne));
                 binder.bindMap(Constants.PROPE
RTIES_MAP).put(Constants.SERVER_CONTEXTS_SYNC_PROPERTY, "false");
                 //binder.bind(QueryCache.class
).to(EhCacheQueryCache.class);
             };
             runtime = ServerRuntime.builder().addCon
fig(cayenneXMLFileName)
                     .addModule(myModule)
                     .build();
             if (runtime != null) {
                 serverRuntimeList.put(pathToCayenneXMLFile, runtime);
             } else {
                 throw new RuntimeException("ORMCayenne Error");
             }
         }


javax.servlet.ServletException: com.vaadin.server.ServiceException:
java.lang.NoSuchMethodError: org.apache.cayenne.di.spi.Modu
leLoader.load(Ljava/lang/Class;)Ljava/util/List;
         com.vaadin.server.VaadinServlet.service(VaadinServlet.java:383)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
         org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilte
r.java:52)
         org.apache.logging.log4j.web.Log4jServletFilter.doFilter(Log
4jServletFilter.java:71)

*root cause*

com.vaadin.server.ServiceException: java.lang.NoSuchMethodError:
org.apache.cayenne.di.spi.ModuleLoader.load(Ljava/lang/Class
;)Ljava/util/List;
         com.vaadin.server.VaadinService.handleExceptionDuringRequest
(VaadinService.java:1620)
         com.vaadin.server.VaadinService.handleRequest(VaadinService.
java:1580)
         com.vaadin.server.VaadinServlet.service(VaadinServlet.java:381)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
         org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilte
r.java:52)
         org.apache.logging.log4j.web.Log4jServletFilter.doFilter(Log
4jServletFilter.java:71)

*root cause*

java.lang.NoSuchMethodError: org.apache.cayenne.di.spi.Modu
leLoader.load(Ljava/lang/Class;)Ljava/util/List;
         org.apache.cayenne.configuration.server.ServerRuntimeBuilder
.autoLoadedModules(ServerRuntimeBuilder.java:238)
         org.apache.cayenne.configuration.server.ServerRuntimeBuilder
.build(ServerRuntimeBuilder.java:226)
         com.callistacti.clientbase.ClientBaseAdmin.getServerRuntime(
ClientBaseAdmin.java:304)
         com.callistacti.clientbase.ClientBaseAdmin.initClientBaseAdm
in(ClientBaseAdmin.java:91)
         com.callistacti.clientbase.UI_ClientBase.<clinit>(UI_ClientB
ase.java:62)
         java.lang.Class.forName0(Native Method)
         java.lang.Class.forName(Class.java:348)
         com.vaadin.server.DefaultUIProvider.getUIClass(DefaultUIProv
ider.java:33)
         com.vaadin.server.BootstrapHandler.synchronizedHandleRequest
(BootstrapHandler.java:400)
         com.vaadin.server.SynchronizedRequestHandler.handleRequest(S
ynchronizedRequestHandler.java:41)
         com.vaadin.server.VaadinService.handleRequest(VaadinService.
java:1568)
         com.vaadin.server.VaadinServlet.service(VaadinServlet.java:381)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
         org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilte
r.java:52)
         org.apache.logging.log4j.web.Log4jServletFilter.doFilter(Log
4jServletFilter.java:71)




Reply via email to