You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by "Matt Raible (Created) (JIRA)" <ji...@apache.org> on 2011/12/13 20:26:30 UTC

[jira] [Created] (TAP5-1788) Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule with Spring 3.1

Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule with Spring 3.1
-----------------------------------------------------------------------------------------------------------------

                 Key: TAP5-1788
                 URL: https://issues.apache.org/jira/browse/TAP5-1788
             Project: Tapestry 5
          Issue Type: Bug
          Components: tapestry-spring
    Affects Versions: 5.2.4
            Reporter: Matt Raible


After upgrading to Spring 3.1, started seeing the following error with Tapestry 5.2.4.

java.lang.RuntimeException: Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule.buildEnvironment(PerthreadManager) 

More information at http://tapestry.1045711.n5.nabble.com/tapestry-5-2-4-and-spring-3-1M1-td4462226.html#a4742011

--
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] (TAP5-1788) Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule with Spring 3.1

Posted by "Matt Raible (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-1788?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13169669#comment-13169669 ] 

Matt Raible commented on TAP5-1788:
-----------------------------------

If I try to run it w/o compatibility mode, I get the following error:

org.apache.tapestry5.ioc.internal.OperationException: Error obtaining injected value for field org.appfuse.webapp.pages.admin.UserList.userManager: No service implements the interface org.appfuse.service.UserManager.

The userManager bean is initialized by Spring using annotations:

@Service("userManager")
...

<!-- Activates scanning of @Service -->
<context:component-scan base-package="org.appfuse.service"/>

Here's how I'm wiring it up in my test:

https://gist.github.com/1478384

                
> Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule with Spring 3.1
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-1788
>                 URL: https://issues.apache.org/jira/browse/TAP5-1788
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-spring
>    Affects Versions: 5.2.4
>            Reporter: Matt Raible
>
> After upgrading to Spring 3.1, started seeing the following error with Tapestry 5.2.4.
> java.lang.RuntimeException: Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule.buildEnvironment(PerthreadManager) 
> More information at http://tapestry.1045711.n5.nabble.com/tapestry-5-2-4-and-spring-3-1M1-td4462226.html#a4742011

--
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] (TAP5-1788) Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule with Spring 3.1

Posted by "Howard M. Lewis Ship (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-1788?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13169661#comment-13169661 ] 

Howard M. Lewis Ship commented on TAP5-1788:
--------------------------------------------

It's always a challenge to make these two things fit together.  I believe you are running tapestry-spring in 5.0 compatibility mode, where it attempts to expose Spring beans as Tapestry services. 

We need to find a way to run tapestry-spring in its current mode (since 5.1), where Spring beans are injectable, but not services.  This will defuse naming collisions, such as with "Environment", but may create some other issues, depending on what is inside your Spring application context.

In some ways, I wish we had maintained the namespaced service ids that HiveMind had for Tapestry 4 (but namespaceds ids add their own complications); in the future will be services without ids, but that's a couple of release cycles away!


                
> Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule with Spring 3.1
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-1788
>                 URL: https://issues.apache.org/jira/browse/TAP5-1788
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-spring
>    Affects Versions: 5.2.4
>            Reporter: Matt Raible
>
> After upgrading to Spring 3.1, started seeing the following error with Tapestry 5.2.4.
> java.lang.RuntimeException: Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule.buildEnvironment(PerthreadManager) 
> More information at http://tapestry.1045711.n5.nabble.com/tapestry-5-2-4-and-spring-3-1M1-td4462226.html#a4742011

--
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] (TAP5-1788) Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule with Spring 3.1

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

Igor Drobiazko reassigned TAP5-1788:
------------------------------------

    Assignee: Igor Drobiazko
    
> Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule with Spring 3.1
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-1788
>                 URL: https://issues.apache.org/jira/browse/TAP5-1788
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-spring
>    Affects Versions: 5.2.4
>            Reporter: Matt Raible
>            Assignee: Igor Drobiazko
>         Attachments: tapestry-spring-3.1-fix.patch
>
>
> After upgrading to Spring 3.1, started seeing the following error with Tapestry 5.2.4.
> java.lang.RuntimeException: Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule.buildEnvironment(PerthreadManager) 
> More information at http://tapestry.1045711.n5.nabble.com/tapestry-5-2-4-and-spring-3-1M1-td4462226.html#a4742011

