wierd stack trace regarding parsing of struts.xml
So, when I restarted my struts2 app this afternoon I got complains about unable to load configuration. - [unknown location]. But, the location of my struts.xml - inside of the classes folder of the WAR - has not changes. And, indeed, the file is there. The stack trace is below. For starters, I'm surprised to see sockets involved? 2012-11-30 20:45:28,357 WARN [pool-2-thread-1]-ejb.Ejb3Configuration: hibernate.connection.autocommit = false break the EJB3 specification 2012-11-30 20:45:58,226 ERROR [pool-2-thread-1]-commons.CommonsLogger: Dispatcher initialization failed Unable to load configuration. - [unknown location] at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:69) at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:390) at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:437) at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:193) at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:277) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:258) at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:382) at org.apache.catalina.core.ApplicationFilterConfig.init(ApplicationFilterConfig.java:103) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4638) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5294) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1566) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1556) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: Unable to load file:/DTO/EMC/IMF/apache-tomcat/catalina_base/imf/WEB-INF/classes/struts.xml - [unknown location] at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:954) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:163) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:130) at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:209) at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66) ... 17 more Caused by: Connection timed out - [unknown location] at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:115) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:949) ... 21 more Caused by: java.net.ConnectException: Connection timed out at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source) at java.net.AbstractPlainSocketImpl.connect(Unknown Source) at java.net.SocksSocketImpl.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at sun.net.NetworkClient.doConnect(Unknown Source) at sun.net.www.http.HttpClient.openServer(Unknown Source) at sun.net.www.http.HttpClient.openServer(Unknown Source) at sun.net.www.http.HttpClient.init(Unknown Source) at sun.net.www.http.HttpClient.New(Unknown Source) at sun.net.www.http.HttpClient.New(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDTDEntity(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.setInputSource(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch(Unknown Source)
RE: Struts2 Rest Plugin
I think, the basic idea was to allow cooperate the REST plugin with the Convention plugin and code behind is a deprecated plugin that will be discarded soon (with 3.x) 1) So, it doesn't depend on it, in any technical sense? 2) But it's made to work with the convention plugin, if that plugin is also installed? - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: wierd stack trace regarding parsing of struts.xml
Probably trying to go out to the web for a DTD/XSD or something? Okay. It does appear to be finding the struts.xml file, and then timing out while trying to get something else over the network. I guess my first reaction is . . . . does my struts app really need to be able to reach out onto the internet to execute ? But maybe that shows my lack of knowledge on this point. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: wierd stack trace regarding parsing of struts.xml
Without knowing what you're specifying in your struts config it's tough to say. The times I've seen this are when there's a mismatch between what's in the config and what's in the libraries, like if it can't find the file locally, it goes on to the network. So, I think the issue is that I went from webwork to struts 2.3 on this app. I did the migration a while back, and the struts.xml files still worked fine even without migrating them to the new dtd ( declarations as well as actual structure ). But in on this one installation they fail. My theory is that if the internet is available, the struts.xml with xwork DTD will still work. This makes me think that the DTD resolution must have someone of resolving the dTD from the classpath prior to hitting the web URL, but I've not had a change to investigate that yet. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: wierd stack trace regarding parsing of struts.xml
IMO it just needs to match the DTD in the jar; as I said, I've generally seen this happen when there's a mis-match. In regards to your SO question, it would depend completely on the implementation and its configuration. Here's the one that doesn't work: ?xml version=1.0 encoding=UTF-8? !DOCTYPE xwork PUBLIC -//OpenSymphony Group//XWork 1.1.1//EN http://www.opensymphony.com/xwork/xwork-1.1.1.dtd; xwork But what do you think needs to match the jar file? I mean, struts2-core.jar doesn't contain xwork-1.1.1.dtd, but the xwork jar does . . . so why wouldn't it find it if it was just taking the xwork-1.1.1.dtd and checking the classpath. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Struts2 Rest Plugin
Hi! The docs for the REST plugin talk about how it builds on the Convention plugin ( sometimes it says code behind ). However, I don't see that using the REST plugin pulls in either of these plugins . . . in what sense does it build on them? Thanks, Chad
RE: implementaiton advise on custom TextProvider
2012/10/19 Davis, Chad chad.da...@emc.com: Thanks man! I'll check it out this morning. I think the protected seems like a great idea. It's an interesting question, whether to make such things protected or private. When this is a part of framework it should be protected. In apps mostly no ;-) Because the framework components, such as ActionSupport, are intended to be extended, correct?
RE: implementaiton advise on custom TextProvider
Thanks man! I'll check it out this morning. I think the protected seems like a great idea. It's an interesting question, whether to make such things protected or private. -Original Message- From: Lukasz Lenart [mailto:lukaszlen...@apache.org] Sent: Thursday, October 18, 2012 11:59 PM To: Struts Users Mailing List Subject: Re: implementaiton advise on custom TextProvider 2012/10/18 Davis, Chad chad.da...@emc.com: Of course, and I'd even be happy to do the work. Perhaps you can advise me on a plan? Everything is ready, I'm just waiting for you to register the issue ;-) I created the ticket. Let me know if the ticket conforms with struts2 standards for ticket submission; I'll be happy to edit it. Ok, thanks! Everything is ok, please check and test my solution. Regards -- Ćukasz + 48 606 323 122 http://www.lenart.org.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: implementaiton advise on custom TextProvider
But when I start the app I get the following error, thrown when the framework tries to create the text provider bean. It seems like the framework isn't recognizing that I'm referencing a spring bean with the class attribute . . . So, I have figured this out. The TextProvider is injected outside the control of the core objectfactory. If you look at the ActionSupport class, you'll see that there is a lazy init method for acquiring the textprovider. It uses the default ContainerImpl, as injected ( by type I think ) into the action, to inject the textprovider. This means that it goes around the spring object factory for this injection. Not sure what to do. Several workarounds come to mind. Good point, could you register an issue for that ? Of course, and I'd even be happy to do the work. Perhaps you can advise me on a plan? - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: implementaiton advise on custom TextProvider
Of course, and I'd even be happy to do the work. Perhaps you can advise me on a plan? Everything is ready, I'm just waiting for you to register the issue ;-) I created the ticket. Let me know if the ticket conforms with struts2 standards for ticket submission; I'll be happy to edit it.
RE: implementaiton advise on custom TextProvider
Do you have the: constant name=struts.objectFactory value=spring/ constant defined in your struts.xml? That should be all that's needed. (*Chris*) I don't but . . . isn't that in the plugin.xml? And isn't the fact that I was able to autowire an action with a spring bean proof that the spring object factory is being used as the core factory? - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: implementaiton advise on custom TextProvider
Okay. I'm following this path. I've got the Spring Plugin in place. And it's working. I verified it by autowiring a trivial spring bean into one of my actions. But when I try to create my custom textprovider and then have it used as the framework default text provider I'm getting some initialization problems. Here's what I'm doing: 1) spring config bean id=customTextProvider class=com.mycompany.textsupport.MyTextProviderSupport/ 2) struts.xml bean type=com.opensymphony.xwork2.TextProvider name=myTextProvider class=customTextProvider scope=default / constant name=struts.xworkTextProvider value=myTextProvider/ But when I start the app I get the following error, thrown when the framework tries to create the text provider bean. It seems like the framework isn't recognizing that I'm referencing a spring bean with the class attribute . . . So, I have figured this out. The TextProvider is injected outside the control of the core objectfactory. If you look at the ActionSupport class, you'll see that there is a lazy init method for acquiring the textprovider. It uses the default ContainerImpl, as injected ( by type I think ) into the action, to inject the textprovider. This means that it goes around the spring object factory for this injection. Not sure what to do. Several workarounds come to mind. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: implementaiton advise on custom TextProvider
Spring MVC might be a consideration! (wink) On Oct 16, 2012 1:26 PM, I heard it has a pretty good integration with the whole Spring ecosystem. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: implementaiton advise on custom TextProvider
ActionSupport#getTextProviderSupport() uses the TextProviderFactory to obtain it's instance of a support object. Since it uses the di to inject this into the factory, my custom version is correctly injected. However, I need to initialize my custom support object with a resource that it needs to conduct its business. Note, the default TextPRoviderSupport also needs a couple of resources, and those are initialized in the factory's createInstance( Class class, LocaleProvider provider ). So, while I've injected my own class, there doesn't seem to be a clean way to make sure that it's initialized properly. Should I extend the factory to handle my class and init it too? Doesn't seem very DI-ish . . . hardcoding type specific init logic, I mean. Or should I create an interceptor that will inject the correct resources into my text support object? ActionSupport base on property injections so you cannot base on anything which is injectable - you cannot use getTextProvider during initialisation time (construction time). You can implement your own ActionSupport with constructor injected TextProvider that should solve your problem. I'm not sure I follow you. Just for clarity, let me restate my problem. I have written a custom extension of TextProviderSupport. I want to have it injected as the framework's default TextProvider. I have achieved this by configuring it in struts.xml, declaring my implementation with a bean/ element and then setting the constant struts.xworkTextProvider to point at my bean. This works, but my implementation needs to be properly injected. Right now, it's being created with the default no-arg constructor. How can I best have my dependencies injected when the framework creates this bean? What are my options? I restate this because it seems that you are suggesting that I override the ActionSupport base class inorder to achieve this. This seems to me to be skipping the framework and simply creating and injecting my textprovider myself. Perhaps I misunderstand.
RE: implementaiton advise on custom TextProvider
If you are using the Spring Framework with your App, you should be able to define your TextProvider, with all it's dependencies, as a Spring Bean, then when you define the bean in Struts use the Spring Bean ID instead of using the full class name. Struts will use that Spring Bean in place of creating a new one. (*Chris*) So, you're saying that I can use the Spring plugin's Spring DI to configure framework components? I was under the impression that I had to use the framework's internal DI for such things . . . - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: implementaiton advise on custom TextProvider
If you are using the Spring Framework with your App, you should be able to define your TextProvider, with all it's dependencies, as a Spring Bean, then when you define the bean in Struts use the Spring Bean ID instead of using the full class name. Struts will use that Spring Bean in place of creating a new one. (*Chris*) Okay. I'm following this path. I've got the Spring Plugin in place. And it's working. I verified it by autowiring a trivial spring bean into one of my actions. But when I try to create my custom textprovider and then have it used as the framework default text provider I'm getting some initialization problems. Here's what I'm doing: 1) spring config bean id=customTextProvider class=com.mycompany.textsupport.MyTextProviderSupport/ 2) struts.xml bean type=com.opensymphony.xwork2.TextProvider name=myTextProvider class=customTextProvider scope=default / constant name=struts.xworkTextProvider value=myTextProvider/ But when I start the app I get the following error, thrown when the framework tries to create the text provider bean. It seems like the framework isn't recognizing that I'm referencing a spring bean with the class attribute . . . 2012-10-15 15:41:39,763 ERROR [pool-2-thread-1]-commons.CommonsLogger: Dispatcher initialization failed Unable to load configuration. - bean - file:/opt/apache-tomcat/catalina_base/imf/WEB-INF/classes/struts.xml:8:119 at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:69) at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:390) at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:437) at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:193) at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:277) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:258) at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:382) at org.apache.catalina.core.ApplicationFilterConfig.init(ApplicationFilterConfig.java:103) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4638) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5294) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1566) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1556) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: Unable to load bean: type:com.opensymphony.xwork2.TextProvider class: customTextProvider - bean - file:/opt/apache-tomcat/catalina_base/imf/WEB-INF/classes/struts.xml:8:119 at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:243) at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:102) at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:210) at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66) ... 17 more Caused by: java.lang.ClassNotFoundException: customTextProvider at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1711) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556) at com.opensymphony.xwork2.util.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:152) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:214) - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: overriding framework components
Here you have the full list of extension points http://struts.apache.org/2.x/docs/plugins.html#Plugins-ExtensionPoints Excellent. Thank you. And, since I think I saw your name on some comments in the TextProvider, I wonder what constructors get invoked when the TextProvider is injected in the TextProviderFactory on ActionSupport. The default TextProviderSupport has references to locale provider and a class, which can be set via a constructor. But I suspect the DI must only use the parameterless constructor. Is this true? In what cases do those other constructors get invoked?
implementaiton advise on custom TextProvider
So, I want to have the framework use my own custom TextProvider. Since the framework uses DI to inject such things, I've been able to have my own custom TextProvider injected into the system. Now, I'm encountering some other issues related to how to correctly initialize my custom provider. ActionSupport#getTextProviderSupport() uses the TextProviderFactory to obtain it's instance of a support object. Since it uses the di to inject this into the factory, my custom version is correctly injected. However, I need to initialize my custom support object with a resource that it needs to conduct its business. Note, the default TextPRoviderSupport also needs a couple of resources, and those are initialized in the factory's createInstance( Class class, LocaleProvider provider ). So, while I've injected my own class, there doesn't seem to be a clean way to make sure that it's initialized properly. Should I extend the factory to handle my class and init it too? Doesn't seem very DI-ish . . . hardcoding type specific init logic, I mean. Or should I create an interceptor that will inject the correct resources into my text support object? - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: overriding framework components
2012/10/4 Davis, Chad chad.da...@emc.com: And, since I think I saw your name on some comments in the TextProvider, I wonder what constructors get invoked when the TextProvider is injected in the TextProviderFactory on ActionSupport. The default TextProviderSupport has references to locale provider and a class, which can be set via a constructor. But I suspect the DI must only use the parameterless constructor. Is this true? In what cases do those other constructors get invoked? Yeah, it was my first bigger addition to Struts 2 ;-) It isn't an optimal one ;-) Hey, no apologies needed. Beggars can't be choosers ;) The struts 2 code is some of the best code I work with . . . so I'm not complaining. Anyway, you're right. DI will use the default constructor, the others are used in other places (TextProviderFactory and ) - that's why it isn't an optimal solution. DI supports also constructor injections, in the same way as property injection, just add @Inject to constructor. I'll check this out and get back to you. There's another bit, a complication perhaps, in that I'm trying to extend the ActionSupport, not replace it. My use case is that some folks before my time wrote their own i18n layer instead of using the framework's and I want to layer those text lookups in front of the framework's own. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
overriding framework components
I want to override the framework's built in TextProvider with my own. I understand that I need to add mine as a bean in my strut.xml, but something about the precise mechanics is eluding me. For starters, this is from struts-default.xml bean type=com.opensymphony.xwork2.TextProvider name=xwork1 class=com.opensymphony.xwork2.TextProviderSupport scope=default / bean type=com.opensymphony.xwork2.TextProvider name=struts class=com.opensymphony.xwork2.TextProviderSupport scope=default / And my struts.xml bean element: bean type=com.opensymphony.xwork2.TextProvider name=myProvider class=com.mycompany.struts2.MyTextProviderSupport scope=default / This doesn't appear to get my provider injected into the framework. What am I doing wrong? - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: overriding framework components
I guess I need to map a constant value to my bean, but where do I find that constant name? -Original Message- From: Davis, Chad [mailto:chad.da...@emc.com] Sent: Wednesday, October 03, 2012 10:55 AM To: user@struts.apache.org Subject: overriding framework components I want to override the framework's built in TextProvider with my own. I understand that I need to add mine as a bean in my strut.xml, but something about the precise mechanics is eluding me. For starters, this is from struts-default.xml bean type=com.opensymphony.xwork2.TextProvider name=xwork1 class=com.opensymphony.xwork2.TextProviderSupport scope=default / bean type=com.opensymphony.xwork2.TextProvider name=struts class=com.opensymphony.xwork2.TextProviderSupport scope=default / And my struts.xml bean element: bean type=com.opensymphony.xwork2.TextProvider name=myProvider class=com.mycompany.struts2.MyTextProviderSupport scope=default / This doesn't appear to get my provider injected into the framework. What am I doing wrong? - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: overriding framework components
Ok. I found it in the javadoc for TextProvider bean type=com.opensymphony.xwork2.TextProvider name=myProvider class=com.mycompany.struts2.MyTextProviderSupport scope=default/ constant name=struts.xworkTextProvider value=myProvider/ This works. -Original Message- From: Davis, Chad [mailto:chad.da...@emc.com] Sent: Wednesday, October 03, 2012 12:47 PM To: Struts Users Mailing List Subject: RE: overriding framework components I guess I need to map a constant value to my bean, but where do I find that constant name? -Original Message- From: Davis, Chad [mailto:chad.da...@emc.com] Sent: Wednesday, October 03, 2012 10:55 AM To: user@struts.apache.org Subject: overriding framework components I want to override the framework's built in TextProvider with my own. I understand that I need to add mine as a bean in my strut.xml, but something about the precise mechanics is eluding me. For starters, this is from struts-default.xml bean type=com.opensymphony.xwork2.TextProvider name=xwork1 class=com.opensymphony.xwork2.TextProviderSupport scope=default / bean type=com.opensymphony.xwork2.TextProvider name=struts class=com.opensymphony.xwork2.TextProviderSupport scope=default / And my struts.xml bean element: bean type=com.opensymphony.xwork2.TextProvider name=myProvider class=com.mycompany.struts2.MyTextProviderSupport scope=default / This doesn't appear to get my provider injected into the framework. What am I doing wrong? - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Struts 2 Iterator, Param and Text tags usage
I'm trying to figure out how iterate over a collection of parameters to pump into a text tag. This is what I would like to do: s:text name=%{eventtype.i18nkey} s:iterator value=messageParameters s:params:property//s:param /s:iterator /s:text But it blows up and writes some stuff to the tomcat logs that appears to suggest I'm using the tag wrong ;) java.lang.NullPointerException at com.opensymphony.xwork2.util.TextParseUtil.translateVariables(TextParseUtil.java:168) at com.opensymphony.xwork2.util.TextParseUtil.translateVariables(TextParseUtil.java:115) at com.opensymphony.xwork2.util.TextParseUtil.translateVariables(TextParseUtil.java:88) at org.apache.struts2.components.Component.findValue(Component.java:381) at org.apache.struts2.components.Component.findString(Component.java:203) at org.apache.struts2.components.Param.end(Param.java:121) - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: Injecting Static/Mock Resources into my Struts 2 Actions
I do this all the time. Then I'm not crazy ;) Not sure what experiences you're looking for; if the data is _very_ complex it may be easier to just embed a DB and load it up with DBUnit or something like that. It's not the data that's complex so much as the whole distributed system that needs to be in place for the business objects to make actual queries . . . Basically any tutorial that talks about testing in Spring is applicable, the only difference is the MVC layer. I think I understand the Spring portion of this well enough. One thing, however, that I'm not straight on is the build / deployment portion. This is clearly off topic, for this list, but I wonder how to automate the spring config for the various deployment enivonments. We have a maven build, and I'd like to use the build to configure the injections for the correct deployment target . . . but I'm leery of getting cross wise with Maven. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: Injecting Static/Mock Resources into my Struts 2 Actions
bean id=MockedService name=MockedService class=org.easymock.EasyMock factory-method=createStrictMock constructor-arg value=Interface.for.the.Service/ /bean How do you control the correct injections for the various deployments? Do you automate that with the build? Scripted? - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Injecting Static/Mock Resources into my Struts 2 Actions
I would like to deploy my app to a UI testing / demo environment. In this environment, the regular business logic objects would be replaced ( via DI ) with mock implementations of those resources. These mocks would return a static data set, thus giving a predictable behavior against which we can build automated UI tests, provide a lightweight demo environment that doesn't need integrated into our rather large and complex real world data context, etc. My thoughts are to use the Spring integration to inject the mocks. I'm new to doing DI / testing in this kind of setting. Is anyone doing something like this? Can you share some experiences? - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org