You have 2 packages with the same namespace, and 2 actions inside with
the same name. So given:

/ccbill/viewModerationChart

there are more than one entry, which is illegal.

Make sure that namespaces are different.

Alvaro.

On Oct 31, 2007 5:51 PM, swaddee <[EMAIL PROTECTED]> wrote:
>
> I recently started using struts 2 by experimenting with webwork and then
> moving to struts 2. I want to produce some charts using jfreechart.  After
> getting the example
> (http://wiki.opensymphony.com/display/WW/JFreeChartResult) to work using the
> webwork framework I tried it with struts
> 2(http://struts.apache.org/2.x/docs/jfreechart-plugin.html).  I have not had
> any success.
>
> I'd really appreciate it if someone could help get me past this obstacle.
> (the first action is working correctly)
>
> Thanks in advance!
>
>
> =========================================================================
> Here is my struts.xml
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <!DOCTYPE struts PUBLIC
> "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
> "http://struts.apache.org/dtds/struts-2.0.dtd";>
>
> <struts>
>
> <constant name="struts.enable.DynamicMethodInvocation" value="false" />
> <constant name="struts.devMode" value="true" />
>
> <package name="ccbill" namespace="/ccbill" extends="struts-default">
>
>     <action name="UserAgentForm" class="com.ccbill.IncludeTag">
>         <result>/pages/UserAgentStringForm.jsp</result>
>     </action>
>
>     <!-- Add actions here -->
>     <!--
>     <action name="viewModerationChart"
> class="charts.ViewModerationChartAction">
>         <result name="success" type="chart">
>             400
>             300
>         </result>
>     </action>
>     -->
>
> </package>
>
> <!-- Add packages here -->
> <package name="charts" namespace="/ccbill" extends="jfreechart-default">
>     <action name="viewModerationChart"
> class="charts.ViewModerationChartAction">
>         <result name="success" type="chart">
>             400
>             300
>         </result>
>     </action>
> </package>
>
> </struts>
>
> Here is my ViewModerationChartAction.java file
>
> package charts;
>
> import com.opensymphony.xwork2.ActionSupport;
> import org.jfree.chart.JFreeChart;
> import org.jfree.chart.plot.XYPlot;
> import org.jfree.data.xy.XYSeries;
> import org.jfree.chart.renderer.xy.StandardXYItemRenderer;
> import org.jfree.chart.axis.NumberAxis;
> import org.jfree.chart.axis.ValueAxis;
> import org.jfree.data.xy.XYSeriesCollection;
>
> public class ViewModerationChartAction extends ActionSupport {
>
>     private JFreeChart chart;
>
>     public String execute() throws Exception {
>         // chart creation logic...
>         XYSeries dataSeries = new XYSeries(new Integer(1)); //pass a key for
> this series
>         for (int i = 0; i <= 100; i++) {
>             // dataSeries.add(i, RandomUtils.nextInt());
>             dataSeries.add(i, Math.random() * 100);
>         }
>         XYSeriesCollection xyDataset = new XYSeriesCollection(dataSeries);
>
>         ValueAxis xAxis = new NumberAxis("Raw Marks");
>         ValueAxis yAxis = new NumberAxis("Moderated Marks");
>
>         // set my chart variable
>         chart =
>             new JFreeChart(
>                 "Moderation Function",
>                 JFreeChart.DEFAULT_TITLE_FONT,
>                 new XYPlot(
>                     xyDataset,
>                     xAxis,
>                     yAxis,
>                     new
> StandardXYItemRenderer(StandardXYItemRenderer.LINES)),
>                 false);
>         chart.setBackgroundPaint(java.awt.Color.white);
>
>         return super.SUCCESS;
>     }
>
>     public JFreeChart getChart() {
>         return chart;
>     }
>
> }
>
> What follows is the stack trace:
> Struts Problem Report
>
> Struts has detected an unhandled exception:
> # Messages:     There is no Action mapped for namespace /ccbill and action 
> name
> viewModerationChart.
> Stacktraces
> There is no Action mapped for namespace /ccbill and action name
> viewModerationChart. - [unknown location]
>
>
> com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:186)
>
> org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:41)
>
> org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:494)
>
> org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)
>
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
>
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
>
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
>
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
>
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
>
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
>
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
>
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
>
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
>
> org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
>
> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
>
> org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
>
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
>     java.lang.Thread.run(Thread.java:595)
>
>
>
> --
> View this message in context: 
> http://www.nabble.com/help-with-struts-2-%2B-jfreechart-plugin-example-tf4726334.html#a13513669
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



-- 
Alvaro Sanchez-Mariscal Arnaiz
Java EE Architect & Instructor
[EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to