You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by swaddee <ma...@ccbill.com> on 2007/10/31 17:51:20 UTC

help with struts 2 + jfreechart plugin example

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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: help with struts 2 + jfreechart plugin example

Posted by Alvaro Sanchez-Mariscal <al...@gmail.com>.
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 <ma...@ccbill.com> 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: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
Alvaro Sanchez-Mariscal Arnaiz
Java EE Architect & Instructor
alvaro.sanchezmariscal@gmail.com

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


Re: help with struts 2 + jfreechart plugin example

Posted by swaddee <ma...@ccbill.com>.
I have discovered the problem.  I had not put jcommon.jar in lib directory. 
It was there for me when using webwork quickstart and I had not realized its
necessity.  Thanks for all your help - I don't know if and when I would have
discovered the problem without it.



swaddee wrote:
> 
> It seems more times than not the war does not load if the
> viewModerationChart action is in struts.xml.  It doesn't matter what the
> namespace is.  This is the catalina.out log with namespace="mychart".
> 
> Oct 31, 2007 11:27:10 AM org.apache.catalina.startup.HostConfig deployWAR                                                                                                           
> INFO: Deploying web application archive userAgent.war                                                                                                                               
> Oct 31, 2007 11:27:11 AM
> com.opensymphony.xwork2.config.providers.XmlConfigurationProvider register                                                                                 
> INFO: Parsing configuration file [struts-default.xml]                                                                                                                               
> Oct 31, 2007 11:27:11 AM
> com.opensymphony.xwork2.config.providers.XmlConfigurationProvider register                                                                                 
> INFO: Parsing configuration file [struts-plugin.xml]                                                                                                                                
> Oct 31, 2007 11:27:11 AM
> com.opensymphony.xwork2.config.providers.XmlConfigurationProvider register                                                                                 
> INFO: Parsing configuration file [struts.xml]                                                                                                                                       
> Oct 31, 2007 11:27:11 AM org.apache.struts2.config.Settings getLocale                                                                                                               
> WARNING: Settings: Could not parse struts.locale setting, substituting
> default VM locale                                                                                            
> Oct 31, 2007 11:27:11 AM
> com.opensymphony.xwork2.config.impl.DefaultConfiguration$ContainerProperties
> setProperty                                                                   
> INFO: Overriding property struts.i18n.reload - old value: false new value:
> true                                                                                                     
> Oct 31, 2007 11:27:11 AM
> com.opensymphony.xwork2.config.impl.DefaultConfiguration$ContainerProperties
> setProperty                                                                   
> INFO: Overriding property struts.configuration.xml.reload - old value:
> false new value: true                                                                                        
> Oct 31, 2007 11:27:12 AM org.apache.catalina.core.StandardContext start                                                                                                             
> SEVERE: Error filterStart                                                                                                                                                           
> Oct 31, 2007 11:27:12 AM org.apache.catalina.core.StandardContext start                                                                                                             
> SEVERE: Context [/userAgent] startup failed due to previous errors   
> 
> Do I need another filter in web.xml?  Here is the file:
> 
>  <?xml version="1.0" encoding="UTF-8"?>                                                                                                                                              
> <web-app id="WebApp_9" version="2.4"
> xmlns="http://java.sun.com/xml/ns/j2ee"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">                                                                                                                                
>                                                                                                                                                                                     
>     <display-name>Struts Blank</display-name>                                                                                                                                       
>                                                                                                                                                                                     
>     <filter>                                                                                                                                                                        
>         <filter-name>struts2</filter-name>                                                                                                                                          
>        
> <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>                                                                                                 
>     </filter>                                                                                                                                                                       
>                                                                                                                                                                                     
>     <filter-mapping>                                                                                                                                                                
>         <filter-name>struts2</filter-name>                                                                                                                                          
>         <url-pattern>/*</url-pattern>                                                                                                                                               
>     </filter-mapping>                                                                                                                                                               
>                                                                                                                                                                                     
>     <welcome-file-list>                                                                                                                                                             
>         <welcome-file>index.html</welcome-file>                                                                                                                                     
>     </welcome-file-list>                                                                                                                                                            
>                                                                                                                                                                                     
> </web-app>                
> 
> 
> Thanks  for the  help so far.                                                                                                                                                           
> ~                                                                         
> 
> swaddee 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#a13517086
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: help with struts 2 + jfreechart plugin example

Posted by Dave Newton <ne...@yahoo.com>.
Did you fix the package declarations?

Turn up the log level, too.

--- swaddee <ma...@ccbill.com> wrote:
> It seems more times than not 

More times than not? Does it work sometimes?

d.

the war does not load
> if the viewModerationChart
> action is in struts.xml.  It doesn't matter what the
> namespace is.  This is
> the catalina.out log with namespace="mychart".
> 
> Oct 31, 2007 11:27:10 AM
> org.apache.catalina.startup.HostConfig deployWAR    
>                                                     
>                                                  
> INFO: Deploying web application archive
> userAgent.war                                       
>                                                     
>                                   
> Oct 31, 2007 11:27:11 AM
>
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider
> register                                            
>                                     
> INFO: Parsing configuration file
> [struts-default.xml]                                
>                                                     
>                                          
> Oct 31, 2007 11:27:11 AM
>
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider
> register                                            
>                                     
> INFO: Parsing configuration file [struts-plugin.xml]
>                                                     
>                                                     
>                      
> Oct 31, 2007 11:27:11 AM
>
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider
> register                                            
>                                     
> INFO: Parsing configuration file [struts.xml]       
>                                                     
>                                                     
>                      
> Oct 31, 2007 11:27:11 AM
> org.apache.struts2.config.Settings getLocale        
>                                                     
>                                                  
> WARNING: Settings: Could not parse struts.locale
> setting, substituting
> default VM locale                                   
>                                                     
>    
> Oct 31, 2007 11:27:11 AM
>
com.opensymphony.xwork2.config.impl.DefaultConfiguration$ContainerProperties
> setProperty                                         
>                          
> INFO: Overriding property struts.i18n.reload - old
> value: false new value:
> true                                                
>                                                     
> Oct 31, 2007 11:27:11 AM
>
com.opensymphony.xwork2.config.impl.DefaultConfiguration$ContainerProperties
> setProperty                                         
>                          
> INFO: Overriding property
> struts.configuration.xml.reload - old value: false
> new value: true                                     
>                                                   
> Oct 31, 2007 11:27:12 AM
> org.apache.catalina.core.StandardContext start      
>                                                     
>                                                  
> SEVERE: Error filterStart                           
>                                                     
>                                                     
>                      
> Oct 31, 2007 11:27:12 AM
> org.apache.catalina.core.StandardContext start      
>                                                     
>                                                  
> SEVERE: Context [/userAgent] startup failed due to
> previous errors   
> 
> Do I need another filter in web.xml?  Here is the
> file:
> 
>  <?xml version="1.0" encoding="UTF-8"?>             
>                                                     
>                                                     
>                       
> <web-app id="WebApp_9" version="2.4"
> xmlns="http://java.sun.com/xml/ns/j2ee"
>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">   
>                                                     
>                                                     
>                   
>                                                     
>                                                     
>                                                     
>                      
>     <display-name>Struts Blank</display-name>       
>                                                     
>                                                     
>                      
>                                                     
>                                                     
>                                                     
>                      
>     <filter>                                        
>                                                     
>                                                     
>                      
>         <filter-name>struts2</filter-name>          
>                                                     
>                                                     
>                      
>        
>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
>                                                     
>                                            
>     </filter>                                       
>                                                     
>                                                     
>                      
>                                                     
>                                                     
>                                                     
>                      
>     <filter-mapping>                                
>                                                     
>                                                     
>                      
>         <filter-name>struts2</filter-name>          
>                                                     
>                                                     
>                      
>         <url-pattern>/*</url-pattern>               
>                                                     
>                                                     
>                      
>     </filter-mapping>                               
>                                                     
>                                                     
>                      
>                                                     
>                                                     
>                                                     
>                      
>     <welcome-file-list>                             
>                                                     
>                                                     
>                      
>         <welcome-file>index.html</welcome-file>     
>                                                     
>                                                     
>                      
>     </welcome-file-list>                            
>                                                     
>                                                     
>                      
>                                                     
>                                                     
>                                                     
>                      
> </web-app>                
> 
> 
> Thanks  for the  help so far.                       
>                                                     
>                                                     
>                          
> ~                                                   
>                      
> 
> swaddee 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" ?>           
>                                                     
>  
=== message truncated ===


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


Re: help with struts 2 + jfreechart plugin example

Posted by swaddee <ma...@ccbill.com>.
It seems more times than not the war does not load if the viewModerationChart
action is in struts.xml.  It doesn't matter what the namespace is.  This is
the catalina.out log with namespace="mychart".

Oct 31, 2007 11:27:10 AM org.apache.catalina.startup.HostConfig deployWAR                                                                                                           
INFO: Deploying web application archive userAgent.war                                                                                                                               
Oct 31, 2007 11:27:11 AM
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider register                                                                                 
INFO: Parsing configuration file [struts-default.xml]                                                                                                                               
Oct 31, 2007 11:27:11 AM
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider register                                                                                 
INFO: Parsing configuration file [struts-plugin.xml]                                                                                                                                
Oct 31, 2007 11:27:11 AM
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider register                                                                                 
INFO: Parsing configuration file [struts.xml]                                                                                                                                       
Oct 31, 2007 11:27:11 AM org.apache.struts2.config.Settings getLocale                                                                                                               
WARNING: Settings: Could not parse struts.locale setting, substituting
default VM locale                                                                                            
Oct 31, 2007 11:27:11 AM
com.opensymphony.xwork2.config.impl.DefaultConfiguration$ContainerProperties
setProperty                                                                   
INFO: Overriding property struts.i18n.reload - old value: false new value:
true                                                                                                     
Oct 31, 2007 11:27:11 AM
com.opensymphony.xwork2.config.impl.DefaultConfiguration$ContainerProperties
setProperty                                                                   
INFO: Overriding property struts.configuration.xml.reload - old value: false
new value: true                                                                                        
Oct 31, 2007 11:27:12 AM org.apache.catalina.core.StandardContext start                                                                                                             
SEVERE: Error filterStart                                                                                                                                                           
Oct 31, 2007 11:27:12 AM org.apache.catalina.core.StandardContext start                                                                                                             
SEVERE: Context [/userAgent] startup failed due to previous errors   

Do I need another filter in web.xml?  Here is the file:

 <?xml version="1.0" encoding="UTF-8"?>                                                                                                                                              
<web-app id="WebApp_9" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">                                                                                                                                
                                                                                                                                                                                    
    <display-name>Struts Blank</display-name>                                                                                                                                       
                                                                                                                                                                                    
    <filter>                                                                                                                                                                        
        <filter-name>struts2</filter-name>                                                                                                                                          
       
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>                                                                                                 
    </filter>                                                                                                                                                                       
                                                                                                                                                                                    
    <filter-mapping>                                                                                                                                                                
        <filter-name>struts2</filter-name>                                                                                                                                          
        <url-pattern>/*</url-pattern>                                                                                                                                               
    </filter-mapping>                                                                                                                                                               
                                                                                                                                                                                    
    <welcome-file-list>                                                                                                                                                             
        <welcome-file>index.html</welcome-file>                                                                                                                                     
    </welcome-file-list>                                                                                                                                                            
                                                                                                                                                                                    
</web-app>                


Thanks  for the  help so far.                                                                                                                                                           
~                                                                         

swaddee 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#a13516019
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: help with struts 2 + jfreechart plugin example

Posted by "jignesh.patel" <ji...@aspl.in>.
Hi,
    I have the same problem once i place the
struts2-jfreechart-plugin-2.0.11.jar I have got the deployment error like
this

Apr 29, 2008 2:13:30 PM org.apache.catalina.core.StandardContext filterStart
SEVERE: Exception starting filter struts2
Class: gnu.xml.dom.DomElement
File: DomElement.java
Method: setAttributeNS
Line: 249 - gnu/xml/dom/DomElement.java:249:-1
	at
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:835)
	at
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:131)
	at
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:100)
	at
com.opensymphony.xwork2.config.impl.DefaultConfiguration.reload(DefaultConfiguration.java:130)
	at
com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:52)
	at
org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:395)
	at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:452)
	at
org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:201)
	at
org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:221)
	at
org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:302)
	at
org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:78)
	at
org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3635)
	at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4222)
	at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)
	at
org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)
	at
org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)
	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)


What kind of parsing error is this ?

Can anybody help me ?

thanks,
 jignesh


swaddee 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" ?>                                                                                                                                             
>                                                                                                                                      
>                                                                                                                                                                                     
>                                                                                                                                                                             
>                                                                                                                                                                                     
>                                                                                                              
>                                                                                                                                      
>                                                                                                                                                                                     
>                                                                                                                 
>                                                                                                                                                                                     
>                                                                                                                          
>         /pages/UserAgentStringForm.jsp                                                                                                                             
>                                                                                                                                                                            
>                                                                                                                                                                                     
>                                                                                                                                                            
>                                                                                                                                                                                  
>                                                                                                                                                                                     
>                                                                                                                                                                           
>                                                                                                                                                                                     
>                                                                                                                                                           
>                                                                                                             
>                                                                                                         
>                                                                                                                                                 
>             400                                                                                                                                         
>             300                                                                                                                                        
>                                                                                                                                                                            
>                                                                                                                                                                            
>                                                                                                                                                                           
>                                                                                                                                                                                     
>                                                                                                 
> 
> 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-tp13513669p16955994.html
Sent from the Struts - User mailing list archive at Nabble.com.

Re: help with struts 2 + jfreechart plugin example

Posted by swaddee <ma...@ccbill.com>.


swaddee 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#a13658882
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: help with struts 2 + jfreechart plugin example

Posted by Dave Newton <ne...@yahoo.com>.
What does the config browser think your configuration
is?

I don't know if having two packages with the same
namespace would work or not; I've never tried it.
Doesn't strike me as a good idea even if it did work,
though.

--- swaddee <ma...@ccbill.com> 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;                  
>                                                     
>                                                     
>  
=== message truncated ===


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