NoClassDefFoundError on Google App Engine - eclipse

I am developing a project on Eclipse Juno using both GWT and GAE.
My original project had all its packages and classes on the same project and it worked fine both on Development Mode and when uploaded to the Google App Engine on the Internet.
Then I created another project (on the same workspace) were I moved the classes that were generic so they could be used on other projects. I have not created a Jar file. Do I have to? I wish I could just keep my generic classes on another project without putting them on a jar file.
After a while I was able to create correct XXX.gwt.xml files on both projects and added the new project to the "Projects" tab of the main project properties (Project >> Properties >> Projects) to make the moved classes visible to the main project. The GWT compiler found those moved classes, translated them into Javascript code and the main project was able to execute them on the client side.
My problem is on the server side. No matter what I try the server part cannot find the moved classes and when trying to execute any of them it comes with the "NoClassDefFoundError" error when running on the Development Mode (I have not tried to upload to the Google App Engine on the Internet yet).
If I comment out all the references to those classes on the server side the error does not show up, but of course I don't have their functionality.
Gaston Ceron

Yes, you'll have to create a jar of the second project, and put it in the WEB-INF/lib folder.
If you can use maven or ant, you can probably set up appengine to compile the other project into a jar and use it as a dependency for the app engine project.

Related

How do I make a multiproject gradle build in STS eclipse?

I have 2 separate projects in STS Eclipse, both using gradle to build. One is a web application. The other is a data access library that the web application uses. I have the buildship plugin for this.
Normally, I would simply change the project properties to include the data project in the web application's build path/project references/etc to make this work, but we're switching over to using Gradle for this.
I have a working build.gradle file in each project, but I don't know how to make the web app's build script build and include the data project.
I've looked for various tutorials and examples, and they talk about a root project that contains both projects inside. I have no idea how to create this.
How do I go about setting this up?
Furthermore, I'm concerned about SVN in a setup like this. I want to be able to commit each project separately since other applications will use the data access library, which is why it's a separate project. My understanding is that a nested project structure suggested by gradle would cause the entire root project to be committed as 1 entry, with both subprojects.
This would then mean that I would have to copy the data access project into all the other projects that need to use it, which would make maintaining the code a pain. At that point, I might as well not have a separate data access project and instead just include all that code in a package in the web app.
The solution to this issue was the "includeflat" command in the settings.gradle

Rename JEE project

I'm working on a JavaEE project, I already have the skeleton of an old project. All i have done is rename the project, packages and change the name in the project file (.project). But now when i'm trying to run, it returns error in the browser "The requested resource is not available". I've checked the web.xml and added a new jsp in vain it doesn't work. In the browser's address, it gives me the old name of the project(http://localhost:8061/smsgate/). I've tried a lot to fix the problem. what can i do? Is there any other file that i have to update and write in the new name? Please give me your ideas (knowing that i have to use that old project)
Do Project -> Clean in your workspace by selecting your current project. Also if using maven then right click your project and do maven -> clean.
Manually go to your target directory of your ear module and shift-delete everything inside your target and then rebuild your project to form new ear.
if you have configured the web.xml properly then strike your app url. Also ctrl+shift+delete your browser history and then check.
Why not create a new project using a maven archetype, just type in the console:
mvn archetype:generate
It will show you a list of available archetypes from the web, just choose one of them, for JEE6/JEE7 you could choose among:
1019: remote -> org.codehaus.mojo.archetypes:webapp-javaee6 (Archetype for a web application using Java EE 6.)
1020: remote -> org.codehaus.mojo.archetypes:webapp-javaee7 (Archetype for a web application using Java EE 7.)
If you agree with me, just type:
1019 or 1020 according to your needs and answer the questions like:
projectId:your-project-name
groupdId:com.yourdomain.reverse
version:1.0

Eclipse plugin: Self hosting work's but jar give unexpected behavior

