[Geoserver-users] Problem with WFS addFeatures

Hi, We’re working with Geoserver 1.7.3 and Geotools 2.5.5.

We are trying to insert features in a Geoserver layer trough WFS transactions (like says at http://docs.codehaus.org/display/GEOTDOC/07+FeatureStore) but We have the next exception:

org.geotools.data.DataSourceException: Exception Report Could not determine geoserver request
from http request org.apache.catalina.connector.RequestFacade@anonymised.com Exception Code:MissingParameterValue Locator: request

executing this code:

public static void addFeatures(String layer, List<Map<String, Object>> featAttribs) {

Transaction insert = new DefaultTransaction(“insert”);

map = new HashMap();
map.put(WFSDataStoreFactory.URL.key, geoServerConfig.getWFSServerUrl());
map.put(WFSDataStoreFactory.TIMEOUT.key, new Integer(10000));

wfsDataStore = (new WFSDataStoreFactory()).createDataStore(map);
featStore = (FeatureStore<SimpleFeatureType, SimpleFeature>) wfsDataStore.getFeatureSource( layer );
featStore.setTransaction(insert);

featBuilder = new SimpleFeatureBuilder(featStore.getSchema());
collection = FeatureCollections.newCollection();

for(Map<String, Object> featAttribsMap : featAttribs){
for(String key : featAttribsMap.keySet()){
featBuilder.set(key, featAttribsMap.get(key));
}
//null para que genere un id por defecto
feat = featBuilder.buildFeature(null);
collection.add(feat);
}

featStore.addFeatures( collection );
insert.commit();


}

Any advice please? (Thank you very much, this is my presentation message!)

Hi,

What is the value of geoServerConfig.getWFSServerUrl()?

My guess is that it is incomplete, and does not include the "&request=GetCapabilities" parameter. Just a guess based on the error, and i tried a quick test using your code and when i left it off I indeed replicated the error message.

-Justin

Juan Manuel Sánchez Martagón wrote:

Hi, We're working with Geoserver 1.7.3 and Geotools 2.5.5.

We are trying to insert features in a Geoserver layer trough WFS transactions (like says at http://docs.codehaus.org/display/GEOTDOC/07+FeatureStore) but We have the next exception:

org.geotools.data.DataSourceException: Exception Report Could not determine geoserver request
      from http request org.apache.catalina.connector.RequestFacade@anonymised.com Exception Code:MissingParameterValue Locator: request

executing this code:

public static void addFeatures(String layer, List<Map<String, Object>> featAttribs) {

           .....
  Transaction insert = new DefaultTransaction("insert");
                       map = new HashMap(); map.put(WFSDataStoreFactory.URL.key, geoServerConfig.getWFSServerUrl());
            map.put(WFSDataStoreFactory.TIMEOUT.key, new Integer(10000));
                       wfsDataStore = (new WFSDataStoreFactory()).createDataStore(map); featStore = (FeatureStore<SimpleFeatureType, SimpleFeature>) wfsDataStore.getFeatureSource( layer );
            featStore.setTransaction(insert);

            featBuilder = new SimpleFeatureBuilder(featStore.getSchema()); collection = FeatureCollections.newCollection();

            for(Map<String, Object> featAttribsMap : featAttribs){
                for(String key : featAttribsMap.keySet()){
                    featBuilder.set(key, featAttribsMap.get(key)); }
                //null para que genere un id por defecto
                feat = featBuilder.buildFeature(null);
                collection.add(feat);
            }
                       featStore.addFeatures( collection );
            insert.commit();
                      .......
}

Any advice please? (Thank you very much, this is my presentation message!)

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

------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises looking to deploy the next generation of Solaris that includes the latest innovations from Sun and the OpenSource community. Download a copy and enjoy capabilities such as Networking, Storage and Virtualization. Go to: http://p.sf.net/sfu/opensolaris-get

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

_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

--
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.

Hi Justin, I have found that debugging SchemaFactory class, we obtain a null schena

private synchronized Schema getRealInstance(URI targetNamespace) {
Schema r = (Schema) schemas.get(targetNamespace); // r is null

}

so WFSTransactionComplexTypes.encode return a NullException

public void encode(Element element, Object value, PrintHandler output, Map hints) throws IOException, OperationNotSupportedException {


Schema schema = SchemaFactory.getInstance( name.getNamespaceURI() ); //schema is null
Element els = schema.getElements(); //NullException

}

Is there any problem with the tagetNameSpace URI? It works registering the URI with next code, before making the commit.

URI uri = new URI(store.getSchema().getName().getNamespaceURI());
Schema schema = SchemaFactory.getInstance(uri ,uri, Level.FINE );


insert.commit();

PD: I think that you could invoke this method
SchemaFactory.getInstance(uri ,uri, Level.FINE );
instead of:
SchemaFactory.getInstance( name.getNamespaceURI() );
at
WFSTransactionComplexTypes.encode;

Excuse my English,

Thank you very much

El 9 de junio de 2009 8:16, Juan Manuel Sánchez Martagón <peruxho@anonymised.com> escribió:

Hi, you are absolutely right, I realized yesterday that problem but I had to put the attribute ’ version=1.0.0’

to get the class instance of WFSFactoryStore and now I have another problem and the jvm throw this Exception in line ‘insert.commit();’.

java.lang.NullPointerException
at org.geotools.xml.wfs.WFSTransactionComplexTypes$InsertElementType.encode(WFSTransactionComplexTypes.java:922)
at org.geotools.xml.wfs.WFSTransactionComplexTypes$TransactionType.encode(WFSTransactionComplexTypes.java:306)
at org.geotools.xml.DocumentWriter.writeFragment(DocumentWriter.java:316)

Excuse my English,

Thank you very much

El 9 de junio de 2009 5:50, Justin Deoliveira <jdeolive@anonymised.com> escribió:

Hi,

What is the value of geoServerConfig.getWFSServerUrl()?

My guess is that it is incomplete, and does not include the “&request=GetCapabilities” parameter. Just a guess based on the error, and i tried a quick test using your code and when i left it off I indeed replicated the error message.

-Justin

Juan Manuel Sánchez Martagón wrote:

Hi, We’re working with Geoserver 1.7.3 and Geotools 2.5.5.

We are trying to insert features in a Geoserver layer trough WFS transactions (like says at http://docs.codehaus.org/display/GEOTDOC/07+FeatureStore) but We have the next exception:

org.geotools.data.DataSourceException: Exception Report Could not determine geoserver request
from http request org.apache.catalina.connector.RequestFacade@anonymised.com…2453… Exception Code:MissingParameterValue Locator: request

executing this code:

public static void addFeatures(String layer, List<Map<String, Object>> featAttribs) {


Transaction insert = new DefaultTransaction(“insert”);
map = new HashMap(); map.put(WFSDataStoreFactory.URL.key, geoServerConfig.getWFSServerUrl());
map.put(WFSDataStoreFactory.TIMEOUT.key, new Integer(10000));
wfsDataStore = (new WFSDataStoreFactory()).createDataStore(map); featStore = (FeatureStore<SimpleFeatureType, SimpleFeature>) wfsDataStore.getFeatureSource( layer );
featStore.setTransaction(insert);

featBuilder = new SimpleFeatureBuilder(featStore.getSchema()); collection = FeatureCollections.newCollection();

for(Map<String, Object> featAttribsMap : featAttribs){
for(String key : featAttribsMap.keySet()){
featBuilder.set(key, featAttribsMap.get(key)); }
//null para que genere un id por defecto
feat = featBuilder.buildFeature(null);
collection.add(feat);
}
featStore.addFeatures( collection );
insert.commit();

}

Any advice please? (Thank you very much, this is my presentation message!)



OpenSolaris 2009.06 is a cutting edge operating system for enterprises looking to deploy the next generation of Solaris that includes the latest innovations from Sun and the OpenSource community. Download a copy and enjoy capabilities such as Networking, Storage and Virtualization. Go to: http://p.sf.net/sfu/opensolaris-get



Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users


Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.

Hi, I was able to replicate the issue, and I beleive the problem lies in the WFS_1_0_0_DataStore, lines 345-355:

try {
   URL url = protocolHandler.getDescribeFeatureTypeURLGet(typeName);
   if (url != null) {
     SimpleFeatureTypeBuilder build = new SimpleFeatureTypeBuilder();
     build.init(featureType);
     build.setNamespaceURI(url.toURI());
     featureType = build.buildFeatureType();
   }
} catch (URISyntaxException e) {
    throw (RuntimeException) new RuntimeException(e);
}

Gabriel: This logic seems wrong, it sets the namespce URI to the describefeaturetype request url?

For what it's worth commenting out that entire block makes things work.

-Justin

Juan Manuel Sánchez Martagón wrote:

    Hi Justin, I have found that debugging SchemaFactory class, we
    obtain a null schena

        private synchronized Schema getRealInstance(URI targetNamespace) {
            Schema r = (Schema) schemas.get(targetNamespace); // r is *null*
            ......
        }

    so WFSTransactionComplexTypes.encode return a NullException

        public void encode(Element element, Object value, PrintHandler
    output, Map hints) throws IOException, OperationNotSupportedException {

    ....
    Schema schema = SchemaFactory.getInstance( name.getNamespaceURI() );
    //*schema is null*
    Element els = schema.getElements(); //NullException

    .....
          }

     Is there any problem with the tagetNameSpace URI? It works
    registering the URI with next code, before making the commit.

    URI uri = new URI(store.getSchema().getName().getNamespaceURI());
    Schema schema = SchemaFactory.getInstance(uri ,uri, Level.FINE );
    ...
    insert.commit();

    PD: I think that you could invoke this method
              SchemaFactory.getInstance(uri ,uri, Level.FINE );
         instead of:
             SchemaFactory.getInstance( name.getNamespaceURI() ); at
             WFSTransactionComplexTypes.encode;

    Excuse my English,

    *Thank you very much*

    El 9 de junio de 2009 8:16, Juan Manuel Sánchez Martagón
    <peruxho@anonymised.com <mailto:peruxho@anonymised.com>> escribió:

        Hi, you are absolutely right, I realized yesterday that problem
        but I had to put the attribute ' version=1.0.0'
        to get the class instance of WFSFactoryStore and now I have
        another problem and the jvm throw this Exception in line
        'insert.commit();'.

        /java.lang.NullPointerException/
        / at
        org.geotools.xml.wfs.WFSTransactionComplexTypes$InsertElementType.encode(WFSTransactionComplexTypes.java:922)/
        / at
        org.geotools.xml.wfs.WFSTransactionComplexTypes$TransactionType.encode(WFSTransactionComplexTypes.java:306)/
        / at
        org.geotools.xml.DocumentWriter.writeFragment(DocumentWriter.java:316)/

        Excuse my English,

        *Thank you very much*

        El 9 de junio de 2009 5:50, Justin Deoliveira
        <jdeolive@anonymised.com <mailto:jdeolive@anonymised.com>> escribió:

            Hi,

            What is the value of geoServerConfig.getWFSServerUrl()?

            My guess is that it is incomplete, and does not include the
            "&request=GetCapabilities" parameter. Just a guess based on
            the error, and i tried a quick test using your code and when
            i left it off I indeed replicated the error message.

            -Justin

            Juan Manuel Sánchez Martagón wrote:

                Hi, We're working with Geoserver 1.7.3 and Geotools 2.5.5.

                We are trying to insert features in a Geoserver layer
                trough WFS transactions (like says at
                http://docs.codehaus.org/display/GEOTDOC/07+FeatureStore)
                but We have the next exception:

                org.geotools.data.DataSourceException: Exception Report
                Could not determine geoserver request
                     from http request
                org.apache.catalina.connector.RequestFacade@anonymised.com
                Exception Code:MissingParameterValue Locator: request

                executing this code:

                public static void addFeatures(String layer,
                List<Map<String, Object>> featAttribs) {

                          .....
                  Transaction insert = new DefaultTransaction("insert");
                                     map = new HashMap(); map.put(WFSDataStoreFactory.URL.key,
                geoServerConfig.getWFSServerUrl());
                           map.put(WFSDataStoreFactory.TIMEOUT.key, new
                Integer(10000));
                                     wfsDataStore = (new
                WFSDataStoreFactory()).createDataStore(map); featStore = (FeatureStore<SimpleFeatureType,
                SimpleFeature>) wfsDataStore.getFeatureSource( layer );
                           featStore.setTransaction(insert);

                           featBuilder = new
                SimpleFeatureBuilder(featStore.getSchema()); collection = FeatureCollections.newCollection();

                           for(Map<String, Object> featAttribsMap :
                featAttribs){
                               for(String key : featAttribsMap.keySet()){
                                   featBuilder.set(key,
                featAttribsMap.get(key)); }
                               //null para que genere un id por defecto
                               feat = featBuilder.buildFeature(null);
                               collection.add(feat);
                           }
                                     featStore.addFeatures( collection );
                           insert.commit();
                                     .......
                }

                Any advice please? (Thank you very much, this is my
                presentation message!)

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

                ------------------------------------------------------------------------------
                OpenSolaris 2009.06 is a cutting edge operating system
                for enterprises looking to deploy the next generation of
                Solaris that includes the latest innovations from Sun
                and the OpenSource community. Download a copy and enjoy
                capabilities such as Networking, Storage and
                Virtualization. Go to: http://p.sf.net/sfu/opensolaris-get

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

                _______________________________________________
                Geoserver-users mailing list
                Geoserver-users@lists.sourceforge.net
                <mailto:Geoserver-users@lists.sourceforge.net>
                https://lists.sourceforge.net/lists/listinfo/geoserver-users

            -- Justin Deoliveira
            OpenGeo - http://opengeo.org
            Enterprise support for open source geospatial.

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

------------------------------------------------------------------------------
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

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

_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

--
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.

Justin Deoliveira wrote:

Hi, I was able to replicate the issue, and I beleive the problem lies in the WFS_1_0_0_DataStore, lines 345-355:

try {
  URL url = protocolHandler.getDescribeFeatureTypeURLGet(typeName);
  if (url != null) {
    SimpleFeatureTypeBuilder build = new SimpleFeatureTypeBuilder();
    build.init(featureType);
    build.setNamespaceURI(url.toURI());
    featureType = build.buildFeatureType();
  }
} catch (URISyntaxException e) {
   throw (RuntimeException) new RuntimeException(e);
}

Gabriel: This logic seems wrong, it sets the namespce URI to the describefeaturetype request url?

I doubt that logic is new but standing on since gt-2.2 but I may be certainly wrong. It looks to me like a clear missconception 'cause what the DescribeFT URL is is the schemaLocation URL...
so if commenting out the whole block just works go for it and commit, I don't think the 1.0 DS cares about the actual namespace actually...

Gabriel

For what it's worth commenting out that entire block makes things work.

-Justin

Juan Manuel Sánchez Martagón wrote:

    Hi Justin, I have found that debugging SchemaFactory class, we
    obtain a null schena

        private synchronized Schema getRealInstance(URI targetNamespace) {
            Schema r = (Schema) schemas.get(targetNamespace); // r is *null*
            ......
        }

    so WFSTransactionComplexTypes.encode return a NullException

        public void encode(Element element, Object value, PrintHandler
    output, Map hints) throws IOException, OperationNotSupportedException {

    ....
    Schema schema = SchemaFactory.getInstance( name.getNamespaceURI() );
    //*schema is null*
    Element els = schema.getElements(); //NullException

    .....
          }

     Is there any problem with the tagetNameSpace URI? It works
    registering the URI with next code, before making the commit.

    URI uri = new URI(store.getSchema().getName().getNamespaceURI());
    Schema schema = SchemaFactory.getInstance(uri ,uri, Level.FINE );
    ...
    insert.commit();

    PD: I think that you could invoke this method
              SchemaFactory.getInstance(uri ,uri, Level.FINE );
         instead of:
             SchemaFactory.getInstance( name.getNamespaceURI() ); at
             WFSTransactionComplexTypes.encode;

    Excuse my English,

    *Thank you very much*

    El 9 de junio de 2009 8:16, Juan Manuel Sánchez Martagón
    <peruxho@anonymised.com <mailto:peruxho@anonymised.com>> escribió:

        Hi, you are absolutely right, I realized yesterday that problem
        but I had to put the attribute ' version=1.0.0'
        to get the class instance of WFSFactoryStore and now I have
        another problem and the jvm throw this Exception in line
        'insert.commit();'.

        /java.lang.NullPointerException/
        / at
        org.geotools.xml.wfs.WFSTransactionComplexTypes$InsertElementType.encode(WFSTransactionComplexTypes.java:922)/

        / at
        org.geotools.xml.wfs.WFSTransactionComplexTypes$TransactionType.encode(WFSTransactionComplexTypes.java:306)/

        / at
        org.geotools.xml.DocumentWriter.writeFragment(DocumentWriter.java:316)/

        Excuse my English,
        *Thank you very much*

        El 9 de junio de 2009 5:50, Justin Deoliveira
        <jdeolive@anonymised.com <mailto:jdeolive@anonymised.com>> escribió:

            Hi,

            What is the value of geoServerConfig.getWFSServerUrl()?

            My guess is that it is incomplete, and does not include the
            "&request=GetCapabilities" parameter. Just a guess based on
            the error, and i tried a quick test using your code and when
            i left it off I indeed replicated the error message.

            -Justin

            Juan Manuel Sánchez Martagón wrote:

                Hi, We're working with Geoserver 1.7.3 and Geotools 2.5.5.

                We are trying to insert features in a Geoserver layer
                trough WFS transactions (like says at
                http://docs.codehaus.org/display/GEOTDOC/07+FeatureStore)
                but We have the next exception:

                org.geotools.data.DataSourceException: Exception Report
                Could not determine geoserver request
                     from http request
                org.apache.catalina.connector.RequestFacade@anonymised.com
                Exception Code:MissingParameterValue Locator: request

                executing this code:

                public static void addFeatures(String layer,
                List<Map<String, Object>> featAttribs) {

                          .....
                  Transaction insert = new DefaultTransaction("insert");
                                     map = new HashMap(); map.put(WFSDataStoreFactory.URL.key,
                geoServerConfig.getWFSServerUrl());
                           map.put(WFSDataStoreFactory.TIMEOUT.key, new
                Integer(10000));
                                     wfsDataStore = (new
                WFSDataStoreFactory()).createDataStore(map); featStore = (FeatureStore<SimpleFeatureType,
                SimpleFeature>) wfsDataStore.getFeatureSource( layer );
                           featStore.setTransaction(insert);

                           featBuilder = new
                SimpleFeatureBuilder(featStore.getSchema()); collection = FeatureCollections.newCollection();

                           for(Map<String, Object> featAttribsMap :
                featAttribs){
                               for(String key : featAttribsMap.keySet()){
                                   featBuilder.set(key,
                featAttribsMap.get(key)); }
                               //null para que genere un id por defecto
                               feat = featBuilder.buildFeature(null);
                               collection.add(feat);
                           }
                                     featStore.addFeatures( collection );
                           insert.commit();
                                     .......
                }

                Any advice please? (Thank you very much, this is my
                presentation message!)

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

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

                OpenSolaris 2009.06 is a cutting edge operating system
                for enterprises looking to deploy the next generation of
                Solaris that includes the latest innovations from Sun
                and the OpenSource community. Download a copy and enjoy
                capabilities such as Networking, Storage and
                Virtualization. Go to: http://p.sf.net/sfu/opensolaris-get

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

                _______________________________________________
                Geoserver-users mailing list
                Geoserver-users@lists.sourceforge.net
                <mailto:Geoserver-users@lists.sourceforge.net>
                https://lists.sourceforge.net/lists/listinfo/geoserver-users

            -- Justin Deoliveira
            OpenGeo - http://opengeo.org
            Enterprise support for open source geospatial.

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

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

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

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

_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

--
Gabriel Roldan
OpenGeo - http://opengeo.org
Expert service straight from the developers.

Hi, First of all I have to say that I use Geotools and Geoserver a week ago and I may be wrong in my approach.
buscar
I’ve been debugged these lines (345-355) and I think the problem may be to record the URI of
targetNamespace (“http://127.0.0.1:8081/geoserver”)
and not
http://127.0.0.1:8081/geoserver/wfs?request=DescribeFeatureType&SERVICE=WFS&VERSION=1.0.0&TYPENAME=dap:PG_RECURSOS.

Then when prompted for the Scheme by SchemaFactory.getRealInstance(URI targetNamespace) is null because when it is invoke with other uri (http://127.0.0.1:8081/geoserver/wfs?request=DescribeFeatureType&SERVICE=WFS&VERSION=1.0.0&TYPENAME=dap:PG_RECURSOS. ).

I think there are two problems:

  1. You must register in SchemeFactory what you ask.
  2. You can avoid NullException using this method SchemaFactory.getInstance(uri ,uri, Level.FINE );

PD: I try with WFS_1_1_0_DataStore but throw UnsupportedOperationException in :
public FeatureWriter<SimpleFeatureType, SimpleFeature> getFeatureWriter(String typeName, Filter filter, Transaction transaction)

Excuse my English,

Thank you very much

El 9 de junio de 2009 21:14, Gabriel Roldan <groldan@anonymised.com> escribió:

Justin Deoliveira wrote:

Hi, I was able to replicate the issue, and I beleive the problem lies in the WFS_1_0_0_DataStore, lines 345-355:

try {
URL url = protocolHandler.getDescribeFeatureTypeURLGet(typeName);
if (url != null) {
SimpleFeatureTypeBuilder build = new SimpleFeatureTypeBuilder();
build.init(featureType);
build.setNamespaceURI(url.toURI());
featureType = build.buildFeatureType();
}
} catch (URISyntaxException e) {
throw (RuntimeException) new RuntimeException(e);
}

Gabriel: This logic seems wrong, it sets the namespce URI to the describefeaturetype request url?

I doubt that logic is new but standing on since gt-2.2 but I may be certainly wrong. It looks to me like a clear missconception 'cause what the DescribeFT URL is is the schemaLocation URL…
so if commenting out the whole block just works go for it and commit, I don’t think the 1.0 DS cares about the actual namespace actually…

Gabriel

For what it’s worth commenting out that entire block makes things work.

-Justin

Juan Manuel Sánchez Martagón wrote:

Hi Justin, I have found that debugging SchemaFactory class, we
obtain a null schena

private synchronized Schema getRealInstance(URI targetNamespace) {
Schema r = (Schema) schemas.get(targetNamespace); // r is null

}

so WFSTransactionComplexTypes.encode return a NullException

public void encode(Element element, Object value, PrintHandler
output, Map hints) throws IOException, OperationNotSupportedException {


Schema schema = SchemaFactory.getInstance( name.getNamespaceURI() );
//schema is null
Element els = schema.getElements(); //NullException


}

Is there any problem with the tagetNameSpace URI? It works
registering the URI with next code, before making the commit.

URI uri = new URI(store.getSchema().getName().getNamespaceURI());
Schema schema = SchemaFactory.getInstance(uri ,uri, Level.FINE );

insert.commit();

PD: I think that you could invoke this method
SchemaFactory.getInstance(uri ,uri, Level.FINE );
instead of:
SchemaFactory.getInstance( name.getNamespaceURI() ); at
WFSTransactionComplexTypes.encode;

Excuse my English,

Thank you very much

El 9 de junio de 2009 8:16, Juan Manuel Sánchez Martagón
<peruxho@anonymised.com…84… mailto:[peruxho@anonymised.com](mailto:peruxho@anonymised.com)> escribió:

Hi, you are absolutely right, I realized yesterday that problem
but I had to put the attribute ’ version=1.0.0’
to get the class instance of WFSFactoryStore and now I have
another problem and the jvm throw this Exception in line
‘insert.commit();’.

/java.lang.NullPointerException/
/ at
org.geotools.xml.wfs.WFSTransactionComplexTypes$InsertElementType.encode(WFSTransactionComplexTypes.java:922)/
/ at
org.geotools.xml.wfs.WFSTransactionComplexTypes$TransactionType.encode(WFSTransactionComplexTypes.java:306)/
/ at
org.geotools.xml.DocumentWriter.writeFragment(DocumentWriter.java:316)/

Excuse my English,
Thank you very much

El 9 de junio de 2009 5:50, Justin Deoliveira
<jdeolive@anonymised.com mailto:[jdeolive@anonymised.com](mailto:jdeolive@anonymised.com)> escribió:

Hi,

What is the value of geoServerConfig.getWFSServerUrl()?

My guess is that it is incomplete, and does not include the
“&request=GetCapabilities” parameter. Just a guess based on
the error, and i tried a quick test using your code and when
i left it off I indeed replicated the error message.

-Justin

Juan Manuel Sánchez Martagón wrote:

Hi, We’re working with Geoserver 1.7.3 and Geotools 2.5.5.

We are trying to insert features in a Geoserver layer
trough WFS transactions (like says at
http://docs.codehaus.org/display/GEOTDOC/07+FeatureStore)
but We have the next exception:

org.geotools.data.DataSourceException: Exception Report
Could not determine geoserver request
from http request
org.apache.catalina.connector.RequestFacade@anonymised.com
Exception Code:MissingParameterValue Locator: request

executing this code:

public static void addFeatures(String layer,
List<Map<String, Object>> featAttribs) {


Transaction insert = new DefaultTransaction(“insert”);
map = new HashMap(); map.put(WFSDataStoreFactory.URL.key,
geoServerConfig.getWFSServerUrl());
map.put(WFSDataStoreFactory.TIMEOUT.key, new
Integer(10000));
wfsDataStore = (new
WFSDataStoreFactory()).createDataStore(map); featStore = (FeatureStore<SimpleFeatureType,
SimpleFeature>) wfsDataStore.getFeatureSource( layer );
featStore.setTransaction(insert);

featBuilder = new
SimpleFeatureBuilder(featStore.getSchema()); collection = FeatureCollections.newCollection();

for(Map<String, Object> featAttribsMap :
featAttribs){
for(String key : featAttribsMap.keySet()){
featBuilder.set(key,
featAttribsMap.get(key)); }
//null para que genere un id por defecto
feat = featBuilder.buildFeature(null);
collection.add(feat);
}
featStore.addFeatures( collection );
insert.commit();

}

Any advice please? (Thank you very much, this is my
presentation message!)



OpenSolaris 2009.06 is a cutting edge operating system
for enterprises looking to deploy the next generation of
Solaris that includes the latest innovations from Sun
and the OpenSource community. Download a copy and enjoy
capabilities such as Networking, Storage and
Virtualization. Go to: http://p.sf.net/sfu/opensolaris-get



Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
mailto:[Geoserver-users@anonymised.come.net](mailto:Geoserver-users@lists.sourceforge.net)
https://lists.sourceforge.net/lists/listinfo/geoserver-users

– Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.



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



Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Gabriel Roldan
OpenGeo - http://opengeo.org
Expert service straight from the developers.