Class 'java.io.' is not present in JRE Emulation library INTELLIJ IDEA - gwt

I am working on a GWT project in IntelliJ IDEA 15.0.4. This project compileds and runs. But IntelliJ keeps telling me that java class files are not present in JRE Emulation Library.
Please help me! Is there something missing in my maven pom.xml?
Here are the error messages:
My pom.xml:
<properties>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
</properties>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<verbose>true</verbose>
<fork>true</fork>
<executable>/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/bin/javac</executable>
<compilerVersion>1.8</compilerVersion>
</configuration>
</plugin>
Here are my IntelliJ project config:
Timesheet.gwt.xml
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='Timesheet'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />
<inherits name="com.vaadin.polymer.Elements"/>
<!-- Inherit the default GWT style sheet. You can change -->
<!-- the theme of your GWT application by uncommenting -->
<!-- any one of the following lines. -->
<inherits name='com.google.gwt.user.theme.standard.Standard' />
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
<!-- Other module inherits -->
<!-- Specify the app entry point class. -->
<entry-point class='com.campus.client.Timesheet' />
<!-- Specify the paths for translatable code -->
<source path='client' />
<source path='shared' />
<!-- <inherits name="com.google.gwt.user.theme.standard.Standard"/> -->
<inherits name="com.google.gwt.user.theme.clean.Clean"/>
<!-- For production, most teams prefer to set the default log level to `OFF` -->
<inherits name="com.allen_sauer.gwt.log.gwt-log-OFF" />
<!-- For development, a default of `DEBUG` is recommended -->
<!-- <inherits name="com.allen_sauer.gwt.log.gwt-log-DEBUG" /> -->
</module>

Unless you have the full version of IntelliJ I would strongly suggest you to use Eclipse + GWT Plugin for GWT development.
This is the reference for GWT Jre emulated class, all that is in here will work on the client side:
http://www.gwtproject.org/doc/latest/RefJreEmulation.html#Package_java_io
In your particular case seems like IntelliJ cannot find the String class either, that points out to a deeper configuration issue than a GWT related one.

I seemed to have this problem when I installed Oracle JDK 9 in Arch Linux and used that as the project SDK. After I uninstalled Oracle JDK 9 and installed OpenJDK 8, and set that as the project SDK, no errors occurred anymore. I wonder if either Java 9 or Oracle JDK is just not very nicely supported by GWT.
Another possible cause of error is that maybe I set up the SDK incorrectly. First I pointed the SDK path to /usr/lib/jvm/default-runtime, but later I changed it to the actual path (/usr/lib/jvm/java-8-openjdk).

This will help you solve your issue.. I had same issue and tried to add the dependencies..
<gwt.version>2.7.0</gwt.version>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwt.version}</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
</dependency>

Related

GWT content not showing on centOS 7.5

