No Class Def Found Error in my JSP file - eclipse

I have a jsp file called AddBidding.jsp which adds bids for a facility. I am using the Google App Engine's datastore (objectify). When I try to run the file using localhost:8888/AddBidding.jsp. However, it keeps giving me NoClassDefinitionFound Error. Can I know what causes this error? I know it's due to the classpath but how do I fix it in Eclipse GAE?

I am making some assumptions over here since there are not too many details about which class is giving you the NoClassDefFound Error. Just ensure that all the external(additional) JARs that you use are present in the WEB-INF\lib folder also. For e.g. put all the Objectify and dependent JARs in the WEB-INF\lib folder and then try.

Right Click the Project on Project Explorer View > "Configure Build Path"
In Source [tab] Make sure your Default output folder is right
In Libraries [tab] you have Web App Libraries
If not Add Library...
That should get you working.

Related

Another GWT module may need to be recompiled

I'll start with the other threads I've read:
GWT module may need to be (re)compiled REDUX
Some subtlety of GWT compilation - "gwt module may need to be (re)compiled."
Google App Engine - recompile GWT module
GWT Maven : Module 'xxx' may need to be (re)compiled
I have taken the following steps to fix this:
Cleared my browser cache.
Deleted gwt-unitCache folder.
Deleted *.nocache.js.
Deleted every file that was left over from a previous build. (I did this by looking at the date and time it was created.)
Run both maven clean and gwt:clean on my project.
Compile by right clicking on the project and going to Google > GWT Compile.
Run maven package.
Put the war in my JBoss EAP 6.1 (JBoss AS 7) folder.
Connect to it and still get the "GWT module may need to be recompiled" error.
What else could be causing this error to come up?
This has happened to me in the past when I imported a GWT project to a different computer. Seems you have already done some things I have tried. Before you start, right click on your project, hit Refresh, so you don't miss anything that's not in sync with the file system. There are multiple things it may be, so here's all the things I did to get it working:
Before the following steps also helps if you use the same version of GWT that was originally used to create your project. Also, make sure gwt-servlet.jar, gwt-servlet-deps.jar, validation-api-1.0.0.GA.jar, and validation-api-1.0.0.GA-sources.jar in your libs directory are the same as the ones from your GWT SDK directory (only if your app uses them).
Delete gwt-UnitCache
Open up the war directory.
Delete ALL compiled module folders.
Delete the war/WEB-INF/deploy folder.
Delete the war/WEB-INF/classes folder. It may be hidden in Eclipse, so you may have to do it via your file system.
Now, on the menus: click Project > Clean...
Make sure a build happens too. Either make "Build automatically" is selected, or use the option in the "Clean" dialog.
Do a GWT Compile. If you have more than one module, ONLY compile the main module. Any inherited modules will also be compiled.
I hope this helps. Ask if you need any clarifications.

"Unable to find XXX.gwt.xml on your classpath" error in GWT

After importing a Maven GWT project into Eclipse the debugger doesn't work, complaining that it's
Unable to find ProjectName.gwt.xml on your classpath
How do you fix this error?
It turns out that when you debug some GWT project as Web Applications, Eclipse does not append the module name (i.e. the gwt.xml file) to the list of arguments. I tried adding it manually, but forgot to add the complete package name that houses the gwt.xml file. The module should have been referred to as com.company.project.Project.gwt.xml, not just Project.gwt.xml.
I found that Davek804's comment helped me: I simply deleted the debug configuration (Run=>Debug Configuration=>right click and deleted project will run
Try going to Run -> Run Configurations in the menu and then select the Classpath tab and add the missing project.

Referencing a GWT project from another GWT one - Problems

