NoSuchMethodError at AWTChartComponentFactory.chart( quality, "offscreen" )

43 views
Skip to first unread message

phillip_at_work

unread,
Jun 22, 2022, 4:53:33 PM6/22/22
to Jzy3d
Working on some basic code to plot a 2d array (as x and y axes) as values along z-axis. When I display the plot, it works completely fine:

Shape surface = new SurfaceBuilder().orthonormal( grid, mapper );
Chart chart3d = new AWTChartFactory().newChart( Quality.Advanced() );
chart3d.add( surface );
chart3d.view3d();
chart3d.open();
chart3d.addMouse();

However, when I modify this to be an offscreen plot:

Shape surface = new SurfaceBuilder().orthonormal( grid, mapper );
Chart chart3d = AWTChartComponentFactory.chart( Quality.Nicest(), "offscreen" );
// chart3d.add( surface );
// chart3d.view3d();
// chart3d.open();
// chart3d.addMouse();

I get this stack trace:

Exception in thread "main" java.lang.NoSuchMethodError: 'void org.jzy3d.chart.AWTChart.<init>(org.jzy3d.chart.factories.IChartComponentFactory, org.jzy3d.plot3d.rendering.canvas.Quality, java.lang.String)'
    at org.jzy3d.chart.factories.AWTChartComponentFactory.newChart(AWTChartComponentFactory.java:88)
    at org.jzy3d.chart.factories.ChartComponentFactory.newChart(ChartComponentFactory.java:71)
    at org.jzy3d.chart.factories.AWTChartComponentFactory.chart(AWTChartComponentFactory.java:78)
    at com.ioi.utilities.Jzy3dTest.buildSurface(Jzy3dTest.java:71)
    at com.ioi.utilities.Jzy3dTest.<init>(Jzy3dTest.java:56)
    at com.ioi.utilities.Jzy3dTest.main(Jzy3dTest.java:44)

I can see in the docs that a static method AWTChartComponentFactory#chart(Quality,String) exists. Pretty sure I copied this example from somewhere. Not seeing the issue.

These are the dependencies and repositories I'm using. Some of these may be redundant or unnecessary. I starting pulling everything into my POM thinking I was missing a dependency.

Developing on M1 max MacOS v12.3.1 for deployment on Windows 10 x86.

POM:
    <!-- https://mvnrepository.com/artifact/org.jzy3d/jzy3d-jdt-core -->
    <dependency>
        <groupId>org.jzy3d</groupId>
        <artifactId>jzy3d-jdt-core</artifactId>
        <version>2.1.0</version>
    </dependency>
   
    <!-- https://mvnrepository.com/artifact/org.jzy3d/jzy3d-core -->
    <dependency>
        <groupId>org.jzy3d</groupId>
        <artifactId>jzy3d-core</artifactId>
        <version>2.1.0</version>
    </dependency>
   
    <dependency>
        <groupId>org.jzy3d</groupId>
        <artifactId>jzy3d-native-jogl-awt</artifactId>
        <version>2.1.0</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.jzy3d/jzy3d-jGL-awt -->
    <dependency>
        <groupId>org.jzy3d</groupId>
        <artifactId>jzy3d-jGL-awt</artifactId>
        <version>2.1.0</version>
    </dependency>
   
    <!-- https://mvnrepository.com/artifact/org.jzy3d/jzy3d-native-jogl-awt -->
    <dependency>
        <groupId>org.jzy3d</groupId>
        <artifactId>jzy3d-native-jogl-awt</artifactId>
        <version>2.1.0</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.jzy3d/jzy3d-core-awt -->
    <dependency>
        <groupId>org.jzy3d</groupId>
        <artifactId>jzy3d-core-awt</artifactId>
        <version>2.1.0</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.jzy3d/jzy3d-native-jogl-newt -->
    <dependency>
        <groupId>org.jzy3d</groupId>
        <artifactId>jzy3d-native-jogl-newt</artifactId>
        <version>2.1.0</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.jzy3d/jzy3d-emul-gl -->
    <dependency>
        <groupId>org.jzy3d</groupId>
        <artifactId>jzy3d-emul-gl</artifactId>
        <version>2.0.0</version>
    </dependency>
   
    <!-- https://mvnrepository.com/artifact/org.jzy3d/jzy3d-emul-gl -->
    <dependency>
        <groupId>org.jzy3d</groupId>
        <artifactId>jzy3d-emul-gl</artifactId>
        <version>2.0.0</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.jzy3d/jzy3d-api -->
    <dependency>
        <groupId>org.jzy3d</groupId>
        <artifactId>jzy3d-api</artifactId>
        <version>1.0.3</version>
    </dependency>
   
   
    <dependency>
        <groupId>org.jzy3d</groupId>
        <artifactId>jzy3d-swt</artifactId>
        <version>0.9.2-SNAPSHOT</version>
        <exclusions>
            <exclusion>
                <groupId>org.eclipse.swt</groupId>
                <artifactId>org.eclipse.swt.gtk.linux.x86_64</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
   
  </dependencies>
 
  <repositories>
 
    <!-- Scientific plotting libraries -->
    <!-- See: http://www.jzy3d.org/download-2.1.0.php -->
      <repository>
         <id>jzy3d-snapshots</id>
         <name>Jzy3d Snapshots</name>
         <url>http://maven.jzy3d.org/snapshots</url>
      </repository>
      <repository>
         <id>jzy3d-releases</id>
         <name>Jzy3d Releases</name>
         <url>http://maven.jzy3d.org/releases</url>
      </repository>
     
    </repositories>

Many thanks

phillip_at_work

unread,
Jun 23, 2022, 2:02:56 PM6/23/22
to Jzy3d
Update. Just ran this code on a Windows 10 x86 machine also. Same error. Happy to try any suggestions.

I pared down the dependencies to:

<!-- https://mvnrepository.com/artifact/org.jzy3d/jzy3d-native-jogl-awt -->
    <dependency>
        <groupId>org.jzy3d</groupId>
        <artifactId>jzy3d-native-jogl-awt</artifactId>
        <version>2.1.0</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.jzy3d/jzy3d-core-awt -->
    <dependency>
        <groupId>org.jzy3d</groupId>
        <artifactId>jzy3d-core-awt</artifactId>
        <version>2.1.0</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.jzy3d/jzy3d-emul-gl -->
    <dependency>
        <groupId>org.jzy3d</groupId>
        <artifactId>jzy3d-emul-gl</artifactId>
        <version>2.0.0</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.jzy3d/jzy3d-api -->
    <dependency>
        <groupId>org.jzy3d</groupId>
        <artifactId>jzy3d-api</artifactId>
        <version>1.0.3</version>
    </dependency>

And:

      <repository>
         <id>jzy3d-releases</id>
         <name>Jzy3d Releases</name>
         <url>http://maven.jzy3d.org/releases</url>
      </repository>

Martin

unread,
Jul 14, 2022, 9:48:02 AM7/14/22
to Jzy3d
Hi Philip,

The method signature for chart init has changed in 2.*. You should now use 

new AWTChartFactory().newChart(quality)

Cheers,

Martin

Reply all
Reply to author
Forward
0 new messages