Announcement

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

    EvalVersion / compiling datasource module takes for ... ever

    Hi there,

    We have been developing an quite large application with SmartGWT LGPL from 2012 to 2014, adding features to it till 2016.
    Now that the company has grown a bit, we need to rebuild everything from scratch. After evaluating Angular, Vaadin+Spring,
    we are still convinced that SmartGWT is the best solution. The tradeoff for us is certainly on the graphical look aspect.
    But we are satisfied by the direction taken with the Tahoe skin, "breathing" better.
    We now intend to upgrade to the SmartGWT Power edition.

    So I have downloaded the evaluation version.
    Our very first goal is to get familiar with the datasource mechanism since for database migration, we'll have to make use of our java @Entity beans from the previous version of our application.

    Our 2012 application still relies on Ant. We intend to use Maven for the next version.
    I must say I was a bit bewildered when I discovered there is no predefined pom.xml template delivered with the evaluation version.
    I had to put one together, compiling pieces of information from different sources that are rarely up to date on the specific maven topic (smartGWT docs, smartgwt forums, smartclient wiki, stackoverflow, isc-maven-plugin github site).

    Well it seems I have a working pom file now - I wish a good soul can check it to make sure it is correct (I include it below)

    Question 1
    I put together a simple project : one datasource based on a single java hibernate bean, and one entry point. Source code is taken from the showcase.
    It compiles. The war file gets built.
    I tried to run it in superdev mode. In the DevMode console (devmode and jetty tabs), nothing seems wrong.

    But when I try to access the page with Chrome, it says it has to compile the datasource, which it starts to do it on a 1st permutation, but never ends.
    After 30 minutes of full 8 cores CPU at 100%, I have to stop it, I don't want to burn my motherboard.

    I assume I made a mistake somewhere.
    Also I have a concern about datasource compilation at runtime that is likely to slow down the application as it will contains numerous hibernate datasources.



    Question 2
    I have seen that SmartGWT 6.1p relies on Hibernate 3.6.10.Final for Hibernate datasource.
    I intend to use the most recent version of Hibernate (5.2.12.Final) in order to use the most recent version of Hibernate Search Orm (5.8.2.Final)
    Does it make a problem/conflict ?


    Thank you for you welcomed help,
    Elie

    <smartgwt.version>6.1-p20171110</smartgwt.version>
    <gwt.version>2.8.2</gwt.version>
    Java 1.8_40
    Eclipse maven


    Code:
    package com.smartgwt.sample.client;
    
    public class AutoDeriveHibernateSample implements EntryPoint {  
        @Override  
        public void onModuleLoad() {  
            final ListGrid listGrid = new ListGrid();  
            listGrid.setWidth(900);  
            listGrid.setHeight(224);  
            listGrid.setAlternateRecordStyles(true);  
            listGrid.setDataSource(DataSource.get("supplyItemHBAutoDerive"));  
            listGrid.setCanEdit(true);  
            listGrid.setCanRemoveRecords(true);  
            listGrid.setDataFetchMode(FetchMode.LOCAL);  
            listGrid.setAutoFetchData(true);  
            listGrid.setUseAllDataSourceFields(true);  
            listGrid.setShowFilterEditor(true);  
    
            IButton newButton = new IButton("Add New");  
            newButton.addClickHandler(new ClickHandler() {  
                public void onClick(ClickEvent event) {  
                    listGrid.startEditingNew();  
                }  
            });  
            VLayout layout = new VLayout(15);  
            layout.addMember(listGrid);  
            layout.addMember(newButton);  
    
            layout.draw();  
        }
    }
    Code:
    <DataSource
        ID="supplyItemHBAutoDerive"
        serverType="hibernate"
        autoDeriveSchema="true"
        schemaBean="com.smartgwt.sample.server.SupplyItemHB"
        dbImportFileName="/ds/test_data/supplyItem.data.xml">
        <fields>
            <field name="itemID" hidden="true"/>
        </fields>
    </DataSource>



    Trace below
    [INFO] Scanning for projects...
    [INFO]
    [INFO] ------------------------------------------------------------------------
    [INFO] Building Maven Archetype for GWT 1.0-SNAPSHOT
    [INFO] ------------------------------------------------------------------------
    [INFO]
    [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ appqse_v3 ---
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] Copying 1 resource
    [INFO]
    [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ appqse_v3 ---
    [INFO] Nothing to compile - all classes are up to date
    [INFO]
    [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ appqse_v3 ---
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] Copying 0 resource
    [INFO]
    [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ appqse_v3 ---
    [INFO] Nothing to compile - all classes are up to date
    [INFO]
    [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ appqse_v3 ---
    [INFO]
    [INFO] --- gwt-maven-plugin:2.8.2:compile (default) @ appqse_v3 ---
    [INFO] auto discovered modules [com.smartgwt.sample.HibernateDS]
    [INFO] com.smartgwt.sample.HibernateDS is up to date. GWT compilation skipped
    [INFO]
    [INFO] --- maven-war-plugin:2.2:war (default-war) @ appqse_v3 ---
    [INFO] Packaging webapp
    [INFO] Assembling webapp [appqse_v3] in [/Users/semiosys/semiowork/clients/qse/dev3/appqse_v3/target/appqse_v3-1.0-SNAPSHOT]
    [INFO] Processing war project
    [INFO] Copying webapp resources [/Users/semiosys/semiowork/clients/qse/dev3/appqse_v3/src/main/webapp]
    [INFO] Webapp assembled in [433 msecs]
    [INFO] Building war: /Users/semiosys/semiowork/clients/qse/dev3/appqse_v3/target/appqse_v3-1.0-SNAPSHOT.war
    [INFO] WEB-INF/web.xml already added, skipping
    [INFO]
    [INFO] >>> gwt-maven-plugin:2.8.2:run (default-cli) > process-classes @ appqse_v3 >>>
    [INFO]
    [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ appqse_v3 ---
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] Copying 1 resource
    [INFO]
    [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ appqse_v3 ---
    [INFO] Nothing to compile - all classes are up to date
    [INFO]
    [INFO] <<< gwt-maven-plugin:2.8.2:run (default-cli) < process-classes @ appqse_v3 <<<
    [INFO]
    [INFO] --- gwt-maven-plugin:2.8.2:run (default-cli) @ appqse_v3 ---
    [INFO] create exploded Jetty webapp in /Users/semiosys/semiowork/clients/qse/dev3/appqse_v3/target/appqse_v3-1.0-SNAPSHOT
    [INFO] auto discovered modules [com.smartgwt.sample.HibernateDS]
    [INFO] Super Dev Mode starting up
    [INFO] workDir: /var/folders/1z/cx5yvhx94k528hq00c4ytxzc0000gn/T/gwt-codeserver-1491839983193078041.tmp
    [ERROR] SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
    [ERROR] SLF4J: Defaulting to no-operation (NOP) logger implementation
    [ERROR] SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
    [INFO] Loading Java files in com.smartgwt.sample.HibernateDS.
    [INFO] Module setup completed in 6624 ms
    [INFO]
    [INFO] The code server is ready at http://127.0.0.1:9876/
    [INFO] === SmartClient Init: log4j.isc.config.xml not found in CLASSPATH. Assuming log4j configuration for com.isomorphic is located in some other log4j configuration file.
    [ERROR] log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
    [ERROR] log4j:WARN Please initialize the log4j system properly.
    [ERROR] log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
    [INFO] Invoking Linker SmartGwtScriptInjector
    [INFO] Creating loadScriptTagFiles.js to manually load the following script tags:
    [INFO] sc/initsc.js
    [INFO] sc/modules/ISC_Core.js?isc_version=11.1p_2017-11-10.js
    [INFO] sc/modules/ISC_Foundation.js?isc_version=11.1p_2017-11-10.js
    [INFO] sc/modules/ISC_Containers.js?isc_version=11.1p_2017-11-10.js
    [INFO] sc/modules/ISC_Grids.js?isc_version=11.1p_2017-11-10.js
    [INFO] sc/modules/ISC_Forms.js?isc_version=11.1p_2017-11-10.js
    [INFO] sc/modules/ISC_RichTextEditor.js?isc_version=11.1p_2017-11-10.js
    [INFO] sc/modules/ISC_Calendar.js?isc_version=11.1p_2017-11-10.js
    [INFO] sc/modules/ISC_DataBinding.js?isc_version=11.1p_2017-11-10.js
    [INFO] sc/skins/Enterprise/load_skin.js
    [INFO] GET /recompile/hibernateds
    [INFO] Job com.smartgwt.sample.HibernateDS_1_0
    [INFO] starting job: com.smartgwt.sample.HibernateDS_1_0
    [INFO] binding: user.agent=safari
    [INFO] Compiling module com.smartgwt.sample.HibernateDS
    [INFO] Unification traversed 52943 fields and methods and 3774 types. 3741 are considered part of the current module and 3741 had all of their fields and methods traversed.
    [INFO] Warnings in com/google/gwt/emul/java/util/Arrays.java
    [INFO] [WARN] Line 1782: [unusable-by-js] Type of parameter 'd1' in 'int Arrays.1methodref$compare$Type.compare(long, long)' is not usable by but exposed to JavaScript.
    [INFO] [WARN] Line 1782: [unusable-by-js] Type of parameter 'd2' in 'int Arrays.1methodref$compare$Type.compare(long, long)' is not usable by but exposed to JavaScript.
    [INFO] [WARN] Suppress "[unusable-by-js]" warnings by adding a `@SuppressWarnings("unusable-by-js")` annotation to the corresponding member.
    [INFO] Compiling 1 permutation
    [INFO] Compiling permutation 0...
    [INFO] Linking per-type JS with 3720 new/changed types.
    ... lasts 30+ minutes ...

    pom.xml below
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    
        <modelVersion>4.0.0</modelVersion>
        <groupId>com.qse</groupId>
        <artifactId>appqse_v3</artifactId>
        <packaging>war</packaging>
        <version>1.0-SNAPSHOT</version>
        <name>Maven Archetype for GWT</name>
        <!-- https://forums.smartclient.com/forum/smart-gwt-technical-q-a/236142-creating-maven-eclipse-project-with-smartgwt 
            http://github.smartclient.com/isc-maven-plugin/examples/example-pom.html 
            https://github.com/checketts/gwt-spring-demo/blob/master/pom.xml https://forums.smartclient.com/forum/smart-gwt-technical-q-a/237005-compiling-running-packaging-and-debugging-sgwt-in-maven-project 
            GOOD -->
        <properties>
            <!-- Convenience property to set the GWT version -->
            <gwt.version>2.8.2</gwt.version>
            <smartgwt.version>6.1-p20171110</smartgwt.version>
            <!-- GWT 2.8 requires 1.8 -->
            <maven.compiler.source>1.8</maven.compiler.source>
            <maven.compiler.target>1.8</maven.compiler.target>
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        </properties>
    
        <dependencyManagement>
            <dependencies>
                <dependency>
                    <groupId>com.google.gwt</groupId>
                    <artifactId>gwt</artifactId>
                    <version>${gwt.version}</version>
                    <type>pom</type>
                    <scope>import</scope>
                </dependency>
            </dependencies>
        </dependencyManagement>
    
        <dependencies>
            <dependency>
                <groupId>com.isomorphic.smartgwt.eval</groupId>
                <artifactId>smartgwt-eval</artifactId>
                <version>${smartgwt.version}</version>
            </dependency>
    
            <dependency>
                <groupId>com.isomorphic.smartgwt.eval</groupId>
                <artifactId>isomorphic-hibernate</artifactId>
                <version>${smartgwt.version}</version>
                <exclusions> 
                    <exclusion> <!-- Otherwise : compilation error -->
                        <groupId>asm</groupId>
                        <artifactId>asm</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
    
            <dependency>
                <groupId>com.isomorphic.smartgwt.eval</groupId>
                <artifactId>isomorphic-jpa</artifactId>
                <version>${smartgwt.version}</version>
            </dependency>
    
            <!-- Add support for SQLDataSources -->
            <dependency>
                <groupId>com.isomorphic.smartgwt.eval</groupId>
                <artifactId>isomorphic-sql</artifactId>
                <version>${smartgwt.version}</version>
            </dependency>
    
    
            <dependency>
                <groupId>org.hsqldb</groupId>
                <artifactId>hsqldb</artifactId>
                <version>2.4.0</version>
            </dependency>
    
            <dependency>
                <groupId>commons-dbcp</groupId>
                <artifactId>commons-dbcp</artifactId>
                <version>1.4</version>
            </dependency>
    
            <dependency>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok</artifactId>
                <version>1.16.18</version>
                <scope>provided</scope>
            </dependency>
    
       <dependency>
                <groupId>com.google.gwt</groupId>
                <artifactId>gwt-servlet</artifactId>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>com.google.gwt</groupId>
                <artifactId>gwt-user</artifactId>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>com.google.gwt</groupId>
                <artifactId>gwt-dev</artifactId>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>4.11</version>
                <scope>test</scope>
            </dependency>
    
           <dependency>
                <groupId>org.hibernate</groupId>
                <artifactId>hibernate-core</artifactId>
                <version>3.6.10.Final</version>
            </dependency>
    
        </dependencies>
    
        <build>
            <directory>target</directory>
            <!-- Generate compiled stuff in the folder used for developing mode -->
            <outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
            <plugins>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>gwt-maven-plugin</artifactId>
                    <version>2.8.2</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>compile</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <runTarget>index.html</runTarget>
                    </configuration>
                </plugin>
    
                <plugin>
                    <groupId>com.isomorphic</groupId>
                    <artifactId>isc-maven-plugin</artifactId>
                    <version>1.2.1</version>
                    <configuration>
                        <license>LGPL</license>
                        <buildNumber>${smartgwt.version}</buildNumber>
                        <buildDate>${smartgwt.date}</buildDate>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </project>

    #2
    It's unfortunate that you did not discover that we already have Maven support - it's in the docs, and is the first hit when googling SmartGWT Maven.

    Given your odd problems, the first thing to do is probably to throw away what you've done and start over using the built-in support.

    The step you show is not compiling DataSources (there is no such process) but simply a GWT compile of your application. The first time ever that this happens, resources such as media needed for skins are copied from our module files into your deployment. Even this first compilation should not take anything like 30 minutes, but there are a handful of users for whom this step takes a long time. There is some discussion here, but no definitive solution that works for all affected users, yet.

    Finally, no, using Hibernate 5 won't work because they deprecated many core APIs with no direct replacements, so we are working on a port to Hibernate 5, but that will be in future versions.

    We also would not, for now, recommend using Hibernate 5 in general - in the process of trying to support it, we are seeing public, documented methods being moved around and deprecated in minor releases - it's still very much in flux.

    Comment

    Working...
    X