I am already using an open source GWT project (iServe) and I would like to integrate into it another open source GWT project (PetalsBPM), by which I mean being able to call it and reference its methods.
I have imported iServe in Eclipse (it has multiple modules) as separate Maven projects referencing its other and can run it successfully through Runas -> Web application in development mode.
If I do that and run the other project through the console as mvn gwt:run, I call initiate PetalsMBP through iServe. However, that means that the two programs have to run as is, without communication with each other.
I have also imported the second project into eclipse as a java project successfully (converting into a Maven one causes problems - various lifecycle configurations ones), but whenever I try to add to to iServe through Properties -> Java Build Path -> Projects, although it does not cause any errors immediately, I cannot launch iServe anymore. It produces the following error:
"Exception occurred executing command line.
Cannot run program "C:\Program Files\Java\jre7\bin\javaw.exe" (in directory "C:...iserve-sal-gwt-1.0.0-SNAPSHOT"): CreateProcess error=206, The filename or extension is too long"
Are my problems related to the fact that PetalsBPM is not a Maven project in Eclipse (I doubt it)?
Am I doing something wrong, i.e., this is not the way to reference a project from another one? should I add a reference to the first project's (iServe) gwt.xml file?
Is there a way to do what I want without having to wrap the second project as a jar and calling it from iServe? I would prefer not to, since producing a jar every time I make a slight change is not exactly efficient!
P.S: The second project is a regular GWT project with an entrypoint, not just a module. Should I remove this?
UPDATE: Trying to figure out the source of this error, I attempted to simplify the problem, so I performed the following moves:
I created two new simple GWT projects and tried to reference one
from the other. Worked fine
I referenced the project I actually want
to use (PetalsBPM) from the simple one I just created. Also works
fine.
I referenced the new simple project from the original one I
want to use (iServe). Also works fine.
Tried doing what I actually
want to do, copying the settings from 2&3. Produces the same error
"CreateProcess error=206, The filename or extension is too long" if
I reference PetalsBPM (does not when I remove it from the referenced
projects)
So, I tried switching workspaces. I created a new workspace in C:\, and moved the actual projects there. Still it did not work. :(
Any more ideas?
I met the same type of error "Create Process, error=206, path too long etc." a hundred times.
Then, I found a solution/explanation in google-groups, it solved my problem.
I post the content and link as it might help others.
This website (StackOverflow) really helped me a thousand times.
Thanks to you all !
solution/explanation :
(Response from Stephen Johnson)
(...) if you're using eclipse plugin go to Project | Properties, choose
Google \ App Engine \ ORM and only include directories that you have
classes that you want enhanced. By default it does the entire project
so that includes a lot of needless files. (...)
Link :
original post # google-groups
Read the exception message again. Somewhere along the way Maven is generating a path that is too long for (some) Windows API to handle, try moving your workspace to a directory straight below C:\.
I just tried "skolima" reply and it worked for me. In Eclipse I clicked File->Switch Workspace.
Three things to note:
After I created the workspace in "C:\workspace" I had to update my Project->Properties > Java Build Path > Libraries > Add External JARs...
I'm using Windows 7.
I'm using "Eclipse Java EE IDE for Web Developers"
I hope this others.

Where to put jar files for struts 2 in eclipse,giving error index.jsp(8,40) File "/struts-tags" not found

Eclipse is only giving me option to include jar files in Java Build Path->Libraries .In some tutorial sites they are showing to add jar files in WEb-INF/lib,but iam not able to add jar here.i tried importing files to WEB-INF/lib,jars were added but they did not had jar icon instead some weird icon ,and when i m trying to run my struts login page its giving me error
/index.jsp(8,40) File "/struts-tags" not found.Where to put jar to make it work,Also while learning struts sometime i get Http 404 error,but when i restart eclipse(I tried restarting server but it didnt help) the error is gone all of a sudden.why this is happening.Eclipse is so confusing.
Go to the your web-project folder outside the eclipse.Cope your jars (which are required for your project).
Than open-up Eclipse, follow these steps
Right Click on project(Project Explorer) choose -->Configure build path.
Go to Library tab and click on add jars, it will open this wizard
Add required jars and i hope this will solve your problem.
Make sure you have required jars in your class-path..
As jars are showing some weird icon, I would suggest you to change the jar files. Also, make sure your added jar contains struts-tags.tld file. This will resolve error on index.jsp.
sorry, system is not allowing me to put comment. So editing the same.
Follow below steps to check the jars are added to build path correctly -
switch to package explorer view.
check whether your jars are added under web app Libraries. If yes your jars are added properly.
Then check struts-tags.tld file is present inside struts2-core.jar. If not present then copy it or add new jar containing the same.

GWT tries to load a deleted module

I am using Eclispe with Google plugin for AppEngine and GWT. Recently I created a test GWT module, but eventually it has been deleted from the project and I can not find any sign of it in the project now.
However, whenever I run the web app locally, I get in console the following message:
Loading modules
com.piq.exemity.Test
[ERROR] Unable to find 'com/XXXXXX/Test.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?
Has anyone got any idea where it can be hiding?
Open Run Configurations... from the Run pulldown menu and go to tab Arguments. In the Program arguments box delete the path to your deleted module.
It could be there in two places -
When you invoke GWTC (via the compile option in Eclipse), the module name com.xxx.Test is passed to the compiler. This causes GWT to look for com/xxx/Test.gwt.xml file
You could have a module that inherits the module "com.xxx.Test". Check your gwt.xml file if this is the case
I think (1) is more likely the culprit.