--
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] (TAP5-1788) Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule with Spring 3.1

Posted by "Ralf Edmund Stranzenbach (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-1788?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13219871#comment-13219871 ] 

Ralf Edmund Stranzenbach commented on TAP5-1788:
------------------------------------------------

This solution has an undesired side effect. It prevents me from using a centralized spring context that is associated as a "parent context" to the "application.xml" loaded by the tapestry-spring filter.

Only the few beans assigned to the web-app specific part of the spring configuration are therefore visible to the tapestry injector. The main part of my applications infrastructure became invisible to tapestry.

A better solution would be to either assign an implicit "namespace" to spring beans in case they duplicate a service name already used in tapestry. This would enable the use of parent spring context while preventing the duplicate "Environment" service.
                
> Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule with Spring 3.1
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-1788
>                 URL: https://issues.apache.org/jira/browse/TAP5-1788
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-spring
>    Affects Versions: 5.2.4
>            Reporter: Matt Raible
>            Assignee: Igor Drobiazko
>             Fix For: 5.3.2, 5.4
>
>         Attachments: tapestry-spring-3.1-fix.patch
>
>
> After upgrading to Spring 3.1, started seeing the following error with Tapestry 5.2.4.
> java.lang.RuntimeException: Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule.buildEnvironment(PerthreadManager) 
> More information at http://tapestry.1045711.n5.nabble.com/tapestry-5-2-4-and-spring-3-1M1-td4462226.html#a4742011

--
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] (TAP5-1788) Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule with Spring 3.1

Posted by "Fernando Padilla (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-1788?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13246019#comment-13246019 ] 

Fernando Padilla commented on TAP5-1788:
----------------------------------------

I also have the same issue as Ralf.  We need to go back to getting the beanNames including ancestors/parents please.

are there any better solutions, can't we simply ignore the "environment" bean from spring? Or can we just have Tapestry IoC prefer services defined from Tapestry, before looking at spring based ones??
                
> Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule with Spring 3.1
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-1788
>                 URL: https://issues.apache.org/jira/browse/TAP5-1788
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-spring
>    Affects Versions: 5.2.4
>            Reporter: Matt Raible
>            Assignee: Igor Drobiazko
>             Fix For: 5.3.2, 5.4
>
>         Attachments: tapestry-spring-3.1-fix.patch
>
>
> After upgrading to Spring 3.1, started seeing the following error with Tapestry 5.2.4.
> java.lang.RuntimeException: Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule.buildEnvironment(PerthreadManager) 
> More information at http://tapestry.1045711.n5.nabble.com/tapestry-5-2-4-and-spring-3-1M1-td4462226.html#a4742011

--
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] (TAP5-1788) Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule with Spring 3.1

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

Hudson commented on TAP5-1788:
------------------------------

Integrated in tapestry-trunk-freestyle #644 (See [https://builds.apache.org/job/tapestry-trunk-freestyle/644/])
    TAP5-1788: Avoid collision with Service id 'environment' that has already been defined in Spring 3.1

