Hi, Maybe this [1] could help? And you can always ask your question on "Struts Users Mailing List" <[email protected]> or "Struts Developers List" <[email protected]>.
[1] https://svn.apache.org/repos/asf/struts/struts2/trunk/plugins/cdi/src/test/java/org/apache/struts2/cdi/CdiObjectFactoryTest.java Regards -- Łukasz mobile +48 606 323 122 http://www.lenart.org.pl/ Warszawa JUG conference - Confitura http://confitura.pl/ 2013/6/11 Francisco Dominguez <[email protected]>: > Lukas, > > My action class works in the web app but when I attempt to write a unit test > for an action class but i keep on getting the following exception: > > Unable to instantiate Action, com.company.action.CompanyAction, defined for > 'company' in namespace '/'null > at > com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:316) > at > com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:397) > at > com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:194) > at > org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63) > at > org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39) > at > com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58) > at > org.apache.struts2.StrutsTestCase.getActionProxy(StrutsTestCase.java:137) > at > com.company.action.CompanyActionTest.testIndex(CompanyActionTest.java:71) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at > org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83) > at org.junit.runner.JUnitCore.run(JUnitCore.java:157) > at > com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:77) > at > com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:195) > at > com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) > at > com.intellij.rt.execution.application.AppMain.main(AppMain.java:120) > Caused by: java.lang.NullPointerException > at > org.apache.struts2.cdi.CdiObjectFactory.getInjectionTarget(CdiObjectFactory.java:184) > at > org.apache.struts2.cdi.CdiObjectFactory.buildBean(CdiObjectFactory.java:160) > at > com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:151) > at > com.opensymphony.xwork2.ObjectFactory.buildAction(ObjectFactory.java:121) > at > com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:297) > ... 29 more > > The problems seems to be the combination of struts2 cdi and struts2 junit > plugin. > > I attempting to use the Struts2 junit plugin with the convention and cdi > plugins. > > I am kind of confused. There does not seem to be a easy forum to post > questions to. Any help is appreciated. > > thanks > francisco > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