I'm working on a project which is built on GWT. When we deployed the project on centOS 6.9 version it works fine and all the content is accessible or visible. However, when we changed the OS version to centOS7.5. It deployed successfully but upon accessing the index page it only shows waiting gif and then unable to load the java content.
Some of my observations during inspect element are as follow.
CentOS7.5
In centOS7.5 the content div is empty. I've no clue why the content isn't rendering by GWT. Didn't see any exception or stack trace in tomcat logs. I've also updates the dependency version in pom.xml but still getting the same results.
CentOS6.9
Also I've observed the difference source hierarchy. Same rpm is installed on both servers. CentOS7.5 doesn't showing the top_banner.jpg and /image directory.
The pom.xml is as follow, whereas the gwt.version = 2.9.0
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<version>${gwt.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwt.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
<scope>provided</scope>
</dependency>
Application.gwt.xml
<!DOCTYPE module PUBLIC "//gwt-module/" "http://google-web-toolkit.googlecode.com/svn/tags/2.4.0/distro-source/core/src/gwt-module.dtd">
<module rename-to="agentportal">
<add-linker name="xsiframe" />
<set-configuration-property name='xsiframe.failIfScriptTag' value='FALSE' />
<!-- Dependencies -->
<inherits name='com.google.gwt.user.User' />
<inherits name='com.seamless.gwt.components.Module' />
<inherits name='org.puremvc.PureMVC_Java_MultiCore' />
<inherits name='com.seamless.common.GWTModule' />
<inherits name='com.seamless.ers.interfaces.ersifcommon.GWTModule' />
<inherits name='com.seamless.ers.interfaces.ersifclient.GWTModule' />
<!-- ers-supportsystem-client-transport-ws -->
<inherits name="com.seamless.ers.components.supportsystem.interfaces.GWTModule"/>
<!-- ers-supportsystem-client -->
<inherits name="com.seamless.ers.interfaces.platform.clients.transaction.GWTModule"/>
<!-- ers-txe-client-model -->
<inherits name='com.seamless.ers.interfaces.platform.clients.GWTModule' />
<!-- Enable Debug IDs -->
<inherits name="com.google.gwt.user.Debug"/>
<inherits name="com.allen_sauer.gwt.log.gwt-log-DEBUG" />
<extend-property name="log_level" values="DEBUG,WARN" />
<!-- Disable DIV logger -->
<set-property name="log_DivLogger" value="DISABLED" />
<!-- What languages should be supported? -->
<extend-property name="locale" values="en" />
<extend-property name="locale" values="fr"/>
<extend-property name="locale" values="ar"/>
<inherits name='com.google.gwt.user.theme.chrome.Chrome' />
<entry-point class='com.seamless.ers.client.agentPortal.client.Application' />
<source path="client">
<exclude name="**/tests/*" />
</source>
<stylesheet src='Application.css' />
<servlet
class="com.seamless.ers.client.agentPortal.server.AgentPortalServiceImpl"
path="/agentportal_service" />
<servlet path="/sessionService" class="com.seamless.ers.client.agentPortal.server.SessionServiceImpl"/>
</module>
Side by side difference of deployments on both servers
In the above image, I can clearly see that there is a different in /WEB-INF. The classes and the deploy directory is almost empty. Along with other marked
Can someone please guide me what I'm missing here and what's the root cause of this issue and why it's occurring on centOS7.5.
I was facing the same issue against GWT. The issue is at parser level of GWT. I had "_" as variable in my Screen.java class which extended com.google.gwt.user.client.ui:Composite
Upon renaming the variable name and refactoring the code the screen loaded for me. Please try doing it this way.

Does the application server JBoss include CXF installation?

I'm trying to set the CXF Runtime on Eclipse web services preferences window.
I'm trying to point to JBoss installation in my pc at :
C:\jboss-eap-6.3\modules\system\layers\base\org\apache\cxf
But I'm getting error : Missing CXF jar: Please select the CXF home directory.
Shouldn't JBoss include a working CXF installation ?
Jboss AS 7.x have the dependency for apache CXF, you can use that by loading the module in your web application. There are a lot of way to achieve this on of common is setting apache cfx module as global module which will loaded into memory as the application server will started. Add the following lines in standalone.xml of jboss server-
<subsystem xmlns="urn:jboss:domain:ee:1.0" >
<global-modules>
<module name="org.apache.cxf" slot="main" />
</global-modules>
</subsystem>
If you want to add the module as web application dependent then you can use jboss-deployment-structure.xml-
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="org.apache.cxf" services="import">
<imports>
<include path="**" />
</imports>
</module>
</dependencies>
</deployment>
</jboss-deployment-structure>
and if you are using the maven build the you can load the module by manifest entry for the dependency-
<build>
...
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<Dependencies>org.apache.cxf</Dependencies>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>

GWT 2.5.1 SuperDevMode not enabled

i work on a GWT/GWTPHONEGAP/MGWT project and i need using gwt 2.5.1 with SuperdevMode.
I use maven and the following command "classpath gwt:runcodeServer", when i compile my project no error occur, but when i go to my webBrowser to using superDevMode, it's impossible to recompile, the error message is "this module has doesn't have Super Dev mode enabled" although my *.gwt.xml contains the following line enabled superDevMode.
<add-linker name="xsiframe"/>
<set-configuration-property name="devModeRedirectEnabled" value="true"/>
<set-property name="compiler.useSourceMaps" value="true" />
with following entrypoint
<entry-point class="**.**.*.client.MgwtAppEntryPoint" />
When i go to the localhost:9876 the project is present & source are available.
Following my configuration of maven :
jetty :
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.1.2.v20140210</version>
<configuration>
<reload>manual</reload>
<httpConnector>
<port>9090</port><!-- port 8080 already use by tiviz-web -->
</httpConnector>
<webApp>
<baseResource implementation="org.eclipse.jetty.util.resource.ResourceCollection">
<resourcesAsCSV>src/main/webapp,${basedir}/target/tiviz-gwt-0.0.1-SNAPSHOT</resourcesAsCSV>
</baseResource>
<extraClasspath>${basedir}/src/main/webapp/WEB-INF/classes</extraClasspath>
<allowDuplicateFragmentNames>true</allowDuplicateFragmentNames>
</webApp>
<systemProperties>
<systemProperty>
<name>gwt.codeserver.port</name>
<value>9876</value>
</systemProperty>
</systemProperties>
</configuration>
</plugin>
and my configuration of gwt-maven-plugin
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<!-- Plugin configuration. There are many available options, see gwt-maven-plugin
documentation at codehaus.org -->
<configuration>
<!-- run params -->
<copyWebapp>false</copyWebapp>
<productionMode>false</productionMode>
</configuration>
</plugin>
problem come from an bad configuration in the path of my webapp ressource in jetty plugin.

GWT Does Not Load *.nocache.js

I have this Maven project built with the gwt-maven-archetype. While it runs perfectly with the mvn gwt:run goal, however when i try to run it in the tomcat7 container either mvn tomcat:run or mvn gwt:compile && mvn tomcat:run it does not load the GWT Dynamically created widgets.
According to the Google Chrome console it cannot find the *.nocache.js file even though in the /target/ folder it is exactly where it is expected to be.
I am currently trying to display a simple "Hello" Label in the Entry Point Module :
GWT Entry Point
public class Hello implements EntryPoint {
public void onModuleLoad() {
Label hello = new Label("TESTESTSTSTS");
RootPanel.get("helloContainer").add(hello);
}
}
*.html
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link type="text/css" rel="stylesheet" href="veltisto.css">
<title>Web Application Starter Project</title>
<script type="text/javascript" language="javascript" src="veltisto/veltisto.nocache.js"></script>
</head>
<body>
<iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe>
<noscript>
<div style="width: 22em; position: absolute; left: 50%; margin-left: -11em; color: red; background-color: white; border: 1px solid red; padding: 4px; font-family: sans-serif">
Your web browser must have JavaScript enabled
in order for this application to display correctly.
</div>
</noscript>
<div id="helloContainer"></div>
</body>
</html>
POM.XML
<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">
<!-- POM file generated with GWT webAppCreator -->
<modelVersion>4.0.0</modelVersion>
<groupId>gr.veltisto</groupId>
<artifactId>web</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>GWT Maven Archetype</name>
<properties>
<!-- Convenience property to set the GWT version -->
<gwtVersion>2.4.0</gwtVersion>
<!-- GWT needs at least java 1.5 -->
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwtVersion}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwtVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
<classifier>sources</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.gwtbootstrap</groupId>
<artifactId>gwt-bootstrap</artifactId>
<version>2.0.4.0</version>
</dependency>
</dependencies>
<build>
<!-- Generate compiled stuff in the folder used for developing mode -->
<outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
<plugins>
<!-- Copy static web files before executing gwt:run -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>exploded</goal>
</goals>
</execution>
</executions>
<configuration>
<webappDirectory>${webappDirectory}</webappDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.0</version>
<configuration>
<path>/veltisto</path>
</configuration>
</plugin>
<!-- GWT Maven Plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.4.0</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
<!-- Plugin configuration. There are many available options,
see gwt-maven-plugin documentation at codehaus.org -->
<configuration>
<runTarget>veltisto.html</runTarget>
<hostedWebapp>${webappDirectory}</hostedWebapp>
</configuration>
</plugin>
</plugins>
</build>
</project>
*.GWT.XML
<module rename-to='veltisto'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />
<inherits name="com.google.gwt.uibinder.UiBinder" />
<!-- We need the JUnit module in the main module, -->
<!-- otherwise eclipse complains (Google plugin bug?) -->
<inherits name='com.google.gwt.junit.JUnit' />
<!-- Inherit the default GWT style sheet. You can change -->
<!-- the theme of your GWT application by uncommenting -->
<!-- any one of the following lines. -->
<inherits name='com.google.gwt.user.theme.standard.Standard' />
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
<!-- Other module inherits -->
<inherits name="com.google.gwt.uibinder.UiBinder" />
<inherits name="com.github.gwtbootstrap.Bootstrap" />
<!-- Specify the app entry point class. -->
<entry-point class='gr.veltisto.web.client.Hello' />
<!-- Specify the paths for translatable code -->
<source path='client' />
<source path='shared' />
</module>
tomcat7:run only uses the src/main/webapp. You'll want to use tomcat7:run-war (which will do a package) or tomcat7:run-war-only (if you already have a war:exploded structure).
Using firebug or chrome's inspector, do you see that the .nocache.js and .cache.html file loaded correctly? Or is there an error like a 404? If there is a 404, look in the path specified by the error in your war directory - is the file there?
If the .nocache.js file is missing or in the wrong place, it likely means that the path from the *.html page you listed to the compiled JS is wrong.
If the .cache.html file is missing, it often means that the gwt:compile was skipped, or that gwt:run or gwt:debug was running during or after the compile. Do not do gwt:compile followed by gwt:run or :debug:, as these latter two will remove the compiled files.
One final thought: The tomcat:run phase might be trying to grab a completed .war file, and your war:exploded will not create one. Additionally, when you run gwt:compile, this may not cause a completed compiled war directory to be build. To deal with all of these, consider getting your build working to produce a war file first, and then try to make tomcat:run behave. The first step here would be to map gwt:compile to the prepare-package phase, then make sure that the finished war contains the .nocache.js and .cache.html files as expected.