I have finished developing a plugin for eclipse, along the way I have been using the self hosting feature of eclipse to test and debug my plugin. However, after exporting the plugin and installing it into my own eclipse host, hardly anything works.
I have JavaFX UI's which wont appear anymore, file's cannot be read due to URI's not being hierarchical, and other parts working very strangely.
I came here to ask why does the plugin work on a self hosted eclipse application while when exported and installed on my current host does not work?
Could it be something to do with other plugins causing conflict ?
Does self-hosting work differently than installations of jars?
The main difference is that your code is packed in to a jar. If you are trying to access files in your plug-in using things like File or FileInputStream or anything else that expects a file these will not work. There are specific Eclipse APIs you must use to access resources in plug-in jars (mainly FileLocator).
Another common mistake is not including everything that is required in the plug-in in the build.properties file. The plug-in jar only includes files listed in this file. When you test locally this requirement is not checked.

Developing two related Projects in Eclipse for Tomcat

I have two projects in Eclipse. One Project is a dynamic web project which is deployed on the integrated tomcat server everytime i make changes to it (which works great).
The second project is a library project which currently needs to be build with ant. The resulting .jar file needs to be copied manually to the first project's WEB-INF/lib directory and the whole project needs to be refreshed, rebuilt and the tomcat needs to be restarted.
Is there a way to connect the library project to the web project so that changes made to the library will be automatically deployed to the web project? This would make the whole development process a lot easier
In your webapp project go to properties. Under "Deployment Asselmbly" you can add your other project. So it's automaticaly added to your WEB-INF/lib folder.
More information here.

How to set up JRebel in a Tomcat environment

I'm having a hard time getting JRebel to work in my current development environment.
I have multi module maven projects. Currently, the Tomcat instance is controlled via service (tomcat monitor) and the deployed web apps are configured with a XML located at ${catalina.home}/conf/Catalina/localhost where the docBase attribute points ${absolute maven project path}/target/app (and the attribute reloadable is true). So every time I do a maven build I only have to manually restart tomcat if there any classes changed. If the modifications occurred in the static resources (JSP, HTML, JS,
etc..) a page refresh will do it.
On my first attempt, I configured the web apps to run on a tomcat server running inside Eclipse. The maven plugin provided was also configured with success: all my sub-modules inherited the plugin configuration and I can saw in the tomcat startup the output messages from JRebel indicating the absolute project paths that were been listen. The only problem is that Eclipse WTP / Tomcat plugins don't go weel with War overlay feature in eclipse. After starting the server, only the resources present in the last web app (the module that have other War as dependencies) were deployed.
So, I returned to my original configuration development and introduced JRebel to it. I passed the JRebel java options to the Tomcat Vm, all maven modules had the rebel.xml (listening to the correct resource folders), but nothing happens. I can't see the usual JRebel messages and I experimented changing a JSP in the source folder and do a page refresh but the file ins't automatically redeployed (in this case a simple copy from the source folder the the ${maven.projec}/target/app will do the trick).
My two questions are:
It's possible to over come that eclipse WTP issue?
What is a funcional development environment involving maven eclipse and a external tomcat?
Any help would be much appreciated!
UPDATE 1
So, I got it. Kind of...I'm still struggling with the war modules overlaying. I have a main web app module that depends on several webapps modules. Because the rebel.xml it's generated dynamically via jrebel maven plugin when the main webapp build occurs, only the it's jrebel.xml prevail. All the other are squashed. The rebel.xml for the jars modules are at the right places (inside the jar file).
I can get it work if I create a custom rebel.xml for the main webapp that points to all the absolute directories containing the source files (static files such as JSP, HTML, JS, CSS, images, etc.) of the depending web apps. But this is worthless for my team development environments. I'm using maven properties but we've have two different maven multi-module hierarchy that don't know about each other and I can't use a root pom to connect them. So these kind of properties will not be enough to guarantee that the absolute paths generated on each developer machine in the rebel.xml are correct.
For now, I'm trying to tackle using some kind of maven plugin to do the rebel.xml merge. For the record without success yet.
This is becoming another issue a bit different of the original question :) Maybe I should through another question.
UPDATE 2
I got it working!..finally.
I used the XSLT Generator Maven Plugin to help me merge the various rebel.xml files. Also had to use the fabulous Maven Copy Plugin because the xslt transformation occurred after the final war packaging and I had to add the resulting rebel.xml to that WAR.
If someone needs the configuration files details down't hesitate asking.
Hope's this helps someone out there.
I got it working!..finally. I used the XSLT Generator Maven Plugin to help me merge the various rebel.xml files. Also had to use the fabulous Maven Copy Plugin because the xslt transformation occurred after the final war packaging and I had to add the resulting rebel.xml to that WAR.