GChart on GAE wont show - eclipse

I am using Eclipse with GAE on a MacBook Pro with GChart. My problem is that I cant get any chart to show when I am developing, but when I use regular tools such as Buttons or Labels with GAE they work just fine. The code doesn't give me any errors, so I am assuming that I have the right code:
public class TestingTesting implements EntryPoint {
public void onModuleLoad() {
GChart graf = new GChart();
graf.setTitle("testing");
graf.setChartSize(200, 200);
graf.addCurve();
graf.getCurve().getSymbol().setFillThickness(2);
for (int i = 0; i < 10; i++)
graf.getCurve().addPoint(i,i*i);
Button btnOk = new Button("Ok");
RootPanel.get("chartdiv").add(graf);
RootPanel.get("button").add(btnOk);
}
}
and my TestingTesting.gwt.xml file looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='testingtesting'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />
<!-- 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.googlecode.gchart.GChart' />
<!-- Specify the app entry point class. -->
<entry-point class='test.gchart.sollution.client.TestingTesting' />
<!-- Specify the paths for translatable code -->
<source path='client' />
<source path='shared' />
</module>
My TestingTesting.html looks like this:
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Chart Example</title>
<script type="text/javascript" language="javascript"
src="testingtesting/testingtesting.nocache.js"></script>
</head>
<body>
<div id="chartdiv"></div>
<div id="button"></div>
</body>
</html>
other than that, my structure of the project in Eclipse is
/
- gchart.jar
- App Engine SDK [App Engine 1.3.5]
- GWT SDK [GWT - 2.0.4]
- JRE System Library
- src
-- test.gchart.sollution
--- TestingTesting.gwt.xml
-- test.gchart.sollution.client
--- TestingTesting.java
-- test.gchart.sollution.server
-- test.gchart.sollution.shared
--- FieldVerifier.java
- META-INF
-- jdoconfig.xml
- log4j.properties
- war
-- TestTest.html
- WEB-INF
-- appengine-web.xml
-- logging.properties
-- web.xml
Can anyone help me to figure out what the problem might be? The button shows without any problem, but the chart doesn't?

I figuered out what I've made wrong.
I forgot on the TestingTesting.java to include
RootPanel.get("chartdiv").add(graf);
graf.update(); // you have to update your graph before it renders

Related

MySampleApplication clickme button does not appear when deployed to container

