You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Jozef Dropčo (Created JIRA)" <ji...@apache.org> on 2012/02/24 01:17:49 UTC

[jira] [Created] (CAY-1673) Running ROP and CayenneFilter on same project

Running ROP and CayenneFilter on same project
---------------------------------------------

                 Key: CAY-1673
                 URL: https://issues.apache.org/jira/browse/CAY-1673
             Project: Cayenne
          Issue Type: Bug
          Components: ROP
    Affects Versions: 3.1M3
         Environment: Tomcat 7.0.14
            Reporter: Jozef Dropčo


mapping for CayenneFilter is "/*" and I have ROPHessianServlet mounted on "/hessian". The problem is when I start the project webpages run perfectly, but after first call on ROPHessianServlet, I've got this error:
org.apache.cayenne.ConfigurationException: [v.3.1M3 Sep 12 2011 19:59:45] DI container has no binding for key <BindingKey: org.apache.cayenne.configuration.web.RequestHandler>
	at org.apache.cayenne.di.spi.DefaultInjector.getProvider(DefaultInjector.java:123)
	at org.apache.cayenne.di.spi.DefaultInjector.getProvider(DefaultInjector.java:111)
	at org.apache.cayenne.di.spi.DefaultInjector.getInstance(DefaultInjector.java:103)
	at org.apache.cayenne.configuration.web.CayenneFilter.doFilter(CayenneFilter.java:92)

I find out that this error is caused because in init method of ROPHessianServlet is no merging between existing ServerContext and new ServerContext created by servlet.

I also fixed this bug by changing init method like this:

....
        ArrayList<Module> modules = new ArrayList<Module>();
        if (currentRuntime != null) {
            modules.addAll(Arrays.asList(currentRuntime.getModules()));
        }
        modules.add(new ROPServerModule(
                eventBridgeParameters));
        ServerRuntime runtime = new ServerRuntime(configurationLocation, modules.toArray(new Module[modules.size()]));
....


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Updated] (CAY-1673) Running ROP and CayenneFilter on same project

Posted by "Jozef Dropčo (Updated JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAY-1673?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jozef Dropčo updated CAY-1673:
------------------------------

    Description: 
mapping for CayenneFilter is "/*" and I have ROPHessianServlet mounted on "/hessian". The problem is when I start the project webpages run perfectly, but after first call on ROPHessianServlet, I've got this error:
org.apache.cayenne.ConfigurationException: [v.3.1M3 Sep 12 2011 19:59:45] DI container has no binding for key <BindingKey: org.apache.cayenne.configuration.web.RequestHandler>
	at org.apache.cayenne.di.spi.DefaultInjector.getProvider(DefaultInjector.java:123)
	at org.apache.cayenne.di.spi.DefaultInjector.getProvider(DefaultInjector.java:111)
	at org.apache.cayenne.di.spi.DefaultInjector.getInstance(DefaultInjector.java:103)
	at org.apache.cayenne.configuration.web.CayenneFilter.doFilter(CayenneFilter.java:92)

I find out that this error is caused because in init method of ROPHessianServlet is no merging between existing ServerContext and new ServerContext created by servlet.

I also fixed this bug by modifing the code like this:

....
        ArrayList<Module> modules = new ArrayList<Module>();
        if (currentRuntime != null) {
            modules.addAll(Arrays.asList(currentRuntime.getModules()));
        }
        modules.add(new ROPServerModule(
                eventBridgeParameters));
        ServerRuntime runtime = new ServerRuntime(configurationLocation, modules.toArray(new Module[modules.size()]));
....


  was:
mapping for CayenneFilter is "/*" and I have ROPHessianServlet mounted on "/hessian". The problem is when I start the project webpages run perfectly, but after first call on ROPHessianServlet, I've got this error:
org.apache.cayenne.ConfigurationException: [v.3.1M3 Sep 12 2011 19:59:45] DI container has no binding for key <BindingKey: org.apache.cayenne.configuration.web.RequestHandler>
	at org.apache.cayenne.di.spi.DefaultInjector.getProvider(DefaultInjector.java:123)
	at org.apache.cayenne.di.spi.DefaultInjector.getProvider(DefaultInjector.java:111)
	at org.apache.cayenne.di.spi.DefaultInjector.getInstance(DefaultInjector.java:103)
	at org.apache.cayenne.configuration.web.CayenneFilter.doFilter(CayenneFilter.java:92)