drobiazko : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1214678
Files : 
* /tapestry/tapestry5/trunk/tapestry-spring/src/main/java/org/apache/tapestry5/internal/spring/SpringModuleDef.java
* /tapestry/tapestry5/trunk/tapestry-spring/src/test/java/org/apache/tapestry5/internal/spring/SpringModuleDefTest.java
* /tapestry/tapestry5/trunk/tapestry-spring/src/test/java/org/apache/tapestry5/spring/TapestryExternalSpringContextIntegrationTest.java
* /tapestry/tapestry5/trunk/tapestry-spring/src/test/java/org/example/testapp1
* /tapestry/tapestry5/trunk/tapestry-spring/src/test/java/org/example/testapp1/pages
* /tapestry/tapestry5/trunk/tapestry-spring/src/test/java/org/example/testapp1/pages/Index.java
* /tapestry/tapestry5/trunk/tapestry-spring/src/test/java/org/example/testapp1/services
* /tapestry/tapestry5/trunk/tapestry-spring/src/test/java/org/example/testapp1/services/AppModule.java
* /tapestry/tapestry5/trunk/tapestry-spring/src/test/webapp1
* /tapestry/tapestry5/trunk/tapestry-spring/src/test/webapp1/Index.tml
* /tapestry/tapestry5/trunk/tapestry-spring/src/test/webapp1/WEB-INF
* /tapestry/tapestry5/trunk/tapestry-spring/src/test/webapp1/WEB-INF/applicationContext.xml
* /tapestry/tapestry5/trunk/tapestry-spring/src/test/webapp1/WEB-INF/web.xml

                
> Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule with Spring 3.1
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-1788
>                 URL: https://issues.apache.org/jira/browse/TAP5-1788
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-spring
>    Affects Versions: 5.2.4
>            Reporter: Matt Raible
>            Assignee: Igor Drobiazko
>             Fix For: 5.3.2, 5.4
>
>         Attachments: tapestry-spring-3.1-fix.patch
>
>
> After upgrading to Spring 3.1, started seeing the following error with Tapestry 5.2.4.
> java.lang.RuntimeException: Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule.buildEnvironment(PerthreadManager) 
> More information at http://tapestry.1045711.n5.nabble.com/tapestry-5-2-4-and-spring-3-1M1-td4462226.html#a4742011

--
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] (TAP5-1788) Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule with Spring 3.1

Posted by "Denis Stepanov (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-1788?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13247112#comment-13247112 ] 

Denis Stepanov commented on TAP5-1788:
--------------------------------------

Why not just prefix spring service ids with "spring."?
                
> Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule with Spring 3.1
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-1788
>                 URL: https://issues.apache.org/jira/browse/TAP5-1788
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-spring
>    Affects Versions: 5.2.4
>            Reporter: Matt Raible
>            Assignee: Igor Drobiazko
>             Fix For: 5.3.2, 5.4
>
>         Attachments: tapestry-spring-3.1-fix.patch
>
>
> After upgrading to Spring 3.1, started seeing the following error with Tapestry 5.2.4.
> java.lang.RuntimeException: Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule.buildEnvironment(PerthreadManager) 
> More information at http://tapestry.1045711.n5.nabble.com/tapestry-5-2-4-and-spring-3-1M1-td4462226.html#a4742011

--
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] (TAP5-1788) Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule with Spring 3.1

Posted by "Matt Raible (Issue Comment Edited) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-1788?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13169791#comment-13169791 ] 

Matt Raible edited comment on TAP5-1788 at 12/14/11 11:16 PM:
--------------------------------------------------------------

The attached patch solves this for me on trunk.
                
      was (Author: mraible):
    The attached patch solve this for me on trunk.
                  
> Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule with Spring 3.1
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-1788
>                 URL: https://issues.apache.org/jira/browse/TAP5-1788
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-spring
>    Affects Versions: 5.2.4
>            Reporter: Matt Raible
>         Attachments: tapestry-spring-3.1-fix.patch
>
>
> After upgrading to Spring 3.1, started seeing the following error with Tapestry 5.2.4.
> java.lang.RuntimeException: Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule.buildEnvironment(PerthreadManager) 
> More information at http://tapestry.1045711.n5.nabble.com/tapestry-5-2-4-and-spring-3-1M1-td4462226.html#a4742011

--
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] (TAP5-1788) Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule with Spring 3.1

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

Igor Drobiazko closed TAP5-1788.
--------------------------------

       Resolution: Fixed
    Fix Version/s: 5.4
                   5.3.2

Thanks for the patch, Matt. I added some integration tests to prove that it works. Also backported the 5.3 maintenance branch.
                
> Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule with Spring 3.1
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-1788
>                 URL: https://issues.apache.org/jira/browse/TAP5-1788
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-spring
>    Affects Versions: 5.2.4
>            Reporter: Matt Raible
>            Assignee: Igor Drobiazko
>             Fix For: 5.3.2, 5.4
>
>         Attachments: tapestry-spring-3.1-fix.patch
>
>
> After upgrading to Spring 3.1, started seeing the following error with Tapestry 5.2.4.
> java.lang.RuntimeException: Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule.buildEnvironment(PerthreadManager) 
> More information at http://tapestry.1045711.n5.nabble.com/tapestry-5-2-4-and-spring-3-1M1-td4462226.html#a4742011