I have built a new project using GWT. If I run the project from the Intellij IDEA IDE after a few seconds the 'clickme' control appears in the browser and everything works as expected.
I have created an artifact for a application war file, which is created in the expected ../out/artifact folder.
When I deploy the .war file to apache tomcat, and click on the webapp in the apache tomcat manager I just get the list of files under the webapps/MySampleApplication file location.
If I select the MySampleAppliacation.html file I see the text in that html file but the 'clickme' button never appears.
I have done a lot of googling but have not solved the problem. I checked and the gwt-user.jar file is in the lib folder of the webapp.
This is the GWT control file
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.0//EN"
"http://google-web-toolkit.googlecode.com/svn/releases/2.0/distro-source/core/src /gwt-module.dtd">
<module rename-to="MySampleApplication">
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User'/>
<!-- Specify the app entry point class. -->
<entry-point class='com.mySampleApplication.client.MySampleApplication'/>
<!-- Specify the app servlets. -->
<servlet path='/MySampleApplicationService' class='com.mySampleApplication.server.MySampleApplicationServiceImpl'/>
</module>
This is the project html page
<html>
<head>
<title>Wrapper HTML for App</title>
<link type="text/css" rel="stylesheet" href="MySampleApplication.css">
<!-- -->
<!-- This script is required bootstrap stuff. -->
<!-- -->
<script type="text/javascript" language="javascript"
src="MySampleApplication/MySampleApplication.nocache.js"></script>
</head>
<body>
<h1>Sample Application</h1>
<p>
This is an example of a host page for the App application.
You can attach a Web Toolkit module to any HTML page you like,
making it easy to add bits of AJAX functionality to existing pages
without starting from scratch.
</p>
<table align="center">
<tr>
<td id="slot1"></td>
<td id="slot2"></td>
</tr>
</table>
</body>
</html>
For good measure, here are all the files under webapps for this project
MySampleApplication\index.html
MySampleApplication\MySampleApplication
MySampleApplication\MySampleApplication.css
MySampleApplication\MySampleApplication.html
MySampleApplication\WEB-INF
MySampleApplication\MySampleApplication\0651E8A6D149EEF5E6386F087426CF0A.cache.html
MySampleApplication\MySampleApplication\0CE0D511D927FEB65BA6F6D96F24D2D4.cache.html
MySampleApplication\MySampleApplication\3C8C88AE707243315A0D688BD60B8CCA.cache.html
MySampleApplication\MySampleApplication\4A4AEE91A97252CBA376B9B27863F6ED.cache.html
MySampleApplication\MySampleApplication\644584634D68B773C08A73FA726669A5.gwt.rpc
MySampleApplication\MySampleApplication\clear.cache.gif
MySampleApplication\MySampleApplication\D003F7646BFEF3B8BE562132E77EFE59.cache.html
MySampleApplication\MySampleApplication\hosted.html
MySampleApplication\MySampleApplication\MySampleApplication.nocache.js
MySampleApplication\WEB-INF\classes
MySampleApplication\WEB-INF\web.xml
MySampleApplication\WEB-INF\classes\com
MySampleApplication\WEB-INF\classes\com\mySampleApplication
MySampleApplication\WEB-INF\classes\com\mySampleApplication\client
MySampleApplication\WEB-INF\classes\com\mySampleApplication\MySampleApplication.gwt.xml
MySampleApplication\WEB-INF\classes\com\mySampleApplication\server
MySampleApplication\WEB-INF\classes\com\mySampleApplication\client\MySampleApplication$1.class
MySampleApplication\WEB-INF\classes\com\mySampleApplication\client\MySampleApplication$MyAsyncCallback.class
MySampleApplication\WEB-INF\classes\com\mySampleApplication\client\MySampleApplication.class
MySampleApplication\WEB-INF\classes\com\mySampleApplication\client\MySampleApplicationService$App.class
MySampleApplication\WEB-INF\classes\com\mySampleApplication\client\MySampleApplicationService.class
MySampleApplication\WEB-INF\classes\com\mySampleApplication\client\MySampleApplicationServiceAsync.class
MySampleApplication\WEB-INF\classes\com\mySampleApplication\server\MySampleApplicationServiceImpl.class
About the only other thing would be the IDEA project module settings......
I am VERY appreciative or your help Andy.

Can't rename gwt-module

I've read this and decided to rename my gwt-module, but got a fault. IDEA automaticaly generates test.gwt.xml when I create GWT-module project. It put:
<module rename-to="test">
inside test.gw.xml. If I remove "rename-to ..." and run app, GWT-plugin gives me an error. It seems to be nesessary in gwt.xml. It is contradictional with "Renaming Modules" part of article. Why can't I remove or rename?
Here is test.gwt.xml:
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.0//EN"
"http://google-web-toolkit.googlecode.com/svn/releases/2.0/distro-source/core/src/gwt-module.dtd">
<module rename-to="test2">
<inherits name='com.google.gwt.user.User'/>
<entry-point class='com.ibm.temp.client.test'/>
<servlet path='/testService' class='com.ibm.temp.server.testServiceImpl'/>
</module>
And test.html:
<html>
<head>
<title>Wrapper HTML for App</title>
<link type="text/css" rel="stylesheet" href="test.css">
<script type="text/javascript" language="javascript" src="com.ibm.temp.test/com.ibm.temp.test.nocache.js"></script>
</head>
<body>
<h1>Simple Application</h1>
<div id="input-container"/>
</body>
</html>
Change script tag like this.The problem is that ur browser cannot find the nocache.js file.
If module rename to abc , nocache.js will be in war/abc/abc.noacache.js
If module not renamed,it will be in war/full package name of gwt.xml/full package name.nocache.js
For your case it will be as,
<script type="text/javascript" language="javascript" src="test2/test2.nocache.js"></script>

GWT grails plugin ERROR resource.ResourceMeta - Resource not found: %nocache.js