I find out that this error is caused because in init method of ROPHessianServlet is no merging between existing ServerContext and new ServerContext created by servlet.

I also fixed this bug by changing init method like this:

....
        ArrayList<Module> modules = new ArrayList<Module>();
        if (currentRuntime != null) {
            modules.addAll(Arrays.asList(currentRuntime.getModules()));
        }
        modules.add(new ROPServerModule(
                eventBridgeParameters));
        ServerRuntime runtime = new ServerRuntime(configurationLocation, modules.toArray(new Module[modules.size()]));
....


    
> Running ROP and CayenneFilter on same project
> ---------------------------------------------
>
>                 Key: CAY-1673
>                 URL: https://issues.apache.org/jira/browse/CAY-1673
>             Project: Cayenne
>          Issue Type: Bug
>          Components: ROP
>    Affects Versions: 3.1M3
>         Environment: Tomcat 7.0.14
>            Reporter: Jozef Dropčo
>   Original Estimate: 20m
>  Remaining Estimate: 20m
>
> mapping for CayenneFilter is "/*" and I have ROPHessianServlet mounted on "/hessian". The problem is when I start the project webpages run perfectly, but after first call on ROPHessianServlet, I've got this error:
> org.apache.cayenne.ConfigurationException: [v.3.1M3 Sep 12 2011 19:59:45] DI container has no binding for key <BindingKey: org.apache.cayenne.configuration.web.RequestHandler>
> 	at org.apache.cayenne.di.spi.DefaultInjector.getProvider(DefaultInjector.java:123)
> 	at org.apache.cayenne.di.spi.DefaultInjector.getProvider(DefaultInjector.java:111)
> 	at org.apache.cayenne.di.spi.DefaultInjector.getInstance(DefaultInjector.java:103)
> 	at org.apache.cayenne.configuration.web.CayenneFilter.doFilter(CayenneFilter.java:92)
> I find out that this error is caused because in init method of ROPHessianServlet is no merging between existing ServerContext and new ServerContext created by servlet.
> I also fixed this bug by modifing the code like this:
> ....
>         ArrayList<Module> modules = new ArrayList<Module>();
>         if (currentRuntime != null) {
>             modules.addAll(Arrays.asList(currentRuntime.getModules()));
>         }
>         modules.add(new ROPServerModule(
>                 eventBridgeParameters));
>         ServerRuntime runtime = new ServerRuntime(configurationLocation, modules.toArray(new Module[modules.size()]));
> ....

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Assigned] (CAY-1673) Running ROP and CayenneFilter on same project

Posted by "Andrus Adamchik (Assigned) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAY-1673?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrus Adamchik reassigned CAY-1673:
------------------------------------

    Assignee: Andrus Adamchik
    
> Running ROP and CayenneFilter on same project
> ---------------------------------------------
>
>                 Key: CAY-1673
>                 URL: https://issues.apache.org/jira/browse/CAY-1673
>             Project: Cayenne
>          Issue Type: Bug
>          Components: ROP
>    Affects Versions: 3.1M3
>         Environment: Tomcat 7.0.14
>            Reporter: Jozef Dropčo
>            Assignee: Andrus Adamchik
>   Original Estimate: 20m
>  Remaining Estimate: 20m
>
> mapping for CayenneFilter is "/*" and I have ROPHessianServlet mounted on "/hessian". The problem is when I start the project webpages run perfectly, but after first call on ROPHessianServlet, I've got this error:
> org.apache.cayenne.ConfigurationException: [v.3.1M3 Sep 12 2011 19:59:45] DI container has no binding for key <BindingKey: org.apache.cayenne.configuration.web.RequestHandler>
> 	at org.apache.cayenne.di.spi.DefaultInjector.getProvider(DefaultInjector.java:123)
> 	at org.apache.cayenne.di.spi.DefaultInjector.getProvider(DefaultInjector.java:111)
> 	at org.apache.cayenne.di.spi.DefaultInjector.getInstance(DefaultInjector.java:103)
> 	at org.apache.cayenne.configuration.web.CayenneFilter.doFilter(CayenneFilter.java:92)
> I find out that this error is caused because in init method of ROPHessianServlet is no merging between existing ServerContext and new ServerContext created by servlet.
> I also fixed this bug by modifing the code like this:
> ....
>         CayenneRuntime currentRuntime = WebUtil.getCayenneRuntime(servletContext);
>         ArrayList<Module> modules = new ArrayList<Module>();
>         if (currentRuntime != null) {
>             modules.addAll(Arrays.asList(currentRuntime.getModules()));
>         }
>         modules.add(new ROPServerModule(
>                 eventBridgeParameters));
>         ServerRuntime runtime = new ServerRuntime(configurationLocation, modules.toArray(new Module[modules.size()]));
> ....

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (CAY-1673) Running ROP and CayenneFilter on same project

