Layer7 API Management

Expand all | Collapse all

Import bundle with restman

  • 1.  Import bundle with restman

    Posted 11-22-2017 06:33 AM

    Hi all,

    I'm trying to import a bundle with restman on a new Gateway .. I exported it with a GET to:

     

    https://itnapsrv201:8443/restman/1.0/folders?name=TestFolder 

     

    and I'm trying to import with a PUT to:

     

    https://127.0.0.1:8443/restman/1.0/bundle

     

    I'm getting many errors like the following:

     

     

    ....

    <l7:Mapping action="NewOrExisting" errorType="InvalidResource" srcId="0755fc57a8ce7b31dde3391da6ab7f29" srcUri="https://oldGateway:8443/restman/1.0/resources/0755fc57a8ce7b31dde3391da6ab7f29" type="RESOURCE_ENTRY">
    <l7:Properties>
    <l7:Property key="ErrorMessage">
    <l7:StringValue>Duplicate entry '\xC1\xBDALO\x1F\xA5\xB6\x91c\xB2\xD7\x00+r\x82' for key 'PRIMARY'</l7:StringValue>
    </l7:Property>
    </l7:Properties>
    </l7:Mapping>
    <l7:Mapping action="NewOrExisting" errorType="InvalidResource" srcId="0237ac42b7f932ce2cf34193d1aa07aa" srcUri="https://oldGateway:8443/restman/1.0/services/0237ac42b7f932ce2cf34193d1aa07aa" type="SERVICE">
    <l7:Properties>
    <l7:Property key="ErrorMessage">
    <l7:StringValue>Duplicate entry '\xC1\xBDALO\x1F\xA5\xB6\x91c\xB2\xD7\x00+r\x82' for key 'PRIMARY'</l7:StringValue>
    </l7:Property>
    </l7:Properties>
    </l7:Mapping>
    <l7:Mapping action="NewOrExisting" errorType="InvalidResource" srcId="0237ac42b7f932ce2cf34193d1b450d1" srcUri="https://oldGateway:8443/restman/1.0/services/0237ac42b7f932ce2cf34193d1b450d1" type="SERVICE">
    <l7:Properties>
    <l7:Property key="ErrorMessage">
    <l7:StringValue>Duplicate entry '\xC1\xBDALO\x1F\xA5\xB6\x91c\xB2\xD7\x00+r\x82' for key 'PRIMARY'</l7:StringValue>

     

    ...

     

     

    Can you help me to understand what's wrong (I use many fragments...)?

     

    Thanks



  • 2.  Re: Import bundle with restman

    Posted 11-22-2017 10:15 AM

    More info ... it seems that this error is the one that create all the failure

     

     

    <l7:Mapping action="NewOrExisting" errorType="InvalidResource" srcId="6698993f02691da86351dbe8f3d651fa" srcUri="https://learn.l7tech.com:8443/restman/1.0/services/6698993f02691da86351dbe8f3d651fa" type="SERVICE">
    <l7:Properties>
    <l7:Property key="ErrorMessage">
    <l7:StringValue>Error attempting to save or update class com.l7tech.gateway.common.service.PublishedService. Message: Hibernate flushing: Could not execute JDBC batch update; uncategorized SQLException for SQL [insert into policy (name, version, security_zone_goid, folder_goid, guid, internal_sub_tag, internal_tag, soap, policy_type, `xml`, goid) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)]; SQL state [HY000]; error code [1366]; Incorrect string value: '\xE2\x80\xB254....' for column 'xml' at row 1; nested exception is java.sql.BatchUpdateException: Incorrect string value: '\xE2\x80\xB254....' for column 'xml' at row 1</l7:StringValue>
    </l7:Property>
    </l7:Properties>
    </l7:Mapping>

     

     

    it refers to one policy, if I remove that policy from the export everything goes well ... it should be interesting to know whats wrong with this policy...



  • 3.  Re: Import bundle with restman

    Posted 11-09-2018 11:42 PM

    We have seen this error in a few other instances and it had to do with the MySQL Collation setup as it should be utf8_general_ci.

     

    You can run the following commands to determine the collation being used:

     

    1. SELECT SCHEMA_NAME 'database', default_character_set_name 'charset',
    DEFAULT_COLLATION_NAME 'collation' FROM information_schema.SCHEMATA
    where schema_name='ssg';

    2. show variables like "character_set_database";

    3. SHOW FULL Columns FROM service_documents;

     

    Sincerely,

     

    Stephen Hughes

    CA Support