|
Hi,
I use Spring in tapestry via spring-tapestry module (org.apache.tapestry5.spring.TapestrySpringFilter filter class) and tapestry.use-external-spring-context set to true, because I need to have Spring beans exposed as tapestry services for injection into pages and services After upgrading Spring 3.1M1 this stopped work with error: service with id "environment" already defined... which is probably caused by Spring 3.1 introducing internal bean called environment. Question is how these two make work again... so far I thought along these lines: 1) rename Tapestry environment service which is defined in TapestryModule - Is it possible ? How? 2) rename Spring internal environment bean ok, I will ask this on Spring forum :) 3) if neither of above possible, modify spring-tapestry module code to silently swallow exception when exporting spring beans as tapestry service - I really do not need spring internal environment bean exposed as a tapestry service a I think that spring beans are exposed after Tapestry own services (so Tapestry environment service will be first) Any thoughts? Or should this be asked on dev list or entered into JIRA? Thanks, Jan |
|
actually tapestry-spring integration with external context set tu True uses
BeanFactoryUtils.beanNamesIncludingAncestors(context) to get list of beans to be exported as tapestry services. Maybe it should use just context.getBeanDefinitionNames() because starting with Spring 3.1 the former returns also bean named "environment" and tapestry then crashes with: SEVERE: Exception starting filter app java.lang.RuntimeException: Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule.buildEnvironment(PerthreadManager) (at TapestryModule.java:2686) and may not be redefined by org.apache.tapestry5.internal.spring.SpringBeanServiceDef@6f0294. You should rename one of the service builder methods. at org.apache.tapestry5.ioc.internal.RegistryImpl.<init>(RegistryImpl.java:208) at org.apache.tapestry5.ioc.RegistryBuilder.build(RegistryBuilder.java:170) at org.apache.tapestry5.internal.TapestryAppInitializer.createRegistry(TapestryAppInitializer.java:214) at org.apache.tapestry5.TapestryFilter.init(TapestryFilter.java:95) |
|
Are there any plans to fix the Tapestry-Spring integration to fix this issue?
java.lang.RuntimeException: Service id 'environment' has already been defined by org.apache.tapestry5.services.TapestryModule.buildEnvironment(PerthreadManager) I'm seeing it myself after trying to upgrade to Spring 3.1. |
|
In reply to this post by zelenka.jan@gmail.com
On Tue, 13 Dec 2011 16:50:51 -0200, [hidden email]
<[hidden email]> wrote: > Are there any plans to fix the Tapestry-Spring integration to fix this > issue? > > java.lang.RuntimeException: Service id 'environment' has already been > defined by > org.apache.tapestry5.services.TapestryModule.buildEnvironment(PerthreadManager) > > I'm seeing it myself after trying to upgrade to Spring 3.1. Hi, Matt! I couldn't find any JIRA posted for this issue. Please post one and we'll fix it. Please include this link as it suggests some solutions: http://tapestry.1045711.n5.nabble.com/tapestry-5-2-4-and-spring-3-1M1-td4462226.html#a4742011 -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] |
|
Thanks for the fast response! Created at https://issues.apache.org/jira/browse/TAP5-1788.
|
|
In reply to this post by zelenka.jan@gmail.com
On Tue, 13 Dec 2011 17:25:13 -0200, [hidden email]
<[hidden email]> wrote: > Thanks for the fast response! Someone once compared this list to an IRC channel . . . :P > Created at https://issues.apache.org/jira/browse/TAP5-1788. Thanks! By the way, have you checked Tapestry 5.3? -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] |
|
On Dec 13, 2011, at 12:40 PM, Thiago H de Paula Figueiredo [via Tapestry] wrote: On Tue, 13 Dec 2011 17:25:13 -0200, <a href="x-msg://111/user/SendEmail.jtp?type=node&node=5072521&i=0" target="_top" rel="nofollow" link="external">[hidden email] If I try 5.3, I get a whole new error: Tests in error: testListUsers(org.appfuse.webapp.pages.admin.UserListTest): Context attribute is not of type WebApplicationContext: org.springframework.context.support.GenericApplicationContext@48a77106: startup date [Tue Dec 13 12:49:44 MST 2011]; root of context hierarchy Here's how I'm trying to create a Spring-aware PageTester in my application: @ContextConfiguration(locations = { "classpath:/applicationContext-resources.xml", "classpath:/applicationContext-dao.xml", "classpath:/applicationContext-service.xml", "classpath*:/applicationContext.xml", "/WEB-INF/applicationContext*.xml"}) public abstract class BasePageTestCase extends AbstractTransactionalJUnit4SpringContextTests { protected PageTester tester; protected Document doc; protected Map<String, String> fieldValues; protected final Log log = LogFactory.getLog(getClass()); protected static final String MESSAGES = Constants.BUNDLE_KEY; private int smtpPort = 25250; @Before public void onSetUp() { String appPackage = "org.appfuse.webapp"; String appName = "app"; final MockServletContext servletContext = new MockServletContext(""); servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, applicationContext); servletContext.addInitParameter(SpringConstants.USE_EXTERNAL_SPRING_CONTEXT, "true"); tester = new PageTester(appPackage, appName, "src/main/webapp") { @Override protected ModuleDef[] provideExtraModuleDefs() { return new ModuleDef[]{new SpringModuleDef(servletContext)}; } }; |
I was able to fix this issue (and the above error for 5.3) with the following patch: Index: tapestry-spring/src/main/java/org/apache/tapestry5/internal/spring/SpringModuleDef.java =================================================================== --- tapestry-spring/src/main/java/org/apache/tapestry5/internal/spring/SpringModuleDef.java (revision 1214516) +++ tapestry-spring/src/main/java/org/apache/tapestry5/internal/spring/SpringModuleDef.java (working copy) @@ -78,7 +78,9 @@ */ protected ApplicationContext locateApplicationContext(ServletContext servletContext) { - ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(servletContext); + ApplicationContext context = (ApplicationContext) servletContext + .getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE); if (context == null) { @@ -153,7 +155,7 @@ private void addServiceDefsForSpringBeans(ApplicationContext context) { - for (final String beanName : BeanFactoryUtils.beanNamesIncludingAncestors(context)) + for (final String beanName : context.getBeanDefinitionNames()) { String trueName = beanName.startsWith("&") ? beanName.substring(1) : beanName; |
|
In reply to this post by zelenka.jan@gmail.com
On Wed, 14 Dec 2011 21:16:45 -0200, [hidden email]
<[hidden email]> wrote: > I was able to fix this issue (and the above error for 5.3) with the > following patch: Hi, Matt! Nice! :) Could you please attach this patch to the JIRA issue you've opened? -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] |
|
Fixed in trunk and 5.3 branch.
On Thu, Dec 15, 2011 at 12:54 AM, Thiago H. de Paula Figueiredo < [hidden email]> wrote: > On Wed, 14 Dec 2011 21:16:45 -0200, [hidden email] < > [hidden email]> wrote: > > I was able to fix this issue (and the above error for 5.3) with the >> following patch: >> > > Hi, Matt! > > Nice! :) > > Could you please attach this patch to the JIRA issue you've opened? > > > -- > Thiago H. de Paula Figueiredo > Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, > and instructor > Owner, Ars Machina Tecnologia da Informação Ltda. > http://www.arsmachina.com.br > > ------------------------------**------------------------------**--------- > To unsubscribe, e-mail: users-unsubscribe@tapestry.**apache.org<[hidden email]> > For additional commands, e-mail: [hidden email] > > -- Best regards, Igor Drobiazko http://tapestry5.de |
|
glad to see this one is fixed,
Thanks, Jan On Thu, Dec 15, 2011 at 11:35 AM, Igor Drobiazko [via Tapestry] <[hidden email]> wrote: Fixed in trunk and 5.3 branch. |
|
In reply to this post by Igor Drobiazko
I'd like to use a snapshot of 5.3.2 in my project. According to the documentation:
However, if I look in: https://repository.apache.org/content/groups/snapshots/org/apache/tapestry/tapestry-core/ I don't see a 5.3.2-SNAPSHOT version. Am I looking in the right location? Thanks, Matt |
|
No snapshots are available because our build is currently broken. We are
working on it. On Fri, Jan 6, 2012 at 4:44 AM, [hidden email] < [hidden email]> wrote: > I'd like to use a snapshot of 5.3.2 in my project. According to the > documentation: > > > > > A nightly build process on Tapestry's continuous integration server > > creates new snapshots every night. > > > > Snapshots don't go in the central Maven repository (that's reserved for > > full releases). Instead, they go into the Tapestry snapshots repository > at > > http://repository.apache.org/snapshots/. > > > > However, if I look in: > > > https://repository.apache.org/content/groups/snapshots/org/apache/tapestry/tapestry-core/ > > I don't see a 5.3.2-SNAPSHOT version. Am I looking in the right location? > > Thanks, > > Matt > > -- > View this message in context: > http://tapestry.1045711.n5.nabble.com/tapestry-5-2-4-and-spring-3-1M1-tp4462226p5124561.html > Sent from the Tapestry - User mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [hidden email] > For additional commands, e-mail: [hidden email] > > -- Best regards, Igor Drobiazko http://tapestry5.de http://twitter.com/drobiazko |
| Powered by Nabble | Edit this page |