Posted by "Andrus Adamchik (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAY-1673?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13221657#comment-13221657 ] 

Andrus Adamchik commented on CAY-1673:
--------------------------------------

Or we should support adding extra Modules to an existing Runtime. Theoretically that should be possible, even on the running stack... This will be a much better solution.
                
> Running ROP and CayenneFilter on same project
> ---------------------------------------------
>
>                 Key: CAY-1673
>                 URL: https://issues.apache.org/jira/browse/CAY-1673
>             Project: Cayenne
>          Issue Type: Bug
>          Components: ROP
>    Affects Versions: 3.1M3
>         Environment: Tomcat 7.0.14
>            Reporter: Jozef Dropčo
>   Original Estimate: 20m
>  Remaining Estimate: 20m
>
> mapping for CayenneFilter is "/*" and I have ROPHessianServlet mounted on "/hessian". The problem is when I start the project webpages run perfectly, but after first call on ROPHessianServlet, I've got this error:
> org.apache.cayenne.ConfigurationException: [v.3.1M3 Sep 12 2011 19:59:45] DI container has no binding for key <BindingKey: org.apache.cayenne.configuration.web.RequestHandler>
> 	at org.apache.cayenne.di.spi.DefaultInjector.getProvider(DefaultInjector.java:123)
> 	at org.apache.cayenne.di.spi.DefaultInjector.getProvider(DefaultInjector.java:111)
> 	at org.apache.cayenne.di.spi.DefaultInjector.getInstance(DefaultInjector.java:103)
> 	at org.apache.cayenne.configuration.web.CayenneFilter.doFilter(CayenneFilter.java:92)
> I find out that this error is caused because in init method of ROPHessianServlet is no merging between existing ServerContext and new ServerContext created by servlet.
> I also fixed this bug by modifing the code like this:
> ....
>         CayenneRuntime currentRuntime = WebUtil.getCayenneRuntime(servletContext);
>         ArrayList<Module> modules = new ArrayList<Module>();
>         if (currentRuntime != null) {
>             modules.addAll(Arrays.asList(currentRuntime.getModules()));
>         }
>         modules.add(new ROPServerModule(
>                 eventBridgeParameters));
>         ServerRuntime runtime = new ServerRuntime(configurationLocation, modules.toArray(new Module[modules.size()]));
> ....

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Updated] (CAY-1673) Running ROP and CayenneFilter on same project

Posted by "Jozef Dropčo (Updated JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAY-1673?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jozef Dropčo updated CAY-1673:
------------------------------

    Description: 
mapping for CayenneFilter is "/*" and I have ROPHessianServlet mounted on "/hessian". The problem is when I start the project webpages run perfectly, but after first call on ROPHessianServlet, I've got this error:
org.apache.cayenne.ConfigurationException: [v.3.1M3 Sep 12 2011 19:59:45] DI container has no binding for key <BindingKey: org.apache.cayenne.configuration.web.RequestHandler>
	at org.apache.cayenne.di.spi.DefaultInjector.getProvider(DefaultInjector.java:123)
	at org.apache.cayenne.di.spi.DefaultInjector.getProvider(DefaultInjector.java:111)
	at org.apache.cayenne.di.spi.DefaultInjector.getInstance(DefaultInjector.java:103)
	at org.apache.cayenne.configuration.web.CayenneFilter.doFilter(CayenneFilter.java:92)

I find out that this error is caused because in init method of ROPHessianServlet is no merging between existing ServerContext and new ServerContext created by servlet.

I also fixed this bug by modifing the code like this:

