MapViewer Demo Question

5 messages Options
Embed this post
Permalink
ATI

MapViewer Demo Question

Reply Threaded More More options
Print post
Permalink
Hi,
     i've started adding the dependencies in my maven project to mirror that of the demo on the site, but and wanted to ask, when i meet this particular code:

- <dependency>
  <groupId>javax.media</groupId>
  <artifactId>jai_core</artifactId>
- <!--  The version number is specified in the parent POM.
  -->
  <scope>provided</scope>
- <!--  Users should execute JAI installer.
  -->
  </dependency>


i add the version number to 2.5.6 and instal the JAI under C:\jai-1_1_2 but i get a build failure:

ERROR]Transitive dependency resolution for scope: compile has failed for your project.
[ERROR]Error message: Missing:
[ERROR]----------
[ERROR]1) javax.media:jai_core:jar:2.5.6
[ERROR]  Try downloading the file manually from the project website.
[ERROR]  Then, install it using the command:
[ERROR]      mvn install:install-file -DgroupId=javax.media -DartifactId=jai_core -Dversion=2.5.6 -Dpackaging=jar -Dfile=/path/to/file
[ERROR]  Alternatively, if you host your own repository you can deploy the file there:
[ERROR]      mvn deploy:deploy-file -DgroupId=javax.media -DartifactId=jai_core -Dversion=2.5.6 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
[ERROR]  Path to dependency:
[ERROR]          1) com.mycompany:demo:jar:1.0-SNAPSHOT
[ERROR]          2) javax.media:jai_core:jar:2.5.6
[ERROR]----------
[ERROR]1 required artifact is missing.
[ERROR]for artifact:
[ERROR]  com.mycompany:demo:jar:1.0-SNAPSHOT
[ERROR]from the specified remote repositories:
[ERROR]  central (http://repo1.maven.org/maven2)
[ERROR]Group-Id: com.mycompany
[ERROR]Artifact-Id: demo
[ERROR]Version: 1.0-SNAPSHOT
[ERROR]From file: C:\Users\Luong\Documents\NetBeansProjects\demo\pom.xml


this also applies the last section of the dependencies:


- <dependency>
  <groupId>javax.media</groupId>
  <artifactId>jai_imageio</artifactId>
- <!--  The version number is specified in the parent POM.
  -->
  <scope>provided</scope>
- <!--  Users should execute JAI installer.
  -->
  </dependency>


what do i need to do for the jai?

One last thing is that, the line, FeatureSource<SimpleFeatureType, SimpleFeature> fs = ds.getFeatureSource();
 in function load( URL shape, URL sld)

i get an error saying "generics are not supported in -source 1.3 (use -source5 or higher to enable generics) which hi have never come accrossed when writting java apps. What does this mean and how can i rectify this?



mbedward

Re: MapViewer Demo Question

Reply Threaded More More options
Print post
Permalink
Hi Luong,

> i add the version number to 2.5.6 and instal the JAI under C:\jai-1_1_2 but
> i get a build failure:
>

Please see my earlier reply about version numbers - they only have
meaning __within__ a project. The GeoTools version number will apply
to all of the GeoTools dependencies in your pom but doesn't mean
anything for other dependencies from other projects or developers such
as jai, jts, apache etc.

> i get an error saying "generics are not supported in -source 1.3 (use
> -source5 or higher to enable generics) which hi have never come accrossed
> when writting java apps. What does this mean and how can i rectify this?

A new maven project created with Netbeans defaults to an early version
of Java. To change this:
1. right-click on your project in the Projects window
2. select 'Properties' at the bottom of the pop-up menu
3. select 'Sources' from the list in the properties dialog
4. in the 'Source / binary format' pull-down, choose 1.5

Hope this helps
Michael

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Geotools-gt2-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
ATI

Re: MapViewer Demo Question

Reply Threaded More More options
Print post
Permalink
Yes that does help alittle yes.

  However, i still don't know what to do when i see the

- <dependency>
  <groupId>javax.media</groupId>
  <artifactId>jai_core</artifactId>
- <!--  The version number is specified in the parent POM.
  -->
  <scope>provided</scope>
- <!--  Users should execute JAI installer.
  -->
  </dependency>
- <dependency>
  <groupId>javax.media</groupId>
  <artifactId>jai_imageio</artifactId>
- <!--  The version number is specified in the parent POM.
  -->
  <scope>provided</scope>
- <!--  Users should execute JAI installer.
  -->
  </dependency>


i've downloaded both the JMF and JAI and installed it but i don't know what to do with those pom dependecies. What do i need to do exactly?

Also, the gt-epsg-wkt does not seem to download as i get errors so i changed to gt-epsg-hsql, is that OK?

I've compied the .shp file and the other files but when i run the app and select the .shp file nothing appears. but instead i get the following in my output pannel:

[Fatal Error] :1:8: The processing instruction target matching "[xX][mM][lL]" is not allowed.
java.lang.RuntimeException: org.xml.sax.SAXParseException: The processing instruction target matching "[xX][mM][lL]" is not allowed.
        at org.geotools.styling.SLDParser.readXML(SLDParser.java:290)
        at MapViewer.load(MapViewer.java:129)
        at MapViewer.actionPerformed(MapViewer.java:191)
        at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
        at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
        at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
        at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
        at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
        at java.awt.Component.processMouseEvent(Component.java:6263)
        at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
        at java.awt.Component.processEvent(Component.java:6028)
        at java.awt.Container.processEvent(Container.java:2041)
        at java.awt.Component.dispatchEventImpl(Component.java:4630)
        at java.awt.Container.dispatchEventImpl(Container.java:2099)
        at java.awt.Component.dispatchEvent(Component.java:4460)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
        at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
        at java.awt.Container.dispatchEventImpl(Container.java:2085)
        at java.awt.Window.dispatchEventImpl(Window.java:2475)
        at java.awt.Component.dispatchEvent(Component.java:4460)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: org.xml.sax.SAXParseException: The processing instruction target matching "[xX][mM][lL]" is not allowed.
        at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
        at org.geotools.styling.SLDParser.readXML(SLDParser.java:286)
        ... 27 more
At present, this is what i have in my pom.xml




<?xml version="1.0" encoding="UTF-8"?>
<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>demo</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>demo</name>
  <url>http://maven.apache.org</url>
  <properties>
    <geotoolsVersion>2.5.5</geotoolsVersion>
</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-main</artifactId>
            <version>${geotoolsVersion}</version>
        </dependency>

        <dependency>
            <groupId>org.geotools</groupId>
            <artifactId>gt-api</artifactId>
            <version>${geotoolsVersion}</version>
        </dependency>
       
        <dependency>
            <groupId>org.geotools</groupId>
            <artifactId>gt-referencing</artifactId>
            <version>${geotoolsVersion}</version>
        </dependency>

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

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

   <!--  ===========================================================
  -->
 <!--      Build Configuration
  -->
 <!--  ===========================================================
  -->

<build>

    <plugins>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <configuration>
                <archive>

                    <manifest>
                        <mainClass>org.geotools.demo.mappane.MapViewer</mainClass>
                        <addClasspath>true</addClasspath>
                    </manifest>
                </archive>
            </configuration>
        </plugin>

        <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.0.2</version>
                <configuration>
                    <source>1.5</source>
                    <target>1.5</target>
                </configuration>
            </plugin>
    </plugins>

    <resources>

        <resource>
            <directory>data</directory>

            <includes>
                <include>**</include>
            </includes>
        </resource>
    </resources>
</build>

</project>
ATI

Re: MapViewer Demo Question

Reply Threaded More More options
Print post
Permalink
In reply to this post by ATI
Also, when i run the app, i don't know if i need to do this, but i tried setting the CRS and default it was
EPSG:4326 and i selected OK, but i gave an error of class.null.pointerException. Do i need to set this?

 
mbedward

Re: MapViewer Demo Question

Reply Threaded More More options
Print post
Permalink
In reply to this post by ATI
Hi Luong,

I can see that you're very keen to make progress :-)

But can I suggest that you'll get more useful feedback from the list
if you make your posts shorter and more specific.  A post that
contains a whole bundle of separate questions, error dumps and code
snippets can overwhelm a reader.  A simpler post, concerning one
issue, is not only more likely to get a response but you may well find
that the solution also clears up other issues.

No offence meant ! I just want to make sure that you increase your
chances of getting assistance at each step.

Michael

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Geotools-gt2-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users