--
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] (TAP5-1788) Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule with Spring 3.1

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

Hudson commented on TAP5-1788:
------------------------------

Integrated in tapestry-trunk-freestyle #644 (See [https://builds.apache.org/job/tapestry-trunk-freestyle/644/])
    TAP5-1788: Avoid collision with Service id 'environment' that has already been defined in Spring 3.1

drobiazko : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1214678
Files : 
* /tapestry/tapestry5/trunk/tapestry-spring/src/main/java/org/apache/tapestry5/internal/spring/SpringModuleDef.java
* /tapestry/tapestry5/trunk/tapestry-spring/src/test/java/org/apache/tapestry5/internal/spring/SpringModuleDefTest.java
* /tapestry/tapestry5/trunk/tapestry-spring/src/test/java/org/apache/tapestry5/spring/TapestryExternalSpringContextIntegrationTest.java
* /tapestry/tapestry5/trunk/tapestry-spring/src/test/java/org/example/testapp1
* /tapestry/tapestry5/trunk/tapestry-spring/src/test/java/org/example/testapp1/pages
* /tapestry/tapestry5/trunk/tapestry-spring/src/test/java/org/example/testapp1/pages/Index.java
* /tapestry/tapestry5/trunk/tapestry-spring/src/test/java/org/example/testapp1/services
* /tapestry/tapestry5/trunk/tapestry-spring/src/test/java/org/example/testapp1/services/AppModule.java
* /tapestry/tapestry5/trunk/tapestry-spring/src/test/webapp1
* /tapestry/tapestry5/trunk/tapestry-spring/src/test/webapp1/Index.tml
* /tapestry/tapestry5/trunk/tapestry-spring/src/test/webapp1/WEB-INF
* /tapestry/tapestry5/trunk/tapestry-spring/src/test/webapp1/WEB-INF/applicationContext.xml
* /tapestry/tapestry5/trunk/tapestry-spring/src/test/webapp1/WEB-INF/web.xml

                
> Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule with Spring 3.1
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-1788
>                 URL: https://issues.apache.org/jira/browse/TAP5-1788
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-spring
>    Affects Versions: 5.2.4
>            Reporter: Matt Raible
>            Assignee: Igor Drobiazko
>             Fix For: 5.3.2, 5.4
>
>         Attachments: tapestry-spring-3.1-fix.patch
>
>
> After upgrading to Spring 3.1, started seeing the following error with Tapestry 5.2.4.
> java.lang.RuntimeException: Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule.buildEnvironment(PerthreadManager) 
> More information at http://tapestry.1045711.n5.nabble.com/tapestry-5-2-4-and-spring-3-1M1-td4462226.html#a4742011

--
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] (TAP5-1788) Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule with Spring 3.1

Posted by "Matt Raible (Issue Comment Edited) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-1788?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13169791#comment-13169791 ] 

Matt Raible edited comment on TAP5-1788 at 12/14/11 11:16 PM:
--------------------------------------------------------------

The attached patch solves this for me on trunk.
                
      was (Author: mraible):
    The attached patch solve this for me on trunk.
                  
> Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule with Spring 3.1
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-1788
>                 URL: https://issues.apache.org/jira/browse/TAP5-1788
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-spring
>    Affects Versions: 5.2.4
>            Reporter: Matt Raible
>         Attachments: tapestry-spring-3.1-fix.patch
>
>
> After upgrading to Spring 3.1, started seeing the following error with Tapestry 5.2.4.
> java.lang.RuntimeException: Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule.buildEnvironment(PerthreadManager) 
> More information at http://tapestry.1045711.n5.nabble.com/tapestry-5-2-4-and-spring-3-1M1-td4462226.html#a4742011

--
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] (TAP5-1788) Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule with Spring 3.1

Posted by "Matt Raible (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/TAP5-1788?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Matt Raible updated TAP5-1788:
------------------------------

    Attachment: tapestry-spring-3.1-fix.patch

The attached patch solve this for me on trunk.
                
> Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule with Spring 3.1
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-1788
>                 URL: https://issues.apache.org/jira/browse/TAP5-1788
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-spring
>    Affects Versions: 5.2.4
>            Reporter: Matt Raible
>         Attachments: tapestry-spring-3.1-fix.patch
>
>
> After upgrading to Spring 3.1, started seeing the following error with Tapestry 5.2.4.
> java.lang.RuntimeException: Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule.buildEnvironment(PerthreadManager) 
> More information at http://tapestry.1045711.n5.nabble.com/tapestry-5-2-4-and-spring-3-1M1-td4462226.html#a4742011

--
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] (TAP5-1788) Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule with Spring 3.1

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

Igor Drobiazko reassigned TAP5-1788:
------------------------------------

    Assignee: Igor Drobiazko
    
> Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule with Spring 3.1
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-1788
>                 URL: https://issues.apache.org/jira/browse/TAP5-1788
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-spring
>    Affects Versions: 5.2.4
>            Reporter: Matt Raible
>            Assignee: Igor Drobiazko
>         Attachments: tapestry-spring-3.1-fix.patch
>
>
> After upgrading to Spring 3.1, started seeing the following error with Tapestry 5.2.4.
> java.lang.RuntimeException: Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule.buildEnvironment(PerthreadManager) 
> More information at http://tapestry.1045711.n5.nabble.com/tapestry-5-2-4-and-spring-3-1M1-td4462226.html#a4742011

--
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] (TAP5-1788) Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule with Spring 3.1

Posted by "Matt Raible (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/TAP5-1788?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Matt Raible updated TAP5-1788:
------------------------------

    Attachment: tapestry-spring-3.1-fix.patch

The attached patch solve this for me on trunk.
                
> Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule with Spring 3.1
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-1788
>                 URL: https://issues.apache.org/jira/browse/TAP5-1788
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-spring
>    Affects Versions: 5.2.4
>            Reporter: Matt Raible
>         Attachments: tapestry-spring-3.1-fix.patch
>
>
> After upgrading to Spring 3.1, started seeing the following error with Tapestry 5.2.4.
> java.lang.RuntimeException: Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule.buildEnvironment(PerthreadManager) 
> More information at http://tapestry.1045711.n5.nabble.com/tapestry-5-2-4-and-spring-3-1M1-td4462226.html#a4742011

--
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] (TAP5-1788) Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule with Spring 3.1

Posted by "Matt Raible (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-1788?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13169762#comment-13169762 ] 

Matt Raible commented on TAP5-1788:
-----------------------------------

As suggested in the Nabble thread, changing SpringModuleDef.java from:

    private void addServiceDefsForSpringBeans(ApplicationContext context)
    {
        for (final String beanName : BeanFactoryUtils.beanNamesIncludingAncestors(context))
        {
            String trueName = beanName.startsWith("&") ? beanName.substring(1) : beanName;

            services.put(trueName, new SpringBeanServiceDef(trueName, context));
        }
    }

To:

    private void addServiceDefsForSpringBeans(ApplicationContext context)
    {
        for (final String beanName : context.getBeanDefinitionNames())
        {
            String trueName = beanName.startsWith("&") ? beanName.substring(1) : beanName;

            services.put(trueName, new SpringBeanServiceDef(trueName, context));
        }
    }

Does solve the problem.
                
> Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule with Spring 3.1
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-1788
>                 URL: https://issues.apache.org/jira/browse/TAP5-1788
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-spring
>    Affects Versions: 5.2.4
>            Reporter: Matt Raible
>
> After upgrading to Spring 3.1, started seeing the following error with Tapestry 5.2.4.
> java.lang.RuntimeException: Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule.buildEnvironment(PerthreadManager) 
> More information at http://tapestry.1045711.n5.nabble.com/tapestry-5-2-4-and-spring-3-1M1-td4462226.html#a4742011

--
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] (TAP5-1788) Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule with Spring 3.1

Posted by "Matt Raible (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-1788?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13169762#comment-13169762 ] 

Matt Raible commented on TAP5-1788:
-----------------------------------

As suggested in the Nabble thread, changing SpringModuleDef.java from:

    private void addServiceDefsForSpringBeans(ApplicationContext context)
    {
        for (final String beanName : BeanFactoryUtils.beanNamesIncludingAncestors(context))
        {
            String trueName = beanName.startsWith("&") ? beanName.substring(1) : beanName;

            services.put(trueName, new SpringBeanServiceDef(trueName, context));
        }
    }

