I'm trying to build and GWT MVP application using Guice and Gin. I added Guice and GIN jars to my Eclipse project but i'm stuck with this error:
java.lang.NoClassDefFoundError: com/google/inject/internal/util/$Preconditions
I've done a quick Google search and here says the we need to recompile GIN against GWT SDK. Also, the Gin Tutorial mention something about a compilation step.
Isn't enough to add GIN jars to the GWT project, or is mandatory to generate gin.jar from sources? How do i accomplish this with Eclipse (with Google Plugin)?
PS: I'm not using Maven in my Project. Only Eclipse and Google Tools
Another PS: Currently using Guice 3.0, Gin 1.5 and GWT 2.3
If you are using GWT 2.2 or above try using a latest snapshot of gin 1.1 or higher versions and also upgrade guice 3.0.
For Gin 1.5 there is a pre-gwt-2.2 jar and a post-gwt-2.2 jar. Make sure you have the right one. And probably only one of them should be in the WEB-INF/lib. Make sure both gin and guice are in the lib and in Java Build Path->Libraries. I also have aopalliance.jar, guice-assistedinject-3.0.jar and javax.inject.jar. (Also guice-servlet but that isn't part of the problem here). Make sure you have " " in your .gwt.xml file.
And remember in dev mode that gin uses guice to do most of the work.
Related
My ultimate goal is Invoking Eclipse plugin from Java. I see that an Eclipse plugin registers a class as Bundle-Activator in MANIFEST.MF. The start(BundleContext context) method will be called on this class. Where does this call come from?
Eclipse is made up of many repos that are mostly mirrored on GitHub. Some are deprecated and point to other repos. And it's a programming IDE and an OSGi framework at the same time? I find it hard to find the code for this core part of the framework that handles plugin loading. Where is it?
The project to interact with OSGi bundles is Eclipse Equinox. It is an implementation of the OSGi framework. You start equinox and load the bundle jar from there instead of putting them into the regular classpath.
Here you find some information how to do this in general:
http://njbartlett.github.io/2011/07/03/embedding-osgi.html
You can then interact with the bundles from you plain java application. This is not an easy thing though.
What makes things even more complex is that Eclipse is not plain OSGi. Eclipse predates OSGi and many of the concepts are still not fully adapted to plain OSGi.
So using eclipse plugins from a plain java application may be very hard.
I recommend to ask on the mailing list of the plugin you want to use if there is experience with using it outside eclipse.
While working with Scala frameworks such as Play! and Lift I was really amazed how these frameworks manage to create a full development stack from the source code up to the web application container (Jetty).
Right now I'm trying to configure a project on my own with the following features:
Automatic deployment on Tomcat 7 (I'm not using Jetty as I require JEE6 support)
WAR file packaging
Is it possible to do it with a build tool such as SBT or Maven?
Note: My goal is to create my own project structure, not using an existing framework (even though I'm taking some ideas from them).
There is a web plugin for SBT:
https://github.com/JamesEarlDouglas/xsbt-web-plugin
It gives you war packaging, but not automatic deployment (other than on Jetty, which it integrates, but which you don't have to use).
That said, I'd like to see a fork of that plugin that removes the Jetty dependency and adds an automatic external deployment option. Shouldn't be too hard to do.
I am using GWT 2.4 with Hibernate 3.0. I wanted to know what changes I need to make in my application for integrating GWT 2.5 in my application ?
Nothing special.
Replace 2.4.0 dependencies with 2.5.0-rc1 ones (depending on how you manage dependencies, either download the SDK and drop the new JARs to replace the previous ones, or bump the version number in your POM –if using Maven– or similar build file).
If you're using Maven and the gwt-maven-plugin, make sure you re-define the plugin dependencies too (note gwt-maven-plugin 2.4.0 also needs gwt-servlet to be overridden); or you can test the gwt-maven-plugin 2.5.0-rc1.
Check the list of breaking changes though; chances are small that they affect you, but there's still a risk.
I am currently developing an application which has a server part based on JavaEE 6.0 on JBoss 7.1 and a client based on Eclipse RCP 3.7.
For a simple OSGi package for a shared API I already run into trouble due to some differences in versions and depdencenies. The API requires "org.osgi.framework." for the bundle activator and "org.slf4j." for the slf4j logging API.
Currently my client is working very well, but JBoss tells me that the expected version of the OSGi import and the also the imports for slf4j do not fit...
I there a best practice to share OSGi bundles between Eclipse and JBoss? Do I need to get back to simple import and export declarations or can I used Require-Bundle somehow? Do I need to create some compatibility bundles for JBoss to get it running? What is the best way to proceed here?
UPDATE
I solved the issue by using Import-Package exclusively. For the dependency like org.osgi.framework is use version="0.0" to explain it does not matter. :-( It is not very safe, but currently I do not see another option. Is there a better way?
UPDATE 2
One also needs to pay attention to implement the correct verion of the OSGi Framework. JBoss 7.1.x only has OSGi 4.2 implemented, which has no support for typesafe service retrieval.
The best practice would be to use an import package statement with a range from the minimum version which you're using to the next major increment.
For example, if RCP expects version 1.5 of a package and JBoss expects 1.3.6, import version="[1.3.6,2)".
The Semantic Versioning whitepaper (pdf) explains why this style of import is safe and wise.
I was trying to start new swing application using maven,
so I started searching on maven documentation but (frustratingly) found no clue. So I'm asking:
what is the archetype used?
what are the dependencies?
how to build swing app in maven [is there is plugin to do so]?
what is the archetype used?
A swing application is a standard JAR so just use the standard archetype:
mvn archetype:generate -DgroupId=com.mycompany.app \
-DartifactId=myswingapp \
-Dversion=1.0-SNAPSHOT
what are the dependencies?
If you plan to use the standard Swing API only, there aren't no extra dependencies to declare. But if you want to use things like JGoodies, MiGLayout, SwingX, Flamingo, SwingFX etc then you'll have to add the appropriate artifacts and repositories. But there is no universal answer to your question.
how to build swing app in maven [is there is plugin to do so ]?
A Swing app is not really particular. I would maybe just consider using Java Web Start (and the Maven Webstart plugin) or maybe a cross platform installer like IzPack (and the Maven IzPack Plugin). But you have time for that, you need an application before :)
Basically, if you are only using Swing (I mean if you do not want additional features such as SwingX for example), then you will not need to add specific information in your pom.xml file, as everything needed for Swing development is already embedded in the JDK.
Concerning the build process, there is also nothing specific additions here. However, you may need be interesed in:
Creating an executable JAR.
Making a big JAR, that also contains all the dependencies.
Check these links if you have problems finding documentation about maven Better builds with Maven and Maven: The Definitive Guide. Then you will figure out that you can build any kind of app like swing using maven. Maven is not a framework is project management and comprehension tool.
Note: Maven: The Definitive Guide was split into two books. The link goes to the blog post that links to both of them.