....
        CayenneRuntime currentRuntime = WebUtil.getCayenneRuntime(servletContext);
        ArrayList<Module> modules = new ArrayList<Module>();
        if (currentRuntime != null) {
            modules.addAll(Arrays.asList(currentRuntime.getModules()));
        }
        modules.add(new ROPServerModule(
                eventBridgeParameters));
        ServerRuntime runtime = new ServerRuntime(configurationLocation, modules.toArray(new Module[modules.size()]));
....


  was:
mapping for CayenneFilter is "/*" and I have ROPHessianServlet mounted on "/hessian". The problem is when I start the project webpages run perfectly, but after first call on ROPHessianServlet, I've got this error:
org.apache.cayenne.ConfigurationException: [v.3.1M3 Sep 12 2011 19:59:45] DI container has no binding for key <BindingKey: org.apache.cayenne.configuration.web.RequestHandler>
	at org.apache.cayenne.di.spi.DefaultInjector.getProvider(DefaultInjector.java:123)
	at org.apache.cayenne.di.spi.DefaultInjector.getProvider(DefaultInjector.java:111)
	at org.apache.cayenne.di.spi.DefaultInjector.getInstance(DefaultInjector.java:103)
	at org.apache.cayenne.configuration.web.CayenneFilter.doFilter(CayenneFilter.java:92)

I find out that this error is caused because in init method of ROPHessianServlet is no merging between existing ServerContext and new ServerContext created by servlet.

I also fixed this bug by modifing the code like this:

....
        ArrayList<Module> modules = new ArrayList<Module>();
        if (currentRuntime != null) {
            modules.addAll(Arrays.asList(currentRuntime.getModules()));
        }
        modules.add(new ROPServerModule(
                eventBridgeParameters));
        ServerRuntime runtime = new ServerRuntime(configurationLocation, modules.toArray(new Module[modules.size()]));
....


    
> Running ROP and CayenneFilter on same project
> ---------------------------------------------
>
>                 Key: CAY-1673
>                 URL: https://issues.apache.org/jira/browse/CAY-1673
>             Project: Cayenne
>          Issue Type: Bug
>          Components: ROP
>    Affects Versions: 3.1M3
>         Environment: Tomcat 7.0.14
>            Reporter: Jozef Dropčo
>   Original Estimate: 20m
>  Remaining Estimate: 20m
>
> mapping for CayenneFilter is "/*" and I have ROPHessianServlet mounted on "/hessian". The problem is when I start the project webpages run perfectly, but after first call on ROPHessianServlet, I've got this error:
> org.apache.cayenne.ConfigurationException: [v.3.1M3 Sep 12 2011 19:59:45] DI container has no binding for key <BindingKey: org.apache.cayenne.configuration.web.RequestHandler>
> 	at org.apache.cayenne.di.spi.DefaultInjector.getProvider(DefaultInjector.java:123)
> 	at org.apache.cayenne.di.spi.DefaultInjector.getProvider(DefaultInjector.java:111)
> 	at org.apache.cayenne.di.spi.DefaultInjector.getInstance(DefaultInjector.java:103)
> 	at org.apache.cayenne.configuration.web.CayenneFilter.doFilter(CayenneFilter.java:92)
> I find out that this error is caused because in init method of ROPHessianServlet is no merging between existing ServerContext and new ServerContext created by servlet.
> I also fixed this bug by modifing the code like this:
> ....
>         CayenneRuntime currentRuntime = WebUtil.getCayenneRuntime(servletContext);
>         ArrayList<Module> modules = new ArrayList<Module>();
>         if (currentRuntime != null) {
>             modules.addAll(Arrays.asList(currentRuntime.getModules()));
>         }
>         modules.add(new ROPServerModule(
>                 eventBridgeParameters));
>         ServerRuntime runtime = new ServerRuntime(configurationLocation, modules.toArray(new Module[modules.size()]));
> ....

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Issue Comment Edited] (CAY-1673) Running ROP and CayenneFilter on same project

Posted by "Andrus Adamchik (Issue Comment Edited) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAY-1673?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13221654#comment-13221654 ] 

Andrus Adamchik edited comment on CAY-1673 at 3/3/12 6:10 PM:
--------------------------------------------------------------

Using a similar approach inside Cayenne would be a little wasteful, as we are creating the runtime twice. 