To:

    private void addServiceDefsForSpringBeans(ApplicationContext context)
    {
        for (final String beanName : context.getBeanDefinitionNames())
        {
            String trueName = beanName.startsWith("&") ? beanName.substring(1) : beanName;

            services.put(trueName, new SpringBeanServiceDef(trueName, context));
        }
    }

Does solve the problem.
                
> Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule with Spring 3.1
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-1788
>                 URL: https://issues.apache.org/jira/browse/TAP5-1788
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-spring
>    Affects Versions: 5.2.4
>            Reporter: Matt Raible
>
> After upgrading to Spring 3.1, started seeing the following error with Tapestry 5.2.4.
> java.lang.RuntimeException: Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule.buildEnvironment(PerthreadManager) 
> More information at http://tapestry.1045711.n5.nabble.com/tapestry-5-2-4-and-spring-3-1M1-td4462226.html#a4742011

--
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] (TAP5-1788) Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule with Spring 3.1

Posted by "Fernando Padilla (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-1788?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13246019#comment-13246019 ] 

Fernando Padilla commented on TAP5-1788:
----------------------------------------

I also have the same issue as Ralf.  We need to go back to getting the beanNames including ancestors/parents please.

are there any better solutions, can't we simply ignore the "environment" bean from spring? Or can we just have Tapestry IoC prefer services defined from Tapestry, before looking at spring based ones??
                
> Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule with Spring 3.1
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-1788
>                 URL: https://issues.apache.org/jira/browse/TAP5-1788
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-spring
>    Affects Versions: 5.2.4
>            Reporter: Matt Raible
>            Assignee: Igor Drobiazko
>             Fix For: 5.3.2, 5.4
>
>         Attachments: tapestry-spring-3.1-fix.patch
>
>
> After upgrading to Spring 3.1, started seeing the following error with Tapestry 5.2.4.
> java.lang.RuntimeException: Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule.buildEnvironment(PerthreadManager) 
> More information at http://tapestry.1045711.n5.nabble.com/tapestry-5-2-4-and-spring-3-1M1-td4462226.html#a4742011

--
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] (TAP5-1788) Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule with Spring 3.1

Posted by "Ralf Edmund Stranzenbach (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-1788?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13219871#comment-13219871 ] 

Ralf Edmund Stranzenbach commented on TAP5-1788:
------------------------------------------------

This solution has an undesired side effect. It prevents me from using a centralized spring context that is associated as a "parent context" to the "application.xml" loaded by the tapestry-spring filter.

Only the few beans assigned to the web-app specific part of the spring configuration are therefore visible to the tapestry injector. The main part of my applications infrastructure became invisible to tapestry.

A better solution would be to either assign an implicit "namespace" to spring beans in case they duplicate a service name already used in tapestry. This would enable the use of parent spring context while preventing the duplicate "Environment" service.
                
> Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule with Spring 3.1
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-1788
>                 URL: https://issues.apache.org/jira/browse/TAP5-1788
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-spring
>    Affects Versions: 5.2.4
>            Reporter: Matt Raible
>            Assignee: Igor Drobiazko
>             Fix For: 5.3.2, 5.4
>
>         Attachments: tapestry-spring-3.1-fix.patch
>
>
> After upgrading to Spring 3.1, started seeing the following error with Tapestry 5.2.4.
> java.lang.RuntimeException: Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule.buildEnvironment(PerthreadManager) 
> More information at http://tapestry.1045711.n5.nabble.com/tapestry-5-2-4-and-spring-3-1M1-td4462226.html#a4742011

--
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] (TAP5-1788) Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule with Spring 3.1

Posted by "Matt Raible (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-1788?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13169669#comment-13169669 ] 

Matt Raible commented on TAP5-1788:
-----------------------------------

If I try to run it w/o compatibility mode, I get the following error:

org.apache.tapestry5.ioc.internal.OperationException: Error obtaining injected value for field org.appfuse.webapp.pages.admin.UserList.userManager: No service implements the interface org.appfuse.service.UserManager.

