1
votes

I develop an application on MobileFirst V7. It calls HTTP adapter and returns data. It can run in preview on my Eclipse. I deploy it to MobileFirst server (using WAS Liberty Profile) and run it in preview, When I call adapter it raises an error that its log in messages.log is:

[4/28/15 23:34:16:681 EDT] 00000213 org.apache.wink.server.internal.RequestProcessor

I got the following error that occurred during the invocation of the handlers chain:

WebApplicationException (404 - Not Found) with message 'null' while processing POST request sent to http://127.0.0.1:9080/TestApp/authorization/v1/clients/preview

This is my server.xml

<server description="new server">
    <featureManager>
        <feature>jsp-2.2</feature>
        <feature>ssl-1.0</feature>
        <feature>servlet-3.0</feature>
        <feature>jdbc-4.0</feature>
        <feature>appSecurity-1.0</feature>
        <feature>jndi-1.0</feature>
        <feature>ssl-1.0</feature>
        <feature>servlet-3.0</feature>
        <feature>jdbc-4.0</feature>
        <feature>jndi-1.0</feature>
        <feature>restConnector-1.0</feature>
        <feature>appSecurity-1.0</feature>
        <feature>ssl-1.0</feature>
        <feature>servlet-3.0</feature>
        <feature>jdbc-4.0</feature>
        <feature>jndi-1.0</feature>
    </featureManager>
    <httpEndpoint id="defaultHttpEndpoint"
                  host="*"
                  httpPort="9080"
                  httpsPort="9443" >
        <tcpOptions soReuseAddr="true"/>
    </httpEndpoint>
    <basicRegistry>
        <user name="WorklightRESTUser" password="Bc7CGrb9DCuF"/>
        <user name="admin" password="admin"/>
        <user name="demo" password="demo"/>
        <user name="appcenteradmin" password="admin"/>
        <group name="appcentergroup">
            <member name="demo"/>
            <member name="appcenteradmin"/>
        </group>
    </basicRegistry>

    <application id="appcenterconsole" name="appcenterconsole" location="appcenterconsole.war" type="war">
        <application-bnd>
            <security-role name="appcenteradmin">
                <group name="appcentergroup"/>
            </security-role>
        </application-bnd>
    </application>

    <application id="applicationcenter" name="applicationcenter" location="applicationcenter.war" type="war">
        <application-bnd>
            <security-role name="appcenteradmin">
                <group name="appcentergroup"/>
            </security-role>
        </application-bnd>
        <classloader delegation="parentLast">
            <commonLibrary>
                <fileset dir="${wlp.install.dir}/lib" includes="com.ibm.ws.crypto.passwordutil_1.0.1.jar"/>
            </commonLibrary>
        </classloader>
    </application>

    <jndiEntry jndiName="android.aapt.dir" value='"/opt/IBM/MobileFirst_Platform_Server/ApplicationCenter/tools/android-sdk"'/>

    <library id="DB2Lib">
        <fileset dir="${shared.resource.dir}/db2" includes="*.jar"/>
    </library>

    <dataSource jndiName="jdbc/AppCenterDS" transactional="false">
        <jdbcDriver libraryRef="DB2Lib"/>
        <properties.db2.jcc databaseName="APPCNTR" serverName="127.0.0.1" portNumber="50001" user="db2inst1" password="{xor}Lz4sLChvLTs="/>
    </dataSource>

    <keyStore id="defaultKeyStore" password="worklight"/>

    <administrator-role>
        <user>WorklightRESTUser</user>
    </administrator-role>
    <jndiEntry jndiName="ibm.worklight.admin.jmx.host" value="localhost"/>
    <jndiEntry jndiName="ibm.worklight.admin.jmx.port" value="9443"/>
    <jndiEntry jndiName="ibm.worklight.admin.jmx.user" value="WorklightRESTUser"/>
    <jndiEntry jndiName="ibm.worklight.admin.jmx.pwd" value="Bc7CGrb9DCuF"/>
    <jndiEntry jndiName="ibm.worklight.topology.platform" value="Liberty"/>
    <jndiEntry jndiName="ibm.worklight.topology.clustermode" value="Standalone"/>
    <webContainer invokeFlushAfterService="false" deferServletLoad="false"/>
    <executor id="default" name="LargeThreadPool"
              coreThreads="200" maxThreads="400" keepAlive="60s"
              stealPolicy="STRICT" rejectedWorkPolicy="CALLER_RUNS"/>

    <application id="worklightadmin" name="worklightadmin" location="worklightadmin.war" type="war">
        <application-bnd>
            <security-role name="worklightadmin">
                <user name="admin"/>
            </security-role>
            <security-role name="worklightdeployer">
            </security-role>
            <security-role name="worklightmonitor">
            </security-role>
            <security-role name="worklightoperator">
            </security-role>
        </application-bnd>
        <classloader delegation="parentLast">
            <commonLibrary id="worklightlib_worklightadmin">
                <fileset dir="${wlp.install.dir}/lib" includes="com.ibm.ws.crypto.passwordutil_1.0.1.jar"/>
            </commonLibrary>
        </classloader>
    </application>

    <library id="worklightadmin/DB2Lib">
        <fileset dir="${shared.resource.dir}/worklightadmin/db2" includes="db2jcc4.jar,db2jcc_license_cu.jar"/>
    </library>

    <dataSource jndiName="worklightadmin/jdbc/WorklightAdminDS" transactional="false">
        <jdbcDriver libraryRef="worklightadmin/DB2Lib"/>
        <properties.db2.jcc databaseName="WLADMIN" serverName="127.0.0.1" portNumber="50001" user="db2inst1" password="{xor}Lz4sLChvLTs=" currentSchema="WLADMSC"/>
    </dataSource>

    <application id="worklightconsole" name="worklightconsole" location="worklightconsole.war" type="war">
        <application-bnd>
            <security-role name="worklightadmin">
                <user name="admin"/>
            </security-role>
            <security-role name="worklightdeployer">
            </security-role>
            <security-role name="worklightmonitor">
            </security-role>
            <security-role name="worklightoperator">
            </security-role>
        </application-bnd>
    </application>

    <jndiEntry jndiName="worklightconsole/ibm.worklight.admin.endpoint" value='"*://*:*/worklightadmin"'/>

    <application id="TestApp" name="TestApp" location="TestApp.war" type="war">
        <classloader delegation="parentLast">
            <privateLibrary id="worklightlib_TestApp">
                <fileset dir="${shared.resource.dir}/TestApp/lib" includes="worklight-jee-library.jar"/>
                <fileset dir="${wlp.install.dir}/lib" includes="com.ibm.ws.crypto.passwordutil_1.0.1.jar"/>
            </privateLibrary>
        </classloader>
    </application>

    <jndiEntry jndiName="TestApp/publicWorkLightProtocol" value='"http"'/>
    <jndiEntry jndiName="TestApp/publicWorkLightPort" value='"9080"'/>

    <library id="TestApp/DB2Lib">
        <fileset dir="${shared.resource.dir}/TestApp/db2" includes="*.jar"/>
    </library>

    <dataSource jndiName="TestApp/jdbc/WorklightDS" transactional="false">
        <jdbcDriver libraryRef="TestApp/DB2Lib"/>
        <properties.db2.jcc databaseName="WRKLGHT" serverName="127.0.0.1" portNumber="50001" user="db2inst1" password="{xor}Lz4sLChvLTs=" currentSchema="WRKSCHM"/>
    </dataSource>

    <dataSource jndiName="TestApp/jdbc/WorklightReportsDS" transactional="false">
        <jdbcDriver libraryRef="TestApp/DB2Lib"/>
        <properties.db2.jcc databaseName="WLREPORT" serverName="127.0.0.1" portNumber="50001" user="db2inst1" password="{xor}Lz4sLChvLTs=" currentSchema="WLRESCHM"/>
    </dataSource>

</server>
1

1 Answers

1
votes

Preview is not meant to work in a production environment, however the preview button was still there in the GM release of MFPF 7.0.

I think you might have hit APAR PI37266:

MFP OPERATIONS CONSOLE: PREVIEW OF COMMON RESOURCES BUTTON MUST BE HIDDEN IN PRODUCTION ENVIRONMENT.

So, you should update your installation to the latest available 7.0 iFix, where the preview button is no longer available. To get the latest iFix, you need to login to the IBM Fix Central website and search for "mobilefirst platform" to get the latest.

If you still see the preview button after upgrading to the latest iFix, try to force-clear your browser's cache. You can also verify this by inspecting the Network view > Preview tab in Chrome's DevTools. it should show a list of properties for the request/response, one of them being "developmentMode:true/false"). It should be set to false.