I think what we can do on the Cayenne end is to skip instantiation of a CayenneRuntime inside ROPHessianServlet and CayenneFilter if either of them detects that CayenneRuntime is already present in the context. This way a user might create his own Cayenne startup mechanism (e.g. ServletContextListener) where he loads all the modules the application is interested in... This will be the most efficient way to handle that. 

Also we'll need to make sure that bypassing initialization  is logged explicitly in either ROPHessianServlet or CayenneFilter , so that the users combining both immediately become aware that they need to do something differently,
                
      was (Author: andrus):
    I think what we can do on the Cayenne end is to skip instantiation of a CayenneRuntime inside ROPHessianServlet and CayenneFilter if either of them detects that CayenneRuntime is already present in the context. This way a user might create their own startup mechanism (another filter, or a ServletContextListener) where he loads all the modules the application is interested in... This will be the most efficient way to handle that.
                  
> Running ROP and CayenneFilter on same project
> ---------------------------------------------
>
>                 Key: CAY-1673
>                 URL: https://issues.apache.org/jira/browse/CAY-1673
>             Project: Cayenne
>          Issue Type: Bug
>          Components: ROP
>    Affects Versions: 3.1M3
>         Environment: Tomcat 7.0.14
>            Reporter: Jozef Dropčo
>   Original Estimate: 20m
>  Remaining Estimate: 20m
>
> mapping for CayenneFilter is "/*" and I have ROPHessianServlet mounted on "/hessian". The problem is when I start the project webpages run perfectly, but after first call on ROPHessianServlet, I've got this error:
> org.apache.cayenne.ConfigurationException: [v.3.1M3 Sep 12 2011 19:59:45] DI container has no binding for key <BindingKey: org.apache.cayenne.configuration.web.RequestHandler>
> 	at org.apache.cayenne.di.spi.DefaultInjector.getProvider(DefaultInjector.java:123)
> 	at org.apache.cayenne.di.spi.DefaultInjector.getProvider(DefaultInjector.java:111)
> 	at org.apache.cayenne.di.spi.DefaultInjector.getInstance(DefaultInjector.java:103)
> 	at org.apache.cayenne.configuration.web.CayenneFilter.doFilter(CayenneFilter.java:92)
> I find out that this error is caused because in init method of ROPHessianServlet is no merging between existing ServerContext and new ServerContext created by servlet.
> I also fixed this bug by modifing the code like this:
> ....
>         CayenneRuntime currentRuntime = WebUtil.getCayenneRuntime(servletContext);
>         ArrayList<Module> modules = new ArrayList<Module>();
>         if (currentRuntime != null) {
>             modules.addAll(Arrays.asList(currentRuntime.getModules()));
>         }
>         modules.add(new ROPServerModule(
>                 eventBridgeParameters));
>         ServerRuntime runtime = new ServerRuntime(configurationLocation, modules.toArray(new Module[modules.size()]));
> ....

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Closed] (CAY-1673) Running ROP and CayenneFilter on same project

Posted by "Andrus Adamchik (Closed) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAY-1673?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrus Adamchik closed CAY-1673.
--------------------------------

    Resolution: Fixed

After some analysis and consideration I decided against "fixing" the issue, and rather added a startup check for an existing configuration that throws an exception:

if (WebUtil.getCayenneRuntime(context) != null) {
            throw new ServletException(
                    "CayenneRuntime is already configured in the servlet environment");
}

The reasons behind it are the following:

1. I'd like to preserve immutability of the CayenneRuntime and Injector configurations. This makes them predictable and avoids synchronization or lazy init.