I'm having trouble using the GWT-Grails plugin. I tried to follow this example exactly, but I end up having this error:
| Error 2012-10-28 00:25:49,567 [http-bio-8080-exec-2] ERROR resource.ResourceMeta - Resource not found: /gwt/g3wt.Application/g3wt.Application.nocache.js
I get this error after I enter these commands: ( I am simply following this guide here )
>grails create-app g3wt
>cd g3wt
>grails install-plugin gwt
>grails create-gwt-module g3wt.Application
>grails create-gwt-page main/index.gsp g3wt.Application
>grails run-app
>grails run-gwt-client
this is the index.gsp code (which is autogenerated anyway):
<html>
<head>
<!-- Integrate with Sitemesh layouts -->
<meta name="layout" content="main" />
<!-- -->
<!-- Any title is fine -->
<!-- -->
<title>Example title (change this!)</title>
<!-- -->
<!-- This script loads your compiled module. -->
<!-- If you add any GWT meta tags, they must -->
<!-- be added before this line. -->
<!-- -->
<script type="text/javascript" src="${resource(dir: 'gwt/g3wt.Application', file: 'g3wt.Application.nocache.js')}"></script>
</head>
<!-- -->
<!-- The body can have arbitrary html, or -->
<!-- you can leave the body empty if you want -->
<!-- to create a completely dynamic ui -->
<!-- -->
<body>
<!-- OPTIONAL: include this if you want history support -->
<iframe id="__gwt_historyFrame" style="width:0;height:0;border:0"></iframe>
<!-- Add the rest of the page here, or leave it -->
<!-- blank for a completely dynamic interface. -->
</body>
</html>
I understand that the nocache.js cannot be found, so I thought I could try to see where exactly it is. However, using the eclipse search function, it shows that the file is not created at all. Although there is a file named application.js.
Why is the nocache.js not created, and how do I fix this? I've been stumped for a while now, and it's frustrating.
I'm using gwt plugin 0.7.1 and grails 2.1.1, with eclipse 4.2 and a Linux machine.
I was having the same problem and found the answer here.
buildconfig.groovy is in the conf folder. Just comment out the plugin where the runtime is ":resouces..."
Okay, so I got the error to disappear by first running
grails> compile-gwt-modules
Now a different problem occurs. The front-end gwt codes I made, aren't displayed.
You can add in you Confing.groovy:
grails.resources.adhoc.excludes = ['**/gwt/**']
This will solve the problem. But if you use plugin version 0.8 this issue should be resolved.

error jsp 154 java.lang.classnotfound

