hello
Here is my problem :
I have an web.xml file witch have this passage where I specify a root of the aplication and 2 struts-config.xml files
the new-struts-config-erp.xml extends all the struts-config.xml files from every module
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/erp/new-struts-config-erp.xml,
/WEB-INF/erp/other/struts-config.xml
##ERPSTS_STRUTS_MODULES##
</param-value>
and then I tried to make a JUnit test for some java file in my application whitch extends MockStrutsTestCase and where I
need to specify a module..the problem is that the file I intend to test is in the root and It seem logic to me that
method setConfigFile(myModule,"/WEB-INF/struts-config.xml")
should look like this
setConfigFile("","/WEB-INF/erp/new-struts-config-erp.xml");
setRequestPathInfo("","/SpSarbatori.do");
apparently it s wrong the struts doesn t manage to initialize the servlet because struts doesn t find the struts-config file that I specify
the error is the folowing: he is tring to find the struts config ,he doesn t find it and by default he looks in WEB-INF: the error log is the following:
------------- Standard Output ---------------
ERROR [main] - Missing configuration resource for path /WEB-INF/struts-config.xml
ERROR [main] - Error initializing action servlet
javax.servlet.UnavailableException: Missing configuration resource for path /WEB-INF/struts-config.xml
at org.apache.struts.action.ActionServlet.parseModuleConfigFile(ActionServlet.java:732)
at org.apache.struts.action.ActionServlet.initModuleConfig(ActionServlet.java:687)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:333)
at ro.uti.waf.web.JPortalActionServlet.init(JPortalActionServlet.java:31)
at javax.servlet.GenericServlet.init(GenericServlet.java:211)
at servletunit.struts.MockStrutsTestCase.getActionServlet(MockStrutsTestCase.java:303)
at test.userservice.action.LoginTest.setUp(LoginTest.java:37)
at junit.framework.TestCase.runBare(TestCase.java:125)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:297)
at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:672)
at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:567)
------------- ---------------- ---------------
Testcase: testAddDebt(test.src.main.java.command.SpSarbatoriLegaleAdd): FAILED
Missing configuration resource for path /WEB-INF/struts-config.xml
junit.framework.AssertionFailedError: Missing configuration resource for path /WEB-INF/struts-config.xml
at servletunit.struts.MockStrutsTestCase.getActionServlet(MockStrutsTestCase.java:321)
at test.userservice.action.LoginTest.setUp(LoginTest.java:37)
My question is how can I manage to write correctly this method??
setConfigFile("","/WEB-INF/erp/new-struts-config-erp.xml");???
any suggestion would mean a lot to me
best regards
Here is my problem :
I have an web.xml file witch have this passage where I specify a root of the aplication and 2 struts-config.xml files
the new-struts-config-erp.xml extends all the struts-config.xml files from every module
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/erp/new-struts-config-erp.xml,
/WEB-INF/erp/other/struts-config.xml
##ERPSTS_STRUTS_MODULES##
</param-value>
and then I tried to make a JUnit test for some java file in my application whitch extends MockStrutsTestCase and where I
need to specify a module..the problem is that the file I intend to test is in the root and It seem logic to me that
method setConfigFile(myModule,"/WEB-INF/struts-config.xml")
should look like this
setConfigFile("","/WEB-INF/erp/new-struts-config-erp.xml");
setRequestPathInfo("","/SpSarbatori.do");
apparently it s wrong the struts doesn t manage to initialize the servlet because struts doesn t find the struts-config file that I specify
the error is the folowing: he is tring to find the struts config ,he doesn t find it and by default he looks in WEB-INF: the error log is the following:
------------- Standard Output ---------------
ERROR [main] - Missing configuration resource for path /WEB-INF/struts-config.xml
ERROR [main] - Error initializing action servlet
javax.servlet.UnavailableException: Missing configuration resource for path /WEB-INF/struts-config.xml
at org.apache.struts.action.ActionServlet.parseModuleConfigFile(ActionServlet.java:732)
at org.apache.struts.action.ActionServlet.initModuleConfig(ActionServlet.java:687)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:333)
at ro.uti.waf.web.JPortalActionServlet.init(JPortalActionServlet.java:31)
at javax.servlet.GenericServlet.init(GenericServlet.java:211)
at servletunit.struts.MockStrutsTestCase.getActionServlet(MockStrutsTestCase.java:303)
at test.userservice.action.LoginTest.setUp(LoginTest.java:37)
at junit.framework.TestCase.runBare(TestCase.java:125)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:297)
at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:672)
at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:567)
------------- ---------------- ---------------
Testcase: testAddDebt(test.src.main.java.command.SpSarbatoriLegaleAdd): FAILED
Missing configuration resource for path /WEB-INF/struts-config.xml
junit.framework.AssertionFailedError: Missing configuration resource for path /WEB-INF/struts-config.xml
at servletunit.struts.MockStrutsTestCase.getActionServlet(MockStrutsTestCase.java:321)
at test.userservice.action.LoginTest.setUp(LoginTest.java:37)
My question is how can I manage to write correctly this method??
setConfigFile("","/WEB-INF/erp/new-struts-config-erp.xml");???
any suggestion would mean a lot to me
best regards