How would I give the GWT-compiler more memory when using GWT-Maven?

We have a Maven build that runs the GWT plugin (gwt-maven). Unfortently it is running out of memory.
Do I need to give Maven itself more heap or do I need to give GWT more heap? Any idea how to specify this for a pom.xml file?
I assume extraJvmArgs option should be configured.
Add extraJvmArgs tag under configuration tag for gwt-maven-plugin.
Example -
<!-- GWT Maven Plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwtVersion}</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<version>${gwtVersion}</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwtVersion}</version>
</dependency>
</dependencies>
<!-- JS is only needed in the package phase, this speeds up testing -->
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
<!-- Plugin configuration. There are many available options, see gwt-maven-plugin
documentation at codehaus.org -->
<configuration>
<runTarget>app.html</runTarget>
<!-- Turning This on after understanding soyc and when deferredjs count is 48.cache.js -->
<!-- https://developers.google.com/web-toolkit/articles/fragment_merging -->
<fragmentCount>25</fragmentCount>
-->
<!-- Ask GWT to create the Story of Your Compile (SOYC) (gwt:compile) -->
<!-- Turn This on for generating soyc. This does not work if closure compiler is turned on.-->
<!-- Start Generating SOYC -->
<compileReport>true</compileReport>
<compilerMetrics>true</compilerMetrics>
<soycDetailed>true</soycDetailed>
<!-- End Generating SOYC -->
<disableCastChecking>true</disableCastChecking>
<disableClassMetadata>true</disableClassMetadata>
<enableClosureCompiler>true</enableClosureCompiler>
<optimizationLevel>9</optimizationLevel>
<style>${gwt.style}</style>
<module>${gwtModule}</module>
<encoding>${project.build.sourceEncoding}</encoding>
<strict>true</strict>
<logLevel>INFO</logLevel>
<copyWebapp>true</copyWebapp>
<hostedWebapp>
${project.build.directory}/${project.artifactId}
</hostedWebapp>
<extraJvmArgs>-Xmx896M -Xms896m -XX:PermSize=64m -XX:MaxPermSize=128m</extraJvmArgs>
<!-- <extraJvmArgs>-Xmx896M -Xms896m -XX:PermSize=64m -XX:MaxPermSize=128m -XX:+UseConcMarkSweepGC -server</extraJvmArgs> -->
</configuration>
</plugin>
I had this error with a large GWT project. The error that you will probably see when running out of memory is:
[ERROR] OutOfMemoryError: Increase heap size of lower gwt.jjs.maxThreads
java.lang.OutOfMemoryError: Java heap space
The extraJvmArgs option needs to be set in conjunction with the MAVEN_OPTS environment variable (this is a possible explanation). I also set the Java -Dgwt.compiler.localWorkers=x option to reduce the number of concurrent compilation threads (I set x to 1, but you can play with it to find something that works).
For an example of the settings you should use with the extraJvmArgs option, see this post.
Note that you may need to add the extraJvmArgs option to the plugin element configuration directly - see https://stackoverflow.com/a/5822929/157605.