i am developing a portlet struts 2 ejb3
i configured project ejb and in the portlet project i confugured the action class and struts.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<package namespace="/view" extends="struts-portlet-default" name="view">
<!-- If no class attribute is specified the framework will assume success and
render the result index.jsp -->
<!-- If no name value for the result node is specified the success value is the default -->
<action name="index">
<result>/html/view/index.jsp</result>
</action>
<action name="create" method="ajouterOUmodifier" class="com.esprit.action.AdressAction">
<result name="success" type="redirect">index</result>
<result name="input">/html/view/ajoutAdress.jsp</result>
</action>
</package>
</struts>
and the jsp file
<%# page contentType="text/html; charset=UTF-8"%>
<%# taglib prefix="s" uri="/struts-tags"%>
<%# taglib prefix="sx" uri="/struts-dojo-tags" %>
<html>
<head>
<link href="<s:url value="/resources/main.css"/>" rel="stylesheet" type="text/css"/>
</head>
<body>
<s:form action="create" method="post">
<s:textfield name="adress.nom" label="Firstname"/>
<s:textfield name="adress.prenom" label="Lastname"/>
<s:submit value="ok" />
</s:form>
</body>
</html>
but when i execute the project an error is display:
ERROR [jsp:154] java.lang.ClassNotFoundException: com.esprit.metier.AdressDao from BaseClassLoader#33b2c7a8{VFSClassLoaderPolicy#1e52011c{name=vfsfile:/D:/android/jboss-5.1.0.GA/server/default/deploy/DepartmentWEB-portlet.war/ domain=ClassLoaderDomain#69ac5f83{name=vfsfile:/D:/android/jboss-5.1.0.GA/server/default/deploy/DepartmentWEB-portlet.war/ parentPolicy=AFTER_BUT_JAVA_BEFORE parent=ClassLoaderDomain#5183a17c{DefaultDomain}} roots=[MemoryContextHandler#432465105[path= context=vfsmemory://5c4o13m-e9nqdk-h49ogxti-1-h49ohbp5-2a
can you help me ?
The ClassNotFound condition can result from two issues:
The class that the classloader complains about is not on the classpath
The class that the classloader complains about references another class that cannot be loaded for some reason (e.g. it's not on the classpath or references something else that is not...)
So: Check your classpath: Is com.esprit.metier.AdressDao on there? Its superclasses (the whole hierarchy) and all interfaces it implements? All members and referenced classes (see method signatures as well).
Further, if this really is a portlet's jsp, it shouldn't contain <html>, <head> and <body> as this is the business of the portal to add these to the page. You'll also probably need to include your css either in the theme or in liferay-portlet.xml in the <header-css> section (but this shouldn't influence your class-not-found experiences, it's just general portal advice)

GWT - Unable to find type 'com.myapp.launcher.client.LauncherInitializer' multi-module architecture

I have a project with the following structure:
com.myapp.gwt:
Basic.gwt.xml
Launcher.gwt.xml - inherits Basic.gwt.xml
Module1.gwt.xml - inherits Basic.gwt.xml
com.myapp.gwt.ui.basic.client:
AppActivityMapper.java
AppHistoryManager.java
AppPlaceHistoryMapper.java
BasicInitializer.java - this is a daddy class for all entry points
MainClientFactory.java
MainClientFactoryImpl.java
com.myapp.gwt.ui.launcher.client: - all the stuff for the launcher module is here
LauncherInitializer.java (extends BasicInitializer, launcher module's EntryPoint)
com.myapp.gwt.ui.launcher.client.places:
Places and activities for the launcher module
com.myapp.gwt.ui.module1.client: - all the stuff for the module1 module is here
Module1Initializer.java (extends BasicInitializer, module1 module's EntryPoint)
com.myapp.gwt.ui.module1.client.places:
Places and activities for the module1 module
com.myapp.gwt.shared:
Stuff shared between the client and the server (interfaces, dtos)
com.myapp.gwt.server:
Code that works only on the server
what i have in my Basic.gwt.xml is this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.1.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.3.0/distro-source/core/src/gwt-module.dtd">
<module rename-to='myapp'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />
<!-- 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.clean.Clean' />
<inherits name="com.google.gwt.place.Place" />
<inherits name="com.google.gwt.activity.Activity" />
<inherits name="com.google.gwt.editor.Editor" />
<!-- Specify the paths for translatable code -->
<source path='ui.basic.client' />
<source path='shared' />
<replace-with class="com.myapp.gwt.ui.basic.client.ClientFactoryImpl">
<when-type-is class="com.myapp.gwt.ui.basic.client.ClientFactory" />
</replace-with>
<set-configuration-property name="UiBinder.useSafeHtmlTemplates" value="true" />
</module>
what i have in my Launcher.gwt.xml is this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.1.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.3.0/distro-source/core/src/gwt-module.dtd">
<module rename-to='launcher'>
<!-- Other module inherits -->
<inherits name="com.myapp.gwt.Basic" />
<!-- Specify the paths for translatable code -->
<source path="ui.launcher.client"></source>
<!-- Specify the app entry point class. -->
<entry-point class='com.myapp.gwt.ui.launcher.client.LauncherInitializer' />
</module>
None of my classes residing inside the com.myapp.gwt.ui.basic.client package have reference to any of the classes inside the other module packages. The other module packages on the other hand have lots of references to the basic module and some of the classes even extend the classes inside the basic package.
The problem is that i'm getting this error during compiling to javascript launcher module:
[TRACE] [launcher] - Finding entry point classes
[ERROR] [launcher] - Unable to find type 'com.myapp.gwt.ui.launcher.client.LauncherInitializer'
[ERROR] [launcher] - Hint: Previous compiler errors may have made this type unavailable
[ERROR] [launcher] - Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly
[ERROR] [launcher] - Failed to load module 'launcher' from user agent 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20100101 Firefox/5.0' at localhost:61253
Also please tell me if you see something worth changing in the stuff i've done.
Just a quick guess: did you try : <source path='ui/basic/client' />