hello everybody, 
to solve the problem about  java.lang.NoSuchMethodError, i have erased the 
dependancy 
 <dependency>
  <groupId>org.geotools</groupId>
  <artifactId>gt2-tile</artifactId>
  <version>2.5-M1</version>
</dependency>
  
and put rather 

 <dependency>
  <groupId>org.geotools</groupId>
  <artifactId>gt-legacy</artifactId>
  <version>2.6.3</version>
</dependency>

. Now i have this problem: 

Exception in thread "main" 
org.geotools.feature.IllegalAttributeException:illegal attribute:null value:null
        at 
org.geotools.feature.DefaultFeatureType.create(DefaultFeatureType.java:240)
        at 
org.geotools.feature.DefaultFeatureType.create(DefaultFeatureType.java:212)
        at com.mycompany.cartes.App.main(App.java:154)
Caused by: java.lang.ClassCastException: 
org.geotools.feature.simple.SimpleFeatureImpl cannot be cast to 
org.geotools.feature.Feature
        at 
org.geotools.feature.DefaultFeatureType.create(DefaultFeatureType.java:237)
        ... 2 more
[ERROR]The following mojo encountered an error while executing:
[ERROR]Group-Id: org.codehaus.mojo
[ERROR]Artifact-Id: exec-maven-plugin
[ERROR]Version: 1.1.1
[ERROR]Mojo: exec
[ERROR]brought in via: Direct invocation
[ERROR]While building project:
[ERROR]Group-Id: com.mycompany
[ERROR]Artifact-Id: cartes
[ERROR]Version: 1.0-SNAPSHOT
[ERROR]From file: C:\Users\Arnauld\Documents\NetBeansProjects\cartes\pom.xml
[ERROR]Reason: Result of cmd.exe /X /C ""C:\Program 
Files\Java\jdk1.6.0_02\bin\java.exe" -classpath 
C:\Users\Arnauld\Documents\NetBeansProjects\cartes\target\classes;C:\Users\Arnauld\.m2\repository\org\geotools\gt-postgis\2.6.3\gt-postgis-2.6.3.jar;C:\Users\Arnauld\.m2\repository\org\geotools\gt-jdbc\2.6.3\gt-jdbc-2.6.3.jar;C:\Users\Arnauld\.m2\repository\org\geotools\gt-api\2.6.3\gt-api-2.6.3.jar;C:\Users\Arnauld\.m2\repository\com\vividsolutions\jts\1.10\jts-1.10.jar;
 is: '1'.
------------------------------------------------------------------------
For more information, run with the -e flag
------------------------------------------------------------------------
BUILD FAILED
.
This is my java code
 
Coordinate coord1 = new Coordinate(1131270.8550,4418856.9693);

      Coordinate coord2 = new Coordinate(1131439.2747,4418792.6636);
      Coordinate coord3 = new Coordinate(1131439.2747,4418792.6636);


     GeometryFactory geo=new GeometryFactory();


     // LineSegment lines=new LineSegment(coord1, coord2);
         
     //FeatureCollection feat;


    AttributeType[] types = new AttributeType[1];

    LineString lines =geo.createLineString(new Coordinate[]{coord1,coord2});


    types[0] = 
org.geotools.feature.AttributeTypeFactory.newAttributeType("centerline",lines.getClass());


    FeatureType lineType = FeatureTypeFactory.newFeatureType(types,"linetype");

   org.geotools.feature.Feature linefeature =(org.geotools.feature.Feature) 
lineType.create(new Object[]{lines});


    FeatureCollection fcline=FeatureCollections.newCollection();

    fcline.add(linefeature);

map.addLayer(fcline, style);

It is the red line which generate the exception.

My pom.xml file is:

<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.mycompany</groupId>
  <artifactId>cartes</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>cartes</name>
  <url>http://maven.apache.org</url>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.0.2</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
  
  <properties>
    <geotools.version>2.6.3</geotools.version>
  </properties>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>

<dependency>
    <groupId>org.geotools</groupId>
    <artifactId>gt-postgis</artifactId>
    <version>${geotools.version}</version>
</dependency>

      <dependency>
          <groupId>mysql</groupId>
          <artifactId>mysql-connector-java</artifactId>
          <version>5.1.12</version>
      </dependency>

<dependency>
    <groupId>org.geotools</groupId>
    <artifactId>gt-epsg-hsql</artifactId>
    <version>${geotools.version}</version>
</dependency>
<dependency>
    <groupId>org.geotools</groupId>
    <artifactId>gt-swing</artifactId>
    <version>${geotools.version}</version>
</dependency>

<dependency>
    <groupId>org.geotools</groupId>
    <artifactId>gt-render</artifactId>
    <version>${geotools.version}</version>
</dependency>

<dependency>
    <groupId>org.geotools</groupId>
    <artifactId>gt-legacy</artifactId>
    <version>${geotools.version}</version>
</dependency>


  </dependencies>

  <repositories>
    <repository>
      <id>maven2-repository.dev.java.net</id>
      <name>Java.net repository</name>
      <url>http://download.java.net/maven/2</url>
    </repository>

    <repository>
      <id>osgeo</id>
      <name>Open Source Geospatial Foundation Repository</name>
      <url>http://download.osgeo.org/webdav/geotools/</url>
    </repository>
  </repositories>
</project>



Ndefo Kamgne Arnauld

Cité Ettayour,Immeuble Bolbol 1,Appartement A2,Ariana

0021624249357




      
------------------------------------------------------------------------------

_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to