Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Problem with Init Servlet, even though Web.xml has it

    Hi, please give me some feedback. I am thinking why is it going to Use_Container, why not AUTO_Detect web root. How can I externally specify the Web root.

    Please let me know what is the problem.

    This is my web.xml file


    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
    http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    version="2.5"
    xmlns="http://java.sun.com/xml/ns/javaee">

    <context-param>
    <param-name>SERVER_PROPS</param-name>
    <param-value>/test/server.properties</param-value>
    </context-param>

    <listener>
    <listener-class>com.java.server.listener.DBServletContextListener</listener-class>
    </listener>

    <!-- ISC init: initializes ISC framework -->
    <servlet>
    <servlet-name>Init</servlet-name>
    <servlet-class>com.isomorphic.base.Init</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>

    <!-- standard spring configuration -->
    <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/applicationContext.xml</param-value>
    </context-param>

    <servlet>
    <servlet-name>context</servlet-name>
    <servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class>
    <load-on-startup>5</load-on-startup>
    </servlet>

    <!-- Note: The servlets/filters referenced here are documented in the SDK javadoc -->

    <!-- //>FileLoader -->
    <!-- Dynamic Compression -->
    <!-- <filter>
    <filter-name>CompressionFilter</filter-name>
    <filter-class>com.isomorphic.servlet.CompressionFilter</filter-class>
    </filter>-->
    <!-- CompressionFilter for dynamic compression -->
    <!-- <filter-mapping>
    <filter-name>CompressionFilter</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping>-->
    <!-- //<FileLoader -->

    <!-- The IDACall servlet handles all Built-in DataSource operations -->
    <servlet>
    <servlet-name>IDACall</servlet-name>
    <servlet-class>com.isomorphic.servlet.IDACall</servlet-class>
    </servlet>

    <!-- The DataSourceLoader servlet returns Javascript representations of the dataSources whose
    ID's are passed to it - it is an alternative to using the <loadDS> JSP tag -->
    <servlet>
    <servlet-name>DataSourceLoader</servlet-name>
    <servlet-class>com.isomorphic.servlet.DataSourceLoader</servlet-class>
    </servlet>

    <!-- The FileDownload servlet downloads static files, like a webserver -->
    <servlet>
    <servlet-name>FileDownload</servlet-name>
    <servlet-class>com.isomorphic.servlet.FileDownload</servlet-class>
    </servlet>

    <servlet>
    <servlet-name>HttpProxy</servlet-name>
    <servlet-class>com.isomorphic.servlet.HttpProxyServlet</servlet-class>
    </servlet>

    <!-- The PreCache servlet initializes when the servlet engine starts up and pre-loads
    data need for all client requests. This is optional, and improves performance
    of the first few page requests. PreCache cannot be invoked by a browser, because
    there is no "servlet-mapping" defined for it. -->

    <!-- PreCache is disabled by default because of an issue when debugging
    the project for the first time. However, it can be safely enabled
    when compiling with the GWT compiler prior to deployment. See
    the README.txt for more information. -->

    <!-- <servlet>
    <servlet-name>PreCache</servlet-name>
    <servlet-class>com.isomorphic.servlet.PreCache</servlet-class>
    <load-on-startup>2</load-on-startup>
    </servlet> -->

    <servlet>
    <servlet-name>jUnitHostImpl</servlet-name>
    <servlet-class>com.google.gwt.junit.server.JUnitHostImpl</servlet-class>
    </servlet>

    <!-- RPCManager uses this URL by default for Built-in DataSource operations -->
    <servlet-mapping>
    <servlet-name>IDACall</servlet-name>
    <url-pattern>/exportdatagui/sc/IDACall/*</url-pattern>
    </servlet-mapping>

    <!-- Built-in DataSource operations backcompat -->
    <servlet-mapping>
    <servlet-name>IDACall</servlet-name>
    <url-pattern>/exportdatagui/sc/IDACall.aspx/*</url-pattern>
    </servlet-mapping>

    <!-- DataSourceLoader requests -->
    <servlet-mapping>
    <servlet-name>DataSourceLoader</servlet-name>
    <url-pattern>/exportdatagui/sc/DataSourceLoader</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
    <servlet-name>HttpProxy</servlet-name>
    <url-pattern>/exportdatagui/sc/HttpProxy/*</url-pattern>
    </servlet-mapping>

    <!-- Use FileDownload servlet to download all static content that's part of the skin, such as
    image files, so we can set Expires headers and other cache control directives. In a
    production deployment, you'd want to use a webserver such as Apache to do this.
    -->
    <servlet-mapping>
    <servlet-name>FileDownload</servlet-name>
    <url-pattern>/exportdatagui/sc/skins/*</url-pattern>
    </servlet-mapping>

    <!-- serve ISC modules compressed, with expires headers -->
    <servlet-mapping>
    <servlet-name>FileDownload</servlet-name>
    <url-pattern>/exportdatagui/sc/system/modules/*</url-pattern>
    </servlet-mapping>

    <!-- serve ISC development modules compressed, with expires headers -->
    <servlet-mapping>
    <servlet-name>FileDownload</servlet-name>
    <url-pattern>/exportdatagui/sc/system/development/*</url-pattern>
    </servlet-mapping>

    <!-- server skin assets with expires headers -->
    <servlet-mapping>
    <servlet-name>FileDownload</servlet-name>
    <url-pattern>/exportdatagui/sc/system/reference/skin/*</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
    <servlet-name>jUnitHostImpl</servlet-name>
    <url-pattern>/exportdatagui/junithost/*</url-pattern>
    </servlet-mapping>

    <!-- General config -->
    <session-config>
    <session-timeout>30</session-timeout>
    </session-config>

    <jsp-config>
    <!-- Isomorphic JSP tags -->
    <taglib>
    <taglib-uri>isomorphic</taglib-uri>
    <taglib-location>/WEB-INF/iscTaglib.xml</taglib-location>
    </taglib>
    </jsp-config>

    <mime-mapping>
    <extension>manifest</extension>
    <mime-type>text/cache-manifest</mime-type>
    </mime-mapping>

    </web-app>


    This is the exception I am getting


    ISC: Configuring log4j from: file:/C:/Users/Rana/workspace/ExportDataGUI/test-classes/log4j.isc.config.xml
    === 2012-07-18 13:27:02,944 [main] INFO ConfigLoader - Attempting to load framework.properties from CLASSPATH
    === 2012-07-18 13:27:03,084 [main] INFO ConfigLoader - Successfully loaded framework.properties from CLASSPATH at location: jar:file:/C:/Users/Rana/Downloads/smartgwtee-2.5/lib/isomorphic_core_rpc.jar!/framework.properties
    === 2012-07-18 13:27:03,084 [main] INFO ConfigLoader - Attempting to load project.properties from CLASSPATH
    === 2012-07-18 13:27:03,084 [main] INFO ConfigLoader - Unable to locate project.properties in CLASSPATH
    === 2012-07-18 13:27:03,084 [main] INFO ConfigLoader - Successfully loaded isc_interfaces.properties from CLASSPATH at location: jar:file:/C:/Users/Rana/Downloads/smartgwtee-2.5/lib/isomorphic_core_rpc.jar!/isc_interfaces.properties
    === 2012-07-18 13:27:03,084 [main] INFO ConfigLoader - Attempting to load server.properties from CLASSPATH
    === 2012-07-18 13:27:03,094 [main] INFO ConfigLoader - Successfully loaded server.properties from CLASSPATH at location: file:/C:/Users/Rana/workspace/ExportDataGUI/test-classes/server.properties
    === 2012-07-18 13:27:03,104 [main] INFO ISCInit - Isomorphic SmartClient Framework - Initializing
    === 2012-07-18 13:27:03,104 [main] INFO Logger - Logging system started.
    === 2012-07-18 13:27:03,104 [main] INFO ISCInit - Isomorphic SmartClient Framework (SC_SNAPSHOT-2011-10-04/EVAL Deployment 2011-10-04) - Initialization Complete
    === 2012-07-18 13:27:03,114 [main] INFO ISCInit - No ServletContext available yet - using container IO for now
    Problem loading builtinTypes.xml
    Exception when loading from __USE_CONTAINER__/exportdatagui/sc/system/schema/builtinTypes.xml:
    java.io.IOException: Configured for containerIO, but servletContext not available! You need to install the Init servlet
    at com.isomorphic.io.ISCFile.<init>(ISCFile.java:139)
    at com.isomorphic.store.ProcessedFileCache.getObjectFromFile(ProcessedFileCache.java:138)
    at com.isomorphic.xml.XML.getXMLDocument(XML.java:254)
    at com.isomorphic.xml.XML.toDSRecords(XML.java:262)
    at com.isomorphic.xml.XML.toDSRecords(XML.java:265)
    at com.isomorphic.datasource.DataSource.<clinit>(DataSource.java:544)
    at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:1609)
    at com.java.server.ExportDataServer.retrieveDataFromDB(ExportDataServer.java:40)
    at com.java.server.ExportDataTest.testRetrieveDataFromDB(ExportDataTest.java:26)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at junit.framework.TestCase.runTest(TestCase.java:168)
    at junit.framework.TestCase.runBare(TestCase.java:134)
    at junit.framework.TestResult$1.protect(TestResult.java:110)
    at junit.framework.TestResult.runProtected(TestResult.java:128)
    at junit.framework.TestResult.run(TestResult.java:113)
    at junit.framework.TestCase.run(TestCase.java:124)
    at junit.framework.TestSuite.runTest(TestSuite.java:243)
    at junit.framework.TestSuite.run(TestSuite.java:238)
    at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

    === 2012-07-18 13:27:03,174 [main] INFO PoolManager - SmartClient pooling disabled for 'DataSource' objects
    === 2012-07-18 13:27:03,204 [main] INFO RepoRegistry - RepoRegistry unavailable: can't find RepoRegistry.ds.xml - using datasources.repo.default


    Thanks.

    #2
    Looks like you are trying to run the SmartGWT server outside of a servlet engine (for example, a command-line app), correct?

    If so, read the Standalone DataSource Usage overview in the "docs" package.

    Comment


      #3
      I am trying to test my server side logic in eclipse using JUnit. Ranned the test as Junit test case with all the required folders and jars.


      package com.java.gui.server;

      import junit.framework.TestCase;

      import org.junit.Test;

      import com.isomorphic.datasource.DSResponse;

      public class ExportDataTest extends TestCase {

      ExportDataServer export;

      @Test
      public void testRetrieveData() {

      String wsdlURL = "http://localhost:8080/db";
      String st = "123";
      String cc = "123";
      String dn1 = "123";
      String dn2 = "123";

      export = new ExportDataServer();

      DSResponse response = new DSResponse();

      response = export.retrieveData(wsdlURL, st, cc, dn1, dn2);

      assert((response.getStatus() >= 0) ? true : false);

      }

      }

      Thanks.

      Comment


        #4
        Yes. Now you need to read the Standalone DataSource Usage doc to find out the other required settings.

        Comment


          #5
          ok now I have specified my WebRoot to my project's war folder as said.

          I am getting this exception


          === 2012-07-18 14:01:10,294 [main] ERROR ISCInit - Can't find marker file for webRoot: C:/Users/Rana/workspace/ExportDataGUI/war/exportdatagui/sc for configured/autodetected webRoot - if you moved the 'isomorphic' directory, please set isomorphicPathRootRelative in server.properties to the new location and restart the servlet engine.
          Isomorphic Init: Exception in Init.go()
          java.lang.Exception: Configured webRoot path is invalid please check your server.properties setting. Current value is: C:/Users/Rana/workspace/ExportDataGUI/war


          What is Marker File?


          Problem loading builtinTypes.xml
          Exception when loading from C:/Users/Rana/workspace/ExportDataGUI/war/exportdatagui/sc/system/schema/builtinTypes.xml:
          java.io.FileNotFoundException: C:\Users\Rana\workspace\ExportDataGUI\war\exportdatagui\sc\system\schema\builtinTypes.xml (The system cannot find the path specified)


          Is that file my iscTagLib.xml file?

          Thanks.

          Comment


            #6
            The set of files that are normally copied to the war/<projectName>/sc folder by the GWT compiler must be under the webroot directory when running from the command line as well. The error message you're getting indicates those files are missing or misplaced.

            Comment


              #7
              I GWT Compiled my project and I only got rpcPolicyManifest which contains manifest.txt file.

              I am new to SmartGWT, so never mind I am asking everything.

              Can you let me know what I am missing to get those files.

              I have all these properties set up in my server.properties file

              isomorphicPathRootRelative: $gwtModuleName/sc

              project.datasources: $webRoot/ds
              project.ui: $webRoot/shared/ui
              project.apps: $webRoot/shared/app

              Thanks.

              Comment


                #8
                rpcPolicyManifest is unrelated.

                Based on your settings, the server is looking here:

                C:/Users/Rana/workspace/ExportDataGUI/war/exportdatagui/sc

                .. which is reported in the logs. The files are not there.

                Comment


                  #9
                  I am sorry, I did not see properly, the files are there.

                  But I have one question. In Standalone SmartGWT project I am fetching the data and exporting the data to excel sheet. But how can I send this back to third party client.

                  Also, for example in my code, if there is some error happened, I want to send an error to the user using Window class, and my test case gave an exception that it is used only for Client code, which makes sense.

                  But the question here is how can the third party client handles SmartGWT responses, both, success response - in my case, excel and error response - thinking about a popup.

                  Thanks.

                  Comment


                    #10
                    The RestHandler (see QuickStart and JavaDoc) provides a Rest interface that can be used by any third-party UI technology. Or you can build a servlet that accepts whatever the third-party UI technology already sends.

                    Exports are already returned by the RestHandler as normal HTTP responses (just like downloading any file), but there's also the API dsResponse.setExportTo() if you need to deliver the exported file in some other way, such as writing it to disk.

                    Comment


                      #11
                      Ok, after reading about RestHandler and RestDataSources, what I understood is that

                      I just need to specify the RestHandler servlet in web.xml and create a RestDataSource and set all the data to it and transform the response. Right.

                      Only thing I am thinking is that, how can third party UI can send me REST HTTP url with query string in it and how can I get that and retrieve the query string and create DSRequest, so that I can use to fetch the data.

                      Basically, I am new to Rest Web services also.

                      Thanks.

                      Comment


                        #12
                        No, this is not correct. Create server-side DataSources as usual using .ds.xml files (not RestDataSource). Add the RestHandler servlet to web.xml, and there is no need to write any server-side code for transforming responses or creating a DSRequest, the Rest interface to your .ds.xml-defined DataSources is just there, automatically.

                        As to how to create HTTP requests in other UI technologies, you would need to look at the documentation for those other technologies.

                        Comment


                          #13
                          I have created a servlet, and added the RestHandler to my web.xml.

                          I want to give a Rest Web service URL as input, and in this case what will be "defaultDataFormat" and "dynamicDataFormatParamName".

                          I did not get this part in JavaDocs.

                          The servlet also accepts parameter "defaultDataFormat". This governs whether we expect requests to be encoded as XML or JSON, if no explicit dataFormat is provided with the request. Note that the dataFormat is explicitly sent with every request if you are using the Isomorphic RestDataSource (see below), so this parameter has no effect in that case; it is only used when no dataFormat is provided with the request, as would be the case if you are integrating with a third-party REST client.

                          If you do not specify a defaultDataFormat, "xml" is assumed.

                          The servlet also accepts parameter "dynamicDataFormatParamName". This governs the name of the dataFormat parameter we look for in incoming requests (as described above in the paragraph about "defaultDataFormat"). If you wish to send the dataFormat to use with each client request, you send an HTTP parameter with this name in the request, with a value of "xml" or "json". By default, the "dynamicDataFormatParamName" is the value used by the SmartClient RestDataSource: "isc_dataFormat".


                          Thanks.

                          Comment


                            #14
                            You set these in web.xml, using the standard format for setting servlet parameters in general - this is not specific to SmartGWT. Try this article for example.

                            Comment


                              #15
                              I need to send the request parameter to my DMI from DS.xml.

                              For one of the parameter I did this.

                              $criteria.param_1

                              this parameter is used for Criteria. But I also need to send a parameter, that is not used for Criteria. Some thing like this.

                              $request.param_2 - I just need to pass this, so that I can populate this in my dsResponse (server-side).

                              How can I do that.

                              Thanks.

                              Comment

                              Working...
                              X