Error Failed to load the widgetset

Hi, I asked this before, but would like to create a new topic because several time passed. Original topic was : Can't get login after migrating to Cuba 7 - #7 от пользователя gorelov

The issue is I’m retaking an “old” project from other developer of my team. A migration from Cuba 6 to 7. Project builds and so on, but once tomcat starts and try to open the site, I get an error

Failed to load the widgetset: ./VAADIN/widgetsets/com.haulmont.charts.web.widgets.ChartsWidgetSet/com.haulmont.charts.web.widgets.ChartsWidgetSet.nocache.js?1642672569205

With this on my webconsole:
Failed to load resource: the server responded with a status of 404 () :8080/komerzia/VAADIN/widgetsets/com.haulmont.charts.web.widgets.ChartsWidgetSet/com.haulmont.charts.web.widgets.ChartsWidgetSet.nocache.js?1642675175028:1

I readed several posts about this, and all talks about cuba.web.widgeset in web-app.properties.

On this file, I find this
cuba.web.widgetSet=com.komenco.komerziaerp.web.toolkit.ui.AppWidgetSet

I tried to remove, and to change to com.haulmont.cuba.web.widgets.WidgetSet too. I droped tomcat as suggested on my old topic, all with the same result.

Not sure if related, but property has different color on my file BTW:
image

I found a file too, com.komenco.komerziaerp.web.tookit.ui.AppWidgeset.gwt.xml with this content:

<?xml version="1.0" encoding="UTF-8"?>
<module>
    
    <inherits name="com.haulmont.cuba.web.widgets.WidgetSet" />
    <inherits name="com.haulmont.charts.web.widgets.ChartsWidgetSet" />
</module>

The thing is I have no idea how it was resolved in the past, and why I have the same problem now and how to solve it.

Thanks.

Note: As far as I remember, we don’t use custom componentes, only custom styling, but this project was mainly developed by another team member, not me.

Hi @giuseppe
Could you please show the build.gradle file? It looks like something went wrong during migration.
And could you clarify which version was project migrated from?

Regards,
Nadezhda.

Hi Nadezhda.

Well, because I didn’t get with the issue. I started again the migration process, version by version from v6. Now I’m on v7.0 solving some issues before jump to v7.1, and I didn’t get this error anymore (yet)

Well, happened again.

This is my complete event log from Cuba Studio 2020.2

26/01/2022
16:10	New CUBA Platform releases are available
			Details

16:11	CUBA Add-on Updates
			The following CUBA add-on is ready to update: Runtime diagnose
			Ignore for this project

16:20	Test containers sync complete
			Updated test containers:
			KomerziaerpTestContainer

16:23	CUBA Add-on Updates
			The following CUBA add-ons are ready to update: Reporting, Charts, Business Process Management, Full Text Search
			Ignore for this project

16:24	Project undeployed

16:24	Project undeployed

16:25	Web-toolkit module has been created

16:27	CUBA Add-on Updates
			The following CUBA add-ons are ready to update: Reporting, Charts, Business Process Management, Full Text Search
			Ignore for this project

16:33	Test containers sync complete
			Updated test containers:
			KomerziaerpTestContainer

16:33	CUBA Platform version 7.0.0 set in the project is ignored
			Details

16:34	Project undeployed

16:34	Project undeployed

Happened when I updated Runtime diagnosis, it said I had premium repos in my gradle and removed it. Now my project has the issue mentioned earlier again.
This is my build.gradle file.

buildscript {
    ext.cubaVersion = '7.0.12'
    repositories {
        maven {
            url 'https://repo.cuba-platform.com/content/groups/work'
            credentials {
                username(rootProject.hasProperty('repoUser') ? rootProject['repoUser'] : 'cuba')
                password(rootProject.hasProperty('repoPass') ? rootProject['repoPass'] : 'cuba123')
            }
        }
    }
    dependencies {
        classpath "com.haulmont.gradle:cuba-plugin:$cubaVersion"
    }
}

def modulePrefix = 'komerzia'

def globalModule = project(":${modulePrefix}-global")
def coreModule = project(":${modulePrefix}-core")
def guiModule = project(":${modulePrefix}-gui")
def webModule = project(":${modulePrefix}-web")
def webToolkitModule = project(":${modulePrefix}-web-toolkit")

def servletApi = 'javax.servlet:javax.servlet-api:3.1.0'
apply(plugin: 'cuba')

