FileNotFoundException even if file is exist and path is properly supplied - eclipse-rcp

I have a RCP Project wherein I am setting image to view and It was working fine but once I changed the folder name from 'icons' to 'logIcons' from eclipse , tool throws exception 'FileNotFoundException'. Previously path was 'icons\error.png' and after changing folder name I changed to 'logIcons\error.png' too but image doesn't load when workbench loads. Many time I have done this kind of folder changes and many time it throws exception but don't how to resolve it.

You must list all the folders that you want included in a plugin in the build.properties file. You have probably forgotten to do this for logIcons. Open the build.properties editor and check the folders you need.
This is easy to forget as the code will work OK when you test run it from within Eclipse but will fail when you build the RCP.
You must also use the correct methods of accessing resources in a plugin. The FileLocator class is the appropriate class to use.
In testing you should always have -clean and -clearPersistedState specified in the Run Configuration to make sure that cached data is rebuilt to be current on each run.

Related

No Class Def Found Error in my JSP file

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.

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.

Location of config file for devmode in Eclipse?

I have a multi module GWT project (say a.gwt.xml, b.gwt.xml, c.gwt.xml) that I am building in eclipse and testing in devmode. All was working well until I deleted one of the gwt module file and associated source. Now when I try to launch devmode from eclipse it fails with the following error message.
Loading modules
com.fubar.b
[ERROR] Unable to find 'com/fubar/b.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?
[ERROR] shell failed in doStartup method
I assume that this means there is a stale reference to the now defunct b.gwt.xml but I can't seem to find it in any of the config files. Any ideas?
At present I am working around this by doing a copy+rename a.gwt.xml -> b.gwt.xml (so there are effectively 2 copies of the a module names a + b) which works fine but compiles 2 copies of same module :(
What I think is your runtime configuration which is gone wrong. Individual projects should be fine. Open the runtime configuration which you were running and check the entries in GWT! If the module you have deleted still exists here, then you need to remove it.
Runtime config for project
You can refer to the following Video.
http://www.youtube.com/watch?v=UW4WSYs1bKE
To rename
Right Click on the project.
Select Run As ---> Run Configurations.
In the Arguments Tab, change the Old Module Names in Program
Arguments.
Also Make sure, in GWT Tab, Selected module name is correct.
ALREADY I HAVE ANSWERED THIS HERE : GWT:how can i rename my module

Tomcat inside Eclipse overwrites context fragments

I have an Eclipse Project which is attached to a Tomcat 6 using WST. For testing reasons I need to set some context parameters to override settings in the web.xml. The following Server Options are set: "Serve without publishing" as I want to run my application right from the project and "Publish contexts to separate XML files".
Now I can find the context fragment inside .metadata.plugins\org.eclipse.wst.server.core\tmp1\Conf\catalina\localhost and change them as needed. This works for some time, but after each Eclipse restart my context fragment is replaced with a fresh generated one - without the required parameters of course.
How can I prevent Eclipse from replacing my configuration? Or is there a way to add the necessary parameters to the generated context fragment?
Certainly changing stuff in the .metadata/.../wst.server is not a good idea - those directories are completely controlled by Eclipse.
If you look in your Eclipse 'Servers' project entry, you will see server.xml and context.xml - that is the place to change things. Eclipse copies those files to that .metadata directory - IF it isn't fouled up somehow.

Eclipse Library Reference Out of Date in Project

I am using Eclipse Ganymede.
I have a project open and call a static method of a class in another project, which the current one references.
I close the current project, open the referenced library's project, change the method return type, and rebuild its jar. (It's set to build automatically, but I tried explicitly rebuilding all anyway.)
When I go back to the original project, it still thinks that the static method returns the old type. What am I doing wrong?
P.S., "refresh" on the context menu doesn't fix it either.
The problem may depend on how the first project references the class file in the second. If it has a hard-coded classpath to a jar produced by the second project, you'll need to make sure that jar file is properly updated where it is linked from.
Since you control both projects, ideally the first project would be dependent on the second project as a "project dependency", not as a jar dependency (then it would automatically sync changes between the two)
You can find a list of those projects (and add to them) by right-clicking on the project, selecting Build Path -> Configure Build Path, and switching to the Project tab.
I think the jar file was out of date. I ended up deleting the old one, selecting the project to be referenced, and clicking "Export". At that point, I was able to indicate that all classes and resources in the project should be exported to a jar in the folder I specified.