You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Anthony Mutiso 2 <an...@utilitynet.net> on 2002/10/22 17:30:34 UTC

making struts and velocity share the same datasource

Hi folks,

I am trying to use velocity templates from a database within a struts
application. I have configured velocity to use the
"org.apache.velocity.runtime.resource.loader.DataSourceResourceLoader"
resouce loader, but my templates are never found. I suspect this is because
I cannot tell velocity the correct name of the datasource.

Anyone have some insight as to how to configure velocity to find the same
datasouce that struts is using. My struts config has the typical 

<data-sources>
  <data-source>
   <set-property property="description" value="App Name"/>
   <!--<set-property property="key" value="Myapp"/>-->
   <set-property property="driverClass" value="my.data.driver"/>
   <set-property property="url" value="jdbc:my.db.url"/>
   <set-property property="user" value="myuser"/>
   <set-property property="password" value="mypassword"/>
  </data-source>
<data-sources>

On a secondary issue: If I se the data-source key property to a string, say
"MyAppDataSource" and use it in my Action classes to get the datasource, it
fails. If it use the default name "Action.DATA_SOURCE_KEY" it works. Why am
I not able to use my own name.

I am using struts 1.1-b2

Thanks for the help.

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


No action instance for path /html/LogonAction could be created

Posted by Vikas Malla <ma...@yahoo.co.in>.
Consequently, I am getting this error in my junit test:
    [junit] was expecting '/app/html/index.jsp' but received '/appnull'
    [junit] junit.framework.AssertionFailedError: was expecting '/awf/html/index
.jsp?s=2' but received '/awfnull'
    [junit]     at servletunit.struts.Common.verifyForwardPath(Common.java:104)
    [junit]     at servletunit.struts.CactusStrutsTestCase.verifyForward(CactusS
trutsTestCase.java:418)
    [junit]     at MyTest.testSuccessfulLogin(Unkno
wn Source)
    [junit]     at org.apache.cactus.AbstractTestCase.runServerTest(AbstractTest
Case.java:332)
    [junit]     at org.apache.cactus.AbstractTestCase.runBareServerTest(Abstract
TestCase.java:235)
    [junit]     at org.apache.cactus.server.AbstractWebTestCaller.doTest(Abstrac
tWebTestCaller.java:149)
    [junit]     at org.apache.cactus.server.AbstractWebTestController.dispatch87
_handleRequest(AbstractWebTestController.java;org/apache/cactus/util/log/LogAspe
ct.aj(1k):125)
    [junit]     at org.apache.cactus.server.AbstractWebTestController.around87_h
andleRequest(AbstractWebTestController.java;org/apache/cactus/util/log/LogAspect
.aj(1k):1149)
    [junit]     at org.apache.cactus.server.AbstractWebTestController.handleRequ
est(AbstractWebTestController.java;org/apache/cactus/util/log/LogAspect.aj(1k):1
01)
    [junit]     at org.apache.cactus.server.ServletTestRedirector.dispatch113_do
Post(ServletTestRedirector.java;org/apache/cactus/util/log/LogAspect.aj(1k):123)
    [junit]     at org.apache.cactus.server.ServletTestRedirector.around113_doPo
st(ServletTestRedirector.java;org/apache/cactus/util/log/LogAspect.aj(1k):1149)
    [junit]     at org.apache.cactus.server.ServletTestRedirector.doPost(Servlet
TestRedirector.java;org/apache/cactus/util/log/LogAspect.aj(1k):109)
    [junit]     at org.apache.cactus.server.ServletTestRedirector.dispatch112_do
Get(ServletTestRedirector.java;org/apache/cactus/util/log/LogAspect.aj(1k):96)
    [junit]     at org.apache.cactus.server.ServletTestRedirector.around112_doGe
t(ServletTestRedirector.java;org/apache/cactus/util/log/LogAspect.aj(1k):1149)
    [junit]     at org.apache.cactus.server.ServletTestRedirector.doGet(ServletT
estRedirector.java;org/apache/cactus/util/log/LogAspect.aj(1k):92)
    [junit]     at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    [junit]     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    [junit]     at org.apache.catalina.core.ApplicationFilterChain.internalDoFil
ter(ApplicationFilterChain.java:247)
    [junit]     at org.apache.catalina.core.ApplicationFilterChain.doFilter(Appl
icationFilterChain.java:193)
    [junit]     at org.apache.catalina.core.StandardWrapperValve.invoke(Standard
WrapperValve.java:243)
    [junit]     at org.apache.catalina.core.StandardPipeline.invokeNext(Standard
Pipeline.java:566)
    [junit]     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipe
line.java:472)
    [junit]     at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.j
ava:943)
    [junit]     at org.apache.catalina.core.StandardContextValve.invoke(Standard
ContextValve.java:190)
    [junit]     at org.apache.catalina.core.StandardPipeline.invokeNext(Standard
Pipeline.java:566)
    [junit]     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipe
line.java:472)
    [junit]     at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.j
ava:943)
    [junit]     at org.apache.catalina.core.StandardContext.invoke(StandardConte
xt.java:2343)
    [junit]     at org.apache.catalina.core.StandardHostValve.invoke(StandardHos
tValve.java:180)
    [junit]     at org.apache.catalina.core.StandardPipeline.invokeNext(Standard
Pipeline.java:566)
    [junit]     at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorD
ispatcherValve.java:170)
    [junit]     at org.apache.catalina.core.StandardPipeline.invokeNext(Standard
Pipeline.java:564)
    [junit]     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorRepor
tValve.java:170)
    [junit]     at org.apache.catalina.core.StandardPipeline.invokeNext(Standard
Pipeline.java:564)
    [junit]     at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogVal
ve.java:468)
    [junit]     at org.apache.catalina.core.StandardPipeline.invokeNext(Standard
Pipeline.java:564)
    [junit]     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipe
line.java:472)
    [junit]     at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.j
ava:943)
    [junit]     at org.apache.catalina.core.StandardEngineValve.invoke(StandardE
ngineValve.java:174)
    [junit]     at org.apache.catalina.core.StandardPipeline.invokeNext(Standard
Pipeline.java:566)
    [junit]     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipe
line.java:472)
    [junit]     at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.j
ava:943)
    [junit]     at org.apache.catalina.connector.http.HttpProcessor.process(Http
Processor.java:1012)
    [junit]     at org.apache.catalina.connector.http.HttpProcessor.run(HttpProc
essor.java:1107)
    [junit]     at java.lang.Thread.run(Thread.java:484)
Why am I encountering this error? the application seems to parse my struts-config.xml. I am using strutstest 1.9-1.0-2.3 to test my application.
thanks

 Yahoo! Properties Special  Buy, sell, rent...your flat, or even post an ad

Struts Tip #5 - Use coarse-grained ActionForms

Posted by Derek Richardson <de...@appiancorp.com>.
I have a question about Ted Husted's Struts Tip #5 (read it at
http://www.jguru.com/faq/view.jsp?EID=915895). In it, he draws a distinction
between ActionForms and form-beans. I do not understand this. I know what an
ActionForm is, but I have no idea what a form-bean is separate from an
ActionForm.

I'll appreciate it if someone will explain what a form-bean is and how it
identifies which ActionForm to use; sample code would be great.

Derek Richardson


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>