I have a jar file with source code packed.
i inserted the jar in war/WEB-INF/lib/xxx.jar Add to build path
but when i run the project i got an error
Edited Added gwt.xml
<module rename-to='bookmanagementsystem'>
<inherits name='com.google.gwt.user.User'/>
<inherits name='com.google.gwt.user.theme.standard.Standard'/>
<inherits name='com.example.Book'></inherits>
<entry-point class='com.example.Book.client.Index'/>
</module>
Edited
I solved
Plugin failed to connect to Development Mode server at 127.0.0.1:9997
Now i got a problem
Loading inherited module 'com.example.book'
[ERROR] Unable to find 'com/example/book.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?
[ERROR] Line 6: Unexpected exception while processing element 'inherits'
If you want to include external jar to GWT then make sure you did the following
check the jar has .gwt.xml file and it must specify the source.
add it to lib folder
configure build path and add jar to libraries
select the jar from Order and Export
inherits this module in your .gwt.xml file
Eg. if you have a package in jar named "sample.source" and your .gwt.xml file in jar is "Source.gwt.xml" and this .gwt.xml file in "sample" folder and classes or entities in "source" folder
Then your current project must inherits it. ie it must have the following tag
<inherits name='sample.Source'/>
Eg :
Sorce.gwt.xml in jar file
<module>
<source path="">
<include name="**/MyEntity.java"/>
</source>
</module>
For reference :http://jonathan.lalou.free.fr/?p=1077
GWT is not supporting serialization in client side so try to use RPC and use these classes from jar in server or you just copy the packages of jar and add to src of gwt project.
OR
I solved the problem the jar files must have java source code along with class files or pack java source code into jar and use.
Related
I'm trying to export an Eclipse feature using Tycho, replacing the "Export Wizard" found on the Eclipse overview of the feature. The wizard gives the option for the export destination as a zip file. Is there a way to do the same with Tycho?
In order to build a zip file with the feature and the feature's plug-ins, you need to add a module of the assembly packaging type eclipse-repository to your reactor:
Add an eclipse-repository module with the same parent POM as the
eclipse-feature module (in order to inherit the same target
platform configuration).
Create a category.xml file in the root of the new module with the following content:
<?xml version="1.0" encoding="UTF-8"?>
<site>
<feature id="todo.your.feature.id" />
</site>
Add the new module to your root POM.
I've got an JavaEE6 app with following structure:
app.ear
META-INF
application.xml
lib
commmon-server-lib.jar
webapp1.war
webapp2.war
services-ejb.jar
Both webapps have common-server-lib.jar in Class-Path entry of their MANIFEST.MF (skinny war's).
application.xml:
<application>
<module>
<ejb>services-ejb.jar</ejb>
</module>
<module>
<web>
<web-uri>webapp1.war</web-uri>
<context-root>/webapp1</context-root>
</web>
</module>
<module>
<web>
<web-uri>webapp2.war</web-uri>
<context-root>/webapp2</context-root>
</web>
</module>
<library-directory>lib</library-directory>
</application>
In common-server-lib.jar there is a web filter that should have few EJBs and other CDI managed beans injected. This filter is defined in web.xml's of both webapps.
common-server-lib.jar and war's have beans.xml in appropriate place.
Now the problem is, that when I try to deploy this app to Glassfish I get errors like this:
Class [ Lcom/acme/UserService; ] not found. Error while loading
[ class com.acme.filter.MyFilter ]
UserService service is located in services-ejb.jar
So my question is: what am I doing wrong...? Is there something wrong in defining web components (that use injections for it's dependencies) in a shared library?
Edit:
In section 15.5 of JSR-315 (Servlets 3.0 final spec) one can find:
In a web application, classes using resource injection will have their annotations
processed only if they are located in the WEB-INF/classes directory, or if they are
packaged in a jar file located in WEB-INF/lib.
I've moved common-server-lib.jar to WEB-INF/lib directories of both webapps but I'm still having same issue ;/...
After many hours of struggling with this puzzle I've found a solution:
Add web-fragment.xml to commmon-server-lib.jar with my filter
Remove filter specification from webapps web.xml's
Change maven fonfiguration to remove all jar's from WEB-INF/lib
directory except commmon-server-lib.jar
Remove commmon-server-lib.jar from EAR /lib directory
I'm moving over to a new computer, and in the processing I'm creating new Intellij 12 projects from my git source.
I have a gwt module file containing the following:
<!-- Other module inherits -->
<inherits name="com.google.common.collect.Collect" />
<inherits name="com.google.common.base.Base" />
<inherits name="com.bdl.message.Message" />
<inherits name="com.bdl.universal.Universal" />
<inherits name="com.bdl.appengine.AppEngine" />
<inherits name="com.bdl.gwt.BdlGwt" />
<inherits name="com.google.gwt.inject.Inject"/>
The com.bdl.* entries are from another library I've written and I have their jar files (and sources) in the module dependencies. I can confirm that removing those dependencies causes the corresponding inherits nameto turn red, indicating an error.
I also have as a dependency, a global library Guava (GWT) which contains:
classes:
guava-14.0-rc2.jar
sources:
guava-14.0-rc2-sources.jar
guava-gwt-14.0-rc2.jar
javadoc
guava-14.0-rc2-javadoc.jar
But despite this, the inherits for Collect and Base are red and the GWT compiler fails, saying it can't find Collect.gwt.xml.
On my old system I have an Intellij 11 project, which is set up the same way (there must be some difference somewhere, but I've been looking for hours to find it and can't)
That also has the same library as a dependency, and the inherits lines in my app's module are still red, but the GWT compiler succeeds, finding the Collect.gwt.xml right where it should be, at:
jar:file:/[path-to-guava]/guava-gwt-14.0-rc2.jar!/com/google/common/collect/Collect.gwt.xml
There must be something simple and stupid that I'm missing, but I can't find it.
You probably need to add guava-gwt-14.0-rc2.jar to your dependencies. Notice that the name has -gwt- embedded in it and you said that you have just these as dependencies:guava-14.0-rc2.jar sources: guava-14.0-rc2-sources.jar guava-gwt-14.0-rc2.jar javadoc guava-14.0-rc2-javadoc.jar
You can check that the jar is the appropriate one because when you open it (it is just a zip file) you should see the Collect.gwt.xml file somwhere within.
this may be a stupid question but after 30minutes of Googleing, I still havent found an answer..
I want to build the example program "gwt-beans-binding" ( http://code.google.com/p/gwt-beans-binding/.
I download the *jar file and copied it into the the lib folder and added it to Properties-->Java Build Path -- >Libaries --> Add JARs.
When I'm build the project, I'm geting "java.lang.ClassNotFoundException"s...
What am I missing (do I have to write something in the *.gwt.xml?
For building inside Eclipse it should be enough with adding the library jar to the Libraries. But for GWT compiling (or executing inside Developer Mode) your module file (*.gwt.xml) has to point to the library module file. The library module file will say where the GWT source code is located.
<!-- this will declare where the source code is for the library GWT classes -->
<inherits name='org.gwt.beansbinding.Main' />
<!-- OR THIS... I don't really know -->
<inherits name='org.gwt.beansbinding.BeansBinding' />
The GWT compiler needs the sources to comile Java code to JavaScript. So you have to add the source folder to the class path too.
Can you give us the full stacktrace, what class is missing?
I am trying to use the sparklines add on in my application. However, eclipse systematically refuses to compile the corresponding widgetset, i.e. if I specify the inherit tag in my widgetset that refers to the sparklines widgetset as follows:
<inherits name="org.vaadin.artur.icepush.IcepushaddonWidgetset" />
<inherits name="org.vaadin.hezamu.googlemapwidget.widgetset.GooglemapwidgetWidgetset" />
<inherits name="org.vaadin.sparklines.SparklinesWidgetset" />
<inherits name="com.fluxtream.widgets.FluxtreamwidgetsWidgetset" />
...eclipse complains with the following error:
Loading inherited module 'com.fluxtream.widgets.FluxtreamwidgetsWidgetset'
Loading inherited module 'com.fluxtream.dashboard.widgetset.FlxDashboardWidgetset'
Loading inherited module 'org.vaadin.sparklines.SparklinesWidgetset'
[ERROR] Unable to find 'org/vaadin/sparklines/SparklinesWidgetset.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?
[ERROR] Line 26: Unexpected exception while processing element 'inherits'
However, I have verified that the widgetset was indeed declared as a dependency in my project's pom, and I have also verified that it appears under the "Maven Dependencies" library icon in the eclipse IDE.
Also, whenever I attempt to recompile my widgetset, and after the aforementioned error is displayed, I can see that my original widgetset.gwt.xml file has been modified, and as a result would look as follows:
<inherits name="org.vaadin.artur.icepush.IcepushaddonWidgetset" />
<inherits name="org.vaadin.hezamu.googlemapwidget.widgetset.GooglemapwidgetWidgetset" />
<inherits name="com.fluxtream.widgets.FluxtreamwidgetsWidgetset" />
<inherits name="com.fluxtream.dashboard.widgetset.FlxDashboardWidgetset" />
I'm really confused, as I don't understand what I am doing wrong. I am using other add-ons which work just fine (icepush and googlemap) and I really don't understand what I am doing wrong here.
The Vaadin Eclipse plugin manages your gwt.xml, that is why it is modifies if you add/remove add-on from classpath.
Basically this means that you don't have to modify the gwt.xml by hand, if working in Eclipse. Furthermore, the Eclipse plugin does not know anything about maven (or pom files) and any information in those does not affect to it.
You can compile the widgetset two ways. First with the Eclipse plugin (the button on toolbar) or with maven. This sounds that you are mixing those.
Easiest setup is to put all add-on jars to WEB-INF/lib and use the eclipse plugin to compile the widgetset. The gwt.xml should be automatically updated, but sometimes a refresh (or jar remove/add procedure) is needed to let the plugin notice change.
Also, check the Vaadin settings in project preferences are the way you want.