cuba {
    artifact {
        group = 'com.komenco.komerziaerp'
        version = '0.1'
        isSnapshot = true
    }
    tomcat {
        dir = "$project.rootDir/deploy/tomcat"


    }
    ide {
        vcs = 'Git'
    }
}

dependencies {
    appComponent("com.haulmont.cuba:cuba-global:$cubaVersion")
    appComponent('de.diedavids.cuba.runtimediagnose:runtime-diagnose-global:1.3.0')
    appComponent("com.haulmont.reports:reports-global:$cubaVersion")
    appComponent("com.haulmont.fts:fts-global:$cubaVersion")
    appComponent("com.haulmont.charts:charts-global:$cubaVersion")
    appComponent("com.haulmont.bpm:bpm-global:$cubaVersion")

}

def postgres = 'org.postgresql:postgresql:42.2.9'

configure([globalModule, coreModule, guiModule, webModule, webToolkitModule]) {
    apply(plugin: 'java')
    apply(plugin: 'maven')
    apply(plugin: 'cuba')

    dependencies {
        testCompile('junit:junit:4.12')
    }

    task sourceJar(type: Jar) {
        from file('src')
        classifier = 'sources'
    }

    artifacts {
        archives sourceJar
    }
}

configure(globalModule) {

    dependencies {
        compile('org.apache.poi:poi-ooxml:3.17') {}
        if (!JavaVersion.current().isJava8()) {
            runtime('javax.xml.bind:jaxb-api:2.3.1')
            runtime('org.glassfish.jaxb:jaxb-runtime:2.3.1')
        }
    }
    entitiesEnhancing {
        main { enabled = true }
    }

    jar {
        manifest {
            attributes('App-Component-Id': cuba.artifact.group)
            attributes('App-Component-Version': cuba.artifact.version + (cuba.artifact.isSnapshot ? '-SNAPSHOT' : ''))
        }
    }


}

configure(coreModule) {

    configurations {
        jdbc
        dbscripts
    }

    dependencies {
        compile(globalModule)
        compileOnly(servletApi)
        jdbc(postgres)
        testRuntime(postgres)

    }

    task cleanConf(description: 'Cleans up conf directory') {
        doLast {
            def dir = new File(cuba.tomcat.dir, "/conf/${modulePrefix}-core")
            if (dir.isDirectory()) {
                ant.delete(includeemptydirs: true) {
                    fileset(dir: dir, includes: '**/*', excludes: 'local.app.properties')
                }
            }
        }
    }

    task deploy(dependsOn: [assemble, cleanConf], type: CubaDeployment) {
        appName = "${modulePrefix}-core"
        appJars(modulePrefix + '-global', modulePrefix + '-core')
    }

    task createDb(dependsOn: assembleDbScripts, description: 'Creates local database', type: CubaDbCreation) {
        dbms = 'postgres'
        host = 'localhost'
        dbName = 'newkomerziamigra'
        dbUser = 'postgres'
        dbPassword = 'postgres'
    }

    task updateDb(dependsOn: assembleDbScripts, description: 'Updates local database', type: CubaDbUpdate) {
        dbms = 'postgres'
        host = 'localhost'
        dbName = 'newkomerziamigra'
        dbUser = 'postgres'
        dbPassword = 'postgres'
    }
}

configure(guiModule) {
    dependencies {
        compile(globalModule)

    }

    task deployConf(type: Copy) {
        from file('src')
        include "com/komenco/komerziaerp/**"
        into "$cuba.tomcat.dir/conf/${modulePrefix}"
    }
}

configure(webModule) {
    configurations {
        webcontent
    }

    dependencies {
        compileOnly(servletApi)
        compile(guiModule)

    }

    jar {
        with copySpec {
            from sourceSets.main.allJava
            include "com/komenco/komerziaerp/web/toolkit/ui/client/**"
        }
    }

    task webArchive(type: Zip) {
        from file("$buildDir/web")
        from file('web')
        classifier = 'web'
    }

    artifacts {
        archives webArchive
    }

    task deployConf(type: Copy) {
        from file('src')
        include "com/komenco/komerziaerp/**"
        into "$cuba.tomcat.dir/conf/${modulePrefix}"
    }

    task clearMessagesCache(type: CubaClearMessagesCache) {
        appName = "${modulePrefix}"
    }
    deployConf.dependsOn clearMessagesCache

    task cleanConf(description: 'Cleans up conf directory') {
        doLast {
            def dir = new File(cuba.tomcat.dir, "/conf/${modulePrefix}")
            if (dir.isDirectory()) {
                ant.delete(includeemptydirs: true) {
                    fileset(dir: dir, includes: '**/*', excludes: 'local.app.properties')
                }
            }
        }
    }

    task deploy(dependsOn: [assemble, cleanConf], type: CubaDeployment) {
        appName = "${modulePrefix}"
        appJars(modulePrefix + '-global', modulePrefix + '-gui', modulePrefix + '-web')
    }
    task buildScssThemes(type: CubaWebScssThemeCreation)
    task deployThemes(type: CubaDeployThemeTask, dependsOn: buildScssThemes)
    assemble.dependsOn buildScssThemes

    task themesJar(type: Jar) {
        from file('themes')
        classifier = 'themes'
    }

    artifacts {
        archives themesJar
    }
}