2. CayenneFilter (and to a lesser extent - ROPHessianServlet) is a "sample" of how Cayenne might be bootsrapped in a web app, and but by no means the only or the preferred way. We've always recognized that different webapps have different mechanisms to configure their "services", such as Spring, etc. CayenneFilter was designed as a template that can be followed with whatever configuration approach is used. It is simplistic by design and is not intended to be integrated (rather it is intended to be *copied*) into advanced configuration solutions. 


                
> Running ROP and CayenneFilter on same project
> ---------------------------------------------
>
>                 Key: CAY-1673
>                 URL: https://issues.apache.org/jira/browse/CAY-1673
>             Project: Cayenne
>          Issue Type: Bug
>          Components: ROP
>    Affects Versions: 3.1M3
>         Environment: Tomcat 7.0.14
>            Reporter: Jozef Dropčo
>            Assignee: Andrus Adamchik
>   Original Estimate: 20m
>  Remaining Estimate: 20m
>
> mapping for CayenneFilter is "/*" and I have ROPHessianServlet mounted on "/hessian". The problem is when I start the project webpages run perfectly, but after first call on ROPHessianServlet, I've got this error:
> org.apache.cayenne.ConfigurationException: [v.3.1M3 Sep 12 2011 19:59:45] DI container has no binding for key <BindingKey: org.apache.cayenne.configuration.web.RequestHandler>
> 	at org.apache.cayenne.di.spi.DefaultInjector.getProvider(DefaultInjector.java:123)
> 	at org.apache.cayenne.di.spi.DefaultInjector.getProvider(DefaultInjector.java:111)
> 	at org.apache.cayenne.di.spi.DefaultInjector.getInstance(DefaultInjector.java:103)
> 	at org.apache.cayenne.configuration.web.CayenneFilter.doFilter(CayenneFilter.java:92)
> I find out that this error is caused because in init method of ROPHessianServlet is no merging between existing ServerContext and new ServerContext created by servlet.
> I also fixed this bug by modifing the code like this:
> ....
>         CayenneRuntime currentRuntime = WebUtil.getCayenneRuntime(servletContext);
>         ArrayList<Module> modules = new ArrayList<Module>();
>         if (currentRuntime != null) {
>             modules.addAll(Arrays.asList(currentRuntime.getModules()));
>         }
>         modules.add(new ROPServerModule(
>                 eventBridgeParameters));
>         ServerRuntime runtime = new ServerRuntime(configurationLocation, modules.toArray(new Module[modules.size()]));
> ....

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (CAY-1673) Running ROP and CayenneFilter on same project

Posted by "Andrus Adamchik (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAY-1673?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13221654#comment-13221654 ] 

Andrus Adamchik commented on CAY-1673:
--------------------------------------

I think what we can do on the Cayenne end is to skip instantiation of a CayenneRuntime inside ROPHessianServlet and CayenneFilter if either of them detects that CayenneRuntime is already present in the context. This way a user might create their own startup mechanism (another filter, or a ServletContextListener) where he loads all the modules the application is interested in... This will be the most efficient way to handle that.
                
> Running ROP and CayenneFilter on same project
> ---------------------------------------------
>
>                 Key: CAY-1673
>                 URL: https://issues.apache.org/jira/browse/CAY-1673
>             Project: Cayenne
>          Issue Type: Bug
>          Components: ROP
>    Affects Versions: 3.1M3
>         Environment: Tomcat 7.0.14
>            Reporter: Jozef Dropčo
>   Original Estimate: 20m
>  Remaining Estimate: 20m
>
> mapping for CayenneFilter is "/*" and I have ROPHessianServlet mounted on "/hessian". The problem is when I start the project webpages run perfectly, but after first call on ROPHessianServlet, I've got this error:
> org.apache.cayenne.ConfigurationException: [v.3.1M3 Sep 12 2011 19:59:45] DI container has no binding for key <BindingKey: org.apache.cayenne.configuration.web.RequestHandler>
> 	at org.apache.cayenne.di.spi.DefaultInjector.getProvider(DefaultInjector.java:123)
> 	at org.apache.cayenne.di.spi.DefaultInjector.getProvider(DefaultInjector.java:111)
> 	at org.apache.cayenne.di.spi.DefaultInjector.getInstance(DefaultInjector.java:103)
> 	at org.apache.cayenne.configuration.web.CayenneFilter.doFilter(CayenneFilter.java:92)
> I find out that this error is caused because in init method of ROPHessianServlet is no merging between existing ServerContext and new ServerContext created by servlet.
> I also fixed this bug by modifing the code like this:
> ....
>         CayenneRuntime currentRuntime = WebUtil.getCayenneRuntime(servletContext);
>         ArrayList<Module> modules = new ArrayList<Module>();
>         if (currentRuntime != null) {
>             modules.addAll(Arrays.asList(currentRuntime.getModules()));
>         }
>         modules.add(new ROPServerModule(
>                 eventBridgeParameters));
>         ServerRuntime runtime = new ServerRuntime(configurationLocation, modules.toArray(new Module[modules.size()]));
> ....

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira