You will want to take this discussion the user list.

To answer your question their is a trick required to making JAI; you need to 
configure the boot class loader to allow for java extensions.

For more information review:
- http://udig.refractions.net/confluence/display/DEV/1+SDK+Quickstart

-- 
Jody Garnett

On Wednesday, 4 May 2011 at 7:18 PM, khalid Amiral wrote: 
> 
> hello every body,
> I am currently developing an application in Eclipse with geotools. 
> when I run the class WMS it gives me this error:[Échec lors de 
> l'initialisation d'un service de catégorie "MathTransformProvider". La cause 
> est "NoClassDefFoundError: javax/media/jai/WarpAffine"].
> 
> the code class is :
> 
> import java.awt.image.BufferedImage;
> 
> 
> import java.net.URL;
> import java.util.List;
> 
> import javax.imageio.ImageIO;
> import javax.swing.JFrame;
> import javax.swing.JOptionPane;
> 
> import org.geotools.data.ows.Layer;
> import org.geotools.data.ows.WMSCapabilities;
> import org.geotools.data.wms.WMSUtils;
> import org.geotools.data.wms.WebMapServer;
> import org.geotools.data.wms.request.GetMapRequest;
> import org.geotools.data.wms.response.GetMapResponse;
> import org.geotools.map.DefaultMapContext;
> import org.geotools.map.MapContext;
> import org.geotools.map.WMSMapLayer;
> import org.geotools.swing.JMapFrame;
> import org.geotools.swing.wms.WMSChooser;
> import org.geotools.swing.wms.WMSLayerChooser;
> import org.geotools.referencing.CRS;
> import org.geotools.referencing.factory.epsg.*;
> import org.opengis.referencing.crs.CoordinateReferenceSystem;
> 
> 
> public class WMSLab extends JFrame {
>  /**
> * 
> */
>  private static final long serialVersionUID = 1L;
> 
> 
>  public static void main(String[] args) throws Exception {
> 
> 
>  URL url = new 
> URL("http://localhost:8080/geoserver/wms?service=WMS&version=1.1.0&request=GetMap&layers=tasmania&styles=&bbox=143.83482400000003,-43.648056,148.47914100000003,-39.573891&width=512&height=449&srs=EPSG:4326&format=image/png";);
>  WebMapServer wms = new WebMapServer(url);
>  WMSCapabilities capabilities = wms.getCapabilities();
>  //CoordinateReferenceSystem crs = CRS.decode("EPSG:4326");
>  List <Layer> layers = capabilities.getLayerList();
> 
>  MapContext mapcontext = new DefaultMapContext();
>  mapcontext.setTitle( wms.getCapabilities().getService().getTitle() );
> 
>  for( Layer layer : layers ){
>  WMSMapLayer displayLayer = new WMSMapLayer(wms, layer );
>  mapcontext.addLayer( displayLayer );
>  }
>  // Now display the map
>  JMapFrame.showMap(mapcontext);
> 
>  GetMapRequest request = wms.createGetMapRequest();
>  request.setFormat("image/png");
>  request.setDimensions("583", "420"); //sets the dimensions to be returned 
> from the server
>  request.setTransparent(true);
>  request.setSRS("EPSG:4326");
>  
> request.setBBox("-131.13151509433965,46.60532747661736,-117.61620566037737,56.34191403281659");
>  for ( Layer layer : WMSUtils.getNamedLayers(capabilities) ) {
>  request.addLayer(layer);
>  }
> 
> 
>  GetMapResponse response = (GetMapResponse) wms.issueRequest(request);
>  BufferedImage image = ImageIO.read(response.getInputStream());
> 
> 
> 
>  /*  URL capabilitiesURL = WMSChooser.showChooseWMS();
>  if( capabilitiesURL == null ){
>  System.exit(0); // canceled
>  }
>  WebMapServer wms = new WebMapServer( capabilitiesURL ); 
> 
>  List<Layer> wmsLayers = WMSLayerChooser.showSelectLayer( wms );
>  if( wmsLayers == null ){
>  JOptionPane.showMessageDialog(null, "Could not connect - check url");
>  System.exit(0);
>  }
>  MapContext mapcontext = new DefaultMapContext();
>  mapcontext.setTitle( wms.getCapabilities().getService().getTitle() );
> 
>  for( Layer wmsLayer : wmsLayers ){
>  WMSMapLayer displayLayer = new WMSMapLayer(wms, wmsLayer );
>  mapcontext.addLayer( displayLayer );
>  }
>  // Now display the map
>  JMapFrame.showMap(mapcontext);*/
>  }
> }
> 
> And thank you
> ------------------------------------------------------------------------------
> WhatsUp Gold - Download Free Network Management Software
> The most intuitive, comprehensive, and cost-effective network 
> management toolset available today. Delivers lowest initial 
> acquisition cost and overall TCO of any competing solution.
> http://p.sf.net/sfu/whatsupgold-sd
> _______________________________________________
> Geotools-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-devel
> 
------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to