configure(webToolkitModule) {
    dependencies {
        compile(webModule)
    }

    jar {
        from sourceSets.main.allJava
    }

    task buildWidgetSet(type: CubaWidgetSetBuilding) {
        widgetSetClass = 'com.komenco.komerziaerp.web.toolkit.ui.AppWidgetSet'
    }

    task debugWidgetSet(type: CubaWidgetSetDebug) {
        widgetSetClass = 'com.komenco.komerziaerp.web.toolkit.ui.AppWidgetSet'
    }

    task webArchive(dependsOn: buildWidgetSet, type: Jar) {
        from file("$buildDir/web")
        classifier = 'client'
    }

    artifacts {
        archives webArchive
    }

    task deploy(dependsOn: webArchive, type: Copy) {
        from webArchive
        into "$cuba.tomcat.dir/webapps/${modulePrefix}/WEB-INF/lib"
    }
}


task undeploy(type: Delete, dependsOn: ":${modulePrefix}-web:cleanConf") {
    delete("$cuba.tomcat.dir/shared")
    delete("$cuba.tomcat.dir/webapps/${modulePrefix}-core")
    delete("$cuba.tomcat.dir/webapps/${modulePrefix}")
}

task restart(dependsOn: ['stop', ":${modulePrefix}-core:deploy", ":${modulePrefix}-web:deploy", ":${modulePrefix}-web-toolkit:deploy"], description: 'Redeploys applications and restarts local Tomcat') {
    doLast {
        ant.waitfor(maxwait: 6, maxwaitunit: 'second', checkevery: 2, checkeveryunit: 'second') {
            not {
                socket(server: 'localhost', port: '8787')
            }
        }
        start.execute()
    }
}


apply from: 'extra.gradle'


task buildWar(type: CubaWarBuilding) {
    coreContextXmlPath = 'modules/core/web/META-INF/war-context.xml'
    webXmlPath = 'modules/web/web/WEB-INF/single-war-web.xml'
    appHome = './komerzia'
    includeContextXml = true
    includeJdbcDriver = true
    appProperties = ['cuba.automaticDatabaseUpdate'                            : true,
                     'cuba.web.productionMode'                                 : true,
                     'cuba.gui.genericFilterMaxResultsOptions'                 : 'NULL, 20, 50, 100, 500, 1000, 5000, 50000, 5000000',                         
                     'license.concurrentSessionsLimit'                         : 100,
                     'reporting.openoffice.docx.useOfficeForDocumentConversion': true,
                     'reporting.openoffice.docFormatterTimeout'                : 900,
                     'reporting.backgroundReportProcessingTimeoutMs'           : 900000,
                     'cuba.schedulingActive'                                   : true]
}

Hi @giuseppe

I tried to reproduce the problem using your scenario but unfortunately, I couldn’t. Probably we will be able to help you if you send us a small sample project that demonstrates the issue.

Regards,
Nadezhda.

I can send you the whole project if you want, just tell me how.

You could zip your project using zipProject Gradle task and attach it there or send it to me in a private message.

Hi @giuseppe

Thank you for the sent project.

The reason for the problem was that after the migration, the cuba.web.widgetSet property was added to the web/bin/com/komenco/komerziaerp/web-app.properties file instead of the web/src/com/komenco/komerziaerp/web-app.properties. Adding the property in the file web-app.properties from web/src/.. catalogue solves the problem.

It seems the project is quite old, newer CUBA versions don’t use the bin directory.

Regards,
Nadezhda.

Project comes from v6 before Intellij plugin, when Cuba Studio standalone existed. I will try thanks. Can I safely delete the bin folder then?

I had removed the bin folder from web module and the app had started successfully but I’m not sure about other modules.