eclipse linked resource not found by jsp - eclipse

I have an eclipse (juno) workspace with some maven projects, the source directories always appeared under a folder called "java resources".
because of some migration at the office, I had to create a new workspace and reimport the projects. now the "java resources" folder is gone and the source directories appear directly under the project root.
This is messing with some linked resources in jsp files I have. there is a jsp file in a project which is imported in many other files, in other projects. There is a link in those extra projects to where the file is so that it can be found. previously the link was found ok, but now instead of looking the file starting in the root of the source directory, it is looking it in the root of the project:
<%#include file="/common/includes/global.jsp"%>
and I'm getting Fragment "/common/includes/global.jsp" was not found at expected path /MYPROJECT/common/includes/global.jsp
update- I thought that the problem with the linked resource was caused by this configuration. I already solved the java resources issues and the jsp still doesnt find the file

I looked for the configuration files in the old workspace and I found that the org.eclipse.wst.common.component file under .settings was different. the tag defaultRootSoruce as incorrect, since the jsps in my project are not under the standard maven layout.
This fixed it:

Related

JBoss 6.1.1.EAP Module Deployment: Class not found

The structure is as follows:
Actually deployed module is EAR.
EAR contains WAR module, and WAR module contains another JAR module.
In this last JAR, there are some generated classes and their parent folder is also used as source folder. Its path is "target/generated-sources/java".
The problem that is killing me, is that the deployed application throws ClassNotFoundException on server start, and the classes in question are the generated ones.
Now the trick:
if I explicitly change the Deployment Assembly in WAR project in Eclipse not to contain JAR project as "project", but as an archive from the JAR's project "target" folder, JBoss sees the generated classes and starts.
This solution however works only until next eclipse maven project update, so manual edit of deployment assembly is not really a solution.
Any ideas how to deploy or reorganise packages correctly?
OK, seems I have found the solution.
I looked through the build-path of the mentioned JAR file and saw that the entry Output folder pointed to target/test-classes.
After changing this entry to target/classes the application deploys and starts without any missing generated classes.
This is what worked for me:
Expand the 'target' folder of your maven project inside Eclipse (Project Explorer View);
Refresh it (F5);
Right click on your project on 'Servers' tab, then select "Full Publish";
Start your JBoss.
I had to enforce the JBoss Tool "Full Publish" to get an updated version of my target folder by Refreshing it manually on eclipse.
I don't know why but sometimes the Publishing from maven projects (even Full Publishes) do not copy classes from the target Project as it is in the file system. Maybe it's using some outdated memory info or some cache...
Anyway, this is what works for me.
After an update to Eclipse 4.15 and JBoss tools I got this problem too.
My solution: project -> properties -> Java Build Path --> Source
There my Output folder from my source was linked to project/target/classes, I changed this to project/target/project-projectversion/WEB-INF/classes
When I looked into the standalone JBoss folder I saw the folder structure of my source, but the classes where missing, when I changed the output folder the classes pop up and everything worked like before.
I am pretty sure the update made the problems.

Resource folder not on classpath

My previous question about a problem I had, led me to numerous file path changing in order to come up with an answer that caused Maven not not to work properly (apparently Maven is not fond of sub-source-folders).
I changed the project folders to adhere Maven's standard directory layout and put log4j2.xml under src/main/resources/META-INF and the problem returned.
For some reason a Folder in eclipse is not on classpath.
How do I make it work?
EDIT:
I'm using the latest m2e to manage project's build and packages.
The project (is currently) consists of several sub-projects.
The parent pom defines the different modules and Java's compiler version. The pom of the module containing the META-INF folder, states several dependencies, nothing more.
rightclick on your project -> add source folder -> select your resourcefolder. done.
The solution in Eclipse Oxygen.3a is to right-click on the folder -> Build Path -> Use as Source Folder.

Errors in exporting eclipse deployable plug-ins and fragments