The userManager bean is initialized by Spring using annotations:

@Service("userManager")
...

<!-- Activates scanning of @Service -->
<context:component-scan base-package="org.appfuse.service"/>

Here's how I'm wiring it up in my test:

https://gist.github.com/1478384

                
> Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule with Spring 3.1
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-1788
>                 URL: https://issues.apache.org/jira/browse/TAP5-1788
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-spring
>    Affects Versions: 5.2.4
>            Reporter: Matt Raible
>
> After upgrading to Spring 3.1, started seeing the following error with Tapestry 5.2.4.
> java.lang.RuntimeException: Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule.buildEnvironment(PerthreadManager) 
> More information at http://tapestry.1045711.n5.nabble.com/tapestry-5-2-4-and-spring-3-1M1-td4462226.html#a4742011

--
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] (TAP5-1788) Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule with Spring 3.1

Posted by "Denis Stepanov (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-1788?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13247112#comment-13247112 ] 

Denis Stepanov commented on TAP5-1788:
--------------------------------------

Why not just prefix spring service ids with "spring."?
                
> Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule with Spring 3.1
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-1788
>                 URL: https://issues.apache.org/jira/browse/TAP5-1788
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-spring
>    Affects Versions: 5.2.4
>            Reporter: Matt Raible
>            Assignee: Igor Drobiazko
>             Fix For: 5.3.2, 5.4
>
>         Attachments: tapestry-spring-3.1-fix.patch
>
>
> After upgrading to Spring 3.1, started seeing the following error with Tapestry 5.2.4.
> java.lang.RuntimeException: Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule.buildEnvironment(PerthreadManager) 
> More information at http://tapestry.1045711.n5.nabble.com/tapestry-5-2-4-and-spring-3-1M1-td4462226.html#a4742011

--
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] (TAP5-1788) Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule with Spring 3.1

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

Igor Drobiazko closed TAP5-1788.
--------------------------------

       Resolution: Fixed
    Fix Version/s: 5.4
                   5.3.2

Thanks for the patch, Matt. I added some integration tests to prove that it works. Also backported the 5.3 maintenance branch.
                
> Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule with Spring 3.1
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-1788
>                 URL: https://issues.apache.org/jira/browse/TAP5-1788
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-spring
>    Affects Versions: 5.2.4
>            Reporter: Matt Raible
>            Assignee: Igor Drobiazko
>             Fix For: 5.3.2, 5.4
>
>         Attachments: tapestry-spring-3.1-fix.patch
>
>
> After upgrading to Spring 3.1, started seeing the following error with Tapestry 5.2.4.
> java.lang.RuntimeException: Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule.buildEnvironment(PerthreadManager) 
> More information at http://tapestry.1045711.n5.nabble.com/tapestry-5-2-4-and-spring-3-1M1-td4462226.html#a4742011

--
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] (TAP5-1788) Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule with Spring 3.1

Posted by "Howard M. Lewis Ship (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-1788?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13169661#comment-13169661 ] 

Howard M. Lewis Ship commented on TAP5-1788:
--------------------------------------------

It's always a challenge to make these two things fit together.  I believe you are running tapestry-spring in 5.0 compatibility mode, where it attempts to expose Spring beans as Tapestry services. 

We need to find a way to run tapestry-spring in its current mode (since 5.1), where Spring beans are injectable, but not services.  This will defuse naming collisions, such as with "Environment", but may create some other issues, depending on what is inside your Spring application context.

In some ways, I wish we had maintained the namespaced service ids that HiveMind had for Tapestry 4 (but namespaceds ids add their own complications); in the future will be services without ids, but that's a couple of release cycles away!


                
> Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule with Spring 3.1
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-1788
>                 URL: https://issues.apache.org/jira/browse/TAP5-1788
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-spring
>    Affects Versions: 5.2.4
>            Reporter: Matt Raible
>
> After upgrading to Spring 3.1, started seeing the following error with Tapestry 5.2.4.
> java.lang.RuntimeException: Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule.buildEnvironment(PerthreadManager) 
> More information at http://tapestry.1045711.n5.nabble.com/tapestry-5-2-4-and-spring-3-1M1-td4462226.html#a4742011

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