You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by tm jee <tm...@yahoo.co.uk> on 2006/11/15 17:36:00 UTC

[s2] WW-1506

Hi guys, 

Found a possible bug with Struts2 DI feature. Opened up a jira issue for it (WW-1508). Leaving the issue open for reviews. Don if you got the time to have a look, it would be great.

cheers

 Send instant messages to your online friends http://uk.messenger.yahoo.com 

Re: [s2] WW-1506

Posted by tm jee <tm...@yahoo.co.uk>.
Hi Don,

Do you mean 

@Inject(required=false)
public static void setFreemarkerManager(FreemarkerManager mgr) {
...
}

I'll give it a go and report back.

cheers.

Don Brown <mr...@twdata.org> wrote: I'm glad you found this problem.  However, I think it could be easier 
solved by marking the injections in the freemarker and velocity page 
filters as "required=false", and then complain very loudly if the 
filters are used by not initialized.  Then, we wouldn't need all the 
changes to xwork and guice.  In particular, I'd like to avoid changing 
the Guice source code if all possible to facilitate easier 
synchronization with the original project.

Could you back out the changes and try the required="false" approach?

Thanks,

Don

tm jee wrote:
> Hi guys, 
>
> Found a possible bug with Struts2 DI feature. Opened up a jira issue for it (WW-1508). Leaving the issue open for reviews. Don if you got the time to have a look, it would be great.
>
> cheers
>
>  Send instant messages to your online friends http://uk.messenger.yahoo.com 
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org



 Send instant messages to your online friends http://uk.messenger.yahoo.com 

Re: [s2] WW-1506

Posted by tm jee <tm...@yahoo.co.uk>.
Hi Don,

I've reverted the changes on my local box, and tried out with 
@Inject(required=false), when starting jetty using mvn jetty:run, it seems to be giving me the following stack

Should I commit back the reverted changes. Can't figure out a way to fix this without doing changes to the DI Container.

2006-11-15 19:22:43,901 INFO  [StrutsSpringObjectFactory.java:94] : ... initialized Struts-Spring integration successfully
2006-11-15 19:22:43.935::WARN:  failed action2-cleanup
2006-11-15 19:22:43.935::WARN:  failed ContextHandler@1474e45{/myApp,file:/home/tmjee/development/temp/myApp/src/main/webapp/}
2006-11-15 19:22:43.935::WARN:  failed ContextHandlerCollection@63a721
2006-11-15 19:22:43.935::WARN:  failed HandlerCollection@719f1f
2006-11-15 19:22:44.162::INFO:  Started SelectChannelConnector @ 0.0.0.0:8080
2006-11-15 19:22:44.163::WARN:  failed Server@166340c
[INFO] Jetty server exiting.
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] org/apache/velocity/context/Context
[INFO] ------------------------------------------------------------------------
[INFO] Trace
java.lang.NoClassDefFoundError: org/apache/velocity/context/Context
        at java.lang.Class.getDeclaredConstructors0(Native Method)
        at java.lang.Class.privateGetDeclaredConstructors(Class.java:2328)
        at java.lang.Class.getDeclaredConstructors(Class.java:1808)
        at com.opensymphony.xwork2.inject.ContainerImpl$ConstructorInjector.findConstructorIn(ContainerImpl.java:313)
        at com.opensymphony.xwork2.inject.ContainerImpl$ConstructorInjector.<init>(ContainerImpl.java:291)
        at com.opensymphony.xwork2.inject.ContainerImpl$5.create(ContainerImpl.java:277)
        at com.opensymphony.xwork2.inject.ContainerImpl$5.create(ContainerImpl.java:276)
        at com.opensymphony.xwork2.inject.util.ReferenceCache$CallableCreate.call(ReferenceCache.java:155)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
        at java.util.concurrent.FutureTask.run(FutureTask.java:123)
        at com.opensymphony.xwork2.inject.util.ReferenceCache.internalCreate(ReferenceCache.java:81)
        at com.opensymphony.xwork2.inject.util.ReferenceCache.get(ReferenceCache.java:121)
        at com.opensymphony.xwork2.inject.ContainerImpl.getConstructor(ContainerImpl.java:534)
        at com.opensymphony.xwork2.inject.ContainerBuilder$5.create(ContainerBuilder.java:207)
        at com.opensymphony.xwork2.inject.Scope$2$1.create(Scope.java:49)
        at com.opensymphony.xwork2.inject.ContainerImpl$ParameterInjector.inject(ContainerImpl.java:407)
        at com.opensymphony.xwork2.inject.ContainerImpl.getParameters(ContainerImpl.java:422)
        at com.opensymphony.xwork2.inject.ContainerImpl.access$000(ContainerImpl.java:42)
        at com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:266)
        at com.opensymphony.xwork2.inject.ContainerImpl$2.call(ContainerImpl.java:95)
        at com.opensymphony.xwork2.inject.ContainerImpl$2.call(ContainerImpl.java:93)
        at com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:514)
        at com.opensymphony.xwork2.inject.ContainerImpl.injectStatics(ContainerImpl.java:92)
        at com.opensymphony.xwork2.inject.ContainerBuilder.create(ContainerBuilder.java:494)
        at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reload(DefaultConfiguration.java:139)
        at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:52)
        at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:339)
        at org.apache.struts2.dispatcher.Dispatcher.<init>(Dispatcher.java:198)
        at org.apache.struts2.dispatcher.AbstractFilter.createDispatcher(AbstractFilter.java:153)
        at org.apache.struts2.dispatcher.AbstractFilter.init(AbstractFilter.java:111)
        at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:95)
        at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:38)
        at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:545)
        at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1133)
        at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:420)
        at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:457)
        at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:38)
        at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:156)
        at org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:120)
        at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:38)
        at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:156)
        at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:38)
        at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:119)
        at org.mortbay.jetty.Server.doStart(Server.java:210)
        at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:38)
        at org.mortbay.jetty.plugin.Jetty6PluginServer.start(Jetty6PluginServer.java:134)
        at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:327)
        at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:272)
        at org.mortbay.jetty.plugin.AbstractJettyRunMojo.execute(AbstractJettyRunMojo.java:177)
        at org.mortbay.jetty.plugin.Jetty6RunMojo.execute(Jetty6RunMojo.java:183)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:412)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:534)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:488)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:458)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:306)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:273)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:140)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:256)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11 seconds
[INFO] Finished at: Wed Nov 15 19:22:44 EST 2006
[INFO] Final Memory: 6M/12M
[INFO] ------------------------------------------------------------------------
2006-11-15 19:22:44.590::INFO:  Shutdown hook executing
2006-11-15 19:22:44.590::INFO:  Shutdown hook complete
tmjee@tmjee-laptop:~/development/temp/myApp$

Cheers



Don Brown <mr...@twdata.org> wrote: I'm glad you found this problem.  However, I think it could be easier 
solved by marking the injections in the freemarker and velocity page 
filters as "required=false", and then complain very loudly if the 
filters are used by not initialized.  Then, we wouldn't need all the 
changes to xwork and guice.  In particular, I'd like to avoid changing 
the Guice source code if all possible to facilitate easier 
synchronization with the original project.

Could you back out the changes and try the required="false" approach?

Thanks,

Don

tm jee wrote:
> Hi guys, 
>
> Found a possible bug with Struts2 DI feature. Opened up a jira issue for it (WW-1508). Leaving the issue open for reviews. Don if you got the time to have a look, it would be great.
>
> cheers
>
>  Send instant messages to your online friends http://uk.messenger.yahoo.com 
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org



 Send instant messages to your online friends http://uk.messenger.yahoo.com 
 Send instant messages to your online friends http://uk.messenger.yahoo.com 

Re: [s2] WW-1506

Posted by Don Brown <mr...@twdata.org>.
I'm glad you found this problem.  However, I think it could be easier 
solved by marking the injections in the freemarker and velocity page 
filters as "required=false", and then complain very loudly if the 
filters are used by not initialized.  Then, we wouldn't need all the 
changes to xwork and guice.  In particular, I'd like to avoid changing 
the Guice source code if all possible to facilitate easier 
synchronization with the original project.

Could you back out the changes and try the required="false" approach?

Thanks,

Don

tm jee wrote:
> Hi guys, 
>
> Found a possible bug with Struts2 DI feature. Opened up a jira issue for it (WW-1508). Leaving the issue open for reviews. Don if you got the time to have a look, it would be great.
>
> cheers
>
>  Send instant messages to your online friends http://uk.messenger.yahoo.com 
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org