I have an eclipse plug-in working fine within eclipse environment.
I wanted to export it into a jar file, so I chose Export > Deployable plug-ins and fragments.
I could get a jar file, but an error was reported.
Opening the log file, it reports that I have 1242 problems (191 errors, 1051 warnings). This is some copy from the error log.
2. ERROR in /Users/LSclipse/src/lsclipse/LSDiffRunner.java (at line 61)
import edu.washington.cs.induction.OnePipeLineScript;
^^^
The import edu cannot be resolved
----------
3. ERROR in /Users/LSclipse/src/lsclipse/LSDiffRunner.java (at line 261)
OnePipeLineScript.getMatchingForRefFinder(projName, proj1, proj1Loc
^^^^^^^^^^^^^^^^^
OnePipeLineScript cannot be resolved
Why I got errors? I had 2049 warnings, but no error when I compile the plugin in eclipse IDE.
ADDED
The main project references two other projects, and references many external libraries. I attach the package view and Java build path.
There were multiple issues involved for this problem. However, the core issue was that the project apimatching and originanalysis were not eclipse plugins but just java projects. As a result, those two projects were not included in the final jar file to break the build.
Symbolic linking the two projects into the main project
I solved this issue by symbolic link the src directory into the main eclipse plugin project.
ln -s /workspace/seal/edu.ucsc.originanalysis/src /LSclipse/originanalysis
ln -s /workspace/seal/edu.ucsc.apimatching/src /LSclipse/apimatching
From the Java Build Path/Source tab, I added those two included projects as source. Eclipse Java Missing required source folder: 'src'
Now I have eclipse plugin jar file without error.
Then click F-5 to refresh the project explorer and check they are java src directory.
Select the included projects in Build tab.
Updating bin.include and source.. in build.properties tab is important. One should understand that in bin.include the ordering is also critical. lib/cdtparser.jar and lib/cdtcore.jar should be placed prior to the user of them - origin analysis/.
Copying jar files for included project into main project
I also had to copy some jar files in those projects file into the main project, and select them in Binary Build tab.
And add tim in Runtime/Classpath tab.
Select the JavaSE-1.6 in Execution Environments.
I have lots of "Must Override a Superclass Method" errors. With the hint from this post - 'Must Override a Superclass Method' Errors after importing a project into Eclipse , I removed the J2SE-1.5 to resolve this issue.
You can not add third party libraries into class path of Java when developing a plug-in. It is the way to build standard Java application, but plug-in is a kind of OSGi bundle that has itself rule for class loading.
The correct way is adding third party libraries into the class path of your plug-in.
Add below declaration into MANIFEST.MF of your plug-in,
Bundle-ClassPath: lib/log4j-1.2.7.jar,
xml-apis.jar,
...
Check those links [1], [2] for understanding it.
This is what have a question on and see as potential solutions to potential problems.
Is this class comfing from a referenced jar or is it in the actual plugin edu.washington.cs.induction.OnePipeLineScript;
You seem to have a lot of soure folders and wondering if your build.properties file is showing any warnings and that you also have this defined for each of the source folders in your build.properties source.. = src/
Your external jar libraries appear to be in a folder that is of type source which is not correct. It should be a non-source folder (which you can tell a source folder by the package icon decorator) and you should make sure in your manifest editor that for runtime you have the lib checked so that it includes the jars in the build. To unmark it as a source folder select the drop down menu in your navigator view go to filters and uncheck .resources which will then show the .classpath file in that file you will see the folder to be kind="src" (i believe) remove that.
Somehow it also looks like you have linked source folders which is a practice I would not suggest and am not sure if that will cause problems when exporting the plugin. If you can avoid linked source folders that would be better.
Also it seems like you are confusing java build path configuration for plain java applications with plugins running in OSGI which is not configured through java build path but your manifest.editor So as a rule of thumb if its a plugin don't even bother trying to configure the java build path because OSGI is different, that could be causing issues as well
Select "Use class files complied in the workspace" in Options works for me.

Eclipse Debugger: Source not found for project references

I am seeing a problem whereby the Eclipse Debugger cannot find the source for classes that are included as project references.
My application contains 2 types of referenced libraries: those in the Maven repository, and those that are included as part of a project reference to another project in my workspace.
The debugger has no issue showing source for any classes in the Maven repository.
However, when it tries to debug classes included using a project reference then it cannot find the source. Even when I click on the "Edit Source Lookup Path" and specify the location of the project it cannot find the source. I have confirmed that the class in question does exist in the project's output folder so I'm not sure what the problem is here.
Can someone please help?
Thanks
OK, I've resolved this almost as quick as I opened it.
The problem seems to have been caused by the way I was importing my application's project.
So in Eclipse, I imported this using m2e's File > Import > maven > Existing Maven Projects.
This resulted in dependencies that existed in my workspace being included as project references instead of actual jar file references to the Maven repository.
To get the actual jar file references to the Maven repository, I ran mvn eclipse:eclipse and my debugger was able to pick up the source code.
Is this a known problem with the m2e plugin?

How to create .classpath and .project files to make a project compatible with Eclipse Helios?

I am having a Java Web project with some class files, JSP files along with WEB-INF and META-INF folders. I want to use this project in Eclipse Helios.
For this I will need to import this project. However, Eclipse will search for .classpath and .project files in the root directory of the project. And unfortunately, I don't have these.
So, can I create one from the project?
Or do I just have to create one project and copy the files into the project? Though this will be a little tedious task if I have too many packages and class files.
Or do I just have to create one project and copy the files into the
project? Though this will be a little tedious task if I have too many
packages and class files.
It isn't tedious. Just create a blank Dynamic Web Project in Eclipse and copy the source folder. You can add a "Source Folder" to point to where your Java source files are present. It will then automatically add all the packages under it.