PWC6188: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application - eclipse

I am working on a dynamic web project in Eclipse Kepler. I am trying to write a simple JSP using JSTL <c:forEach>. For that I have included the required JAR jstl-1.2.jar under libraries and added the following statement to JSP:
<%# taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
However, when I run it using Run as --> Run on Server, it shows the following error.
org.apache.jasper.JasperException: /test.jsp(4,61) PWC6188: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
I have already consulted a lot of links, but I don't understand how this is caused and how I can solve it.

For that I have included the required JAR jstl-1.2.jar under libraries
This makes it only available during compile time, not run time.
You need to undo everything which you did in project's Build Path and Deployment Assembly properties. If you're not sure anymore what changes you've all done over there, then throw away the current project and recreate the project from scratch and remember to never touch the project's Build Path and Deployment Assembly properties until you really really understand what it is doing under the covers (in other words, when you're able to create, build and deploy a WAR from top of head in command prompt without using any IDE).
The proper procedure is:
Open the project's WebContent/WEB-INF/lib folder.
Drop the jstl-1.2.jar file in there.
That's it. Nothing more needs to be done. No need to fiddle anywhere in project's properties. Eclipse will automatically do the necessary magic there.
See also:
Our JSTL wiki page
Update: as per the comments,
web.xml is declared to version 2.4 and I am using Basic Server: J2EE Preview at localhost
There's the cause of your problem. JSTL 1.2 requires a minimum of Servlet 2.5 and "J2EE Preview" is completely outdated. Grab Tomcat 7 (pick the core ZIP file), extract it, integrate it in Eclipse, add the project to Tomcat, fix your web.xml to be Servlet 3.0 compatible, then start Tomcat and enter the desired URL in your favourite webbrowser.

Make sure that jstl-1.2.jar is included in your WEB-INF/lib directory and the deployment assembly.
Right Click Project > Project Properties
Deployment Assembly
Click Add, then Folder
Select the WEB-INF/lib folder.

Just had this problem and nothing straght forward about it online.
SOLUTION:
Add JSTL library to the project libraries

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.

How to deploy changes to java file into AEM?

I'm working with AEM for the first time. I am using Adobe Brackets for editing one of the ZIP files I was given that included jcr_root and META-INF. This ZIP file has no pom.xml. Everything so far is fine with the zip file....I can make changes to JSP and JS etc. and they take effect right away.
However, I would like to change one of the java files. The change to JAVA files doesn't seem to be taking effect. I've restarted CQ instance but that doesn't seem to be working. And there is no POM.xml in the zip file.
There is a .bnd file with these contents. Not sure if this helps..
Export-Package: *
Import-Package: *
#Private-Package: com.acme.demo.workflow.impl
# Include-Resource:
Bundle-Name: com.acme.demo.workflow
Bundle-Description:
Bundle-SymbolicName: com.acme.demo.workflow
Bundle-Version: 1.0.0-SNAPSHOT
Bundle-Activator: com.acme.demo.workflow.Activator
Question
Can compiled class files be sent to AEM via brackets? If so, how?
I strongly recommend to use Maven to build your AEM Project. It's very well supported and documented and the de-facto standard for AEM deployment.
http://docs.adobe.com/docs/en/cq/5-6-1/developing/developmenttools/how-to-build-aem-projects-using-apache-maven.html
I prefer you to use Eclipse IDE, follow next steps:
Use maven command on bundle's pom.xml file
rightclick on pom.xml file of bundle.
Run as.
Run configurations.
In Base derictory field browse package of your bundle.
In Goals field
Put this string
install org.apache.sling:maven-sling-plugin:install -Dsling.url=http://SERVERNAME/system/console/install -Dsling.user=admin -Dsling.password=admin
Press Run button and yours bundle will be installed to CRX
You can check if bundle installed using link
http://SERVENAME/system/console/bundles
The surest way is through maven only. At the parent pom's directory level hit -
Definitely fast and reliable. Although it is not advisable to disable tests everytime.

eclipse - cannot get project export/dependencies working

Ok. I am using eclipse kepler.
Ihave an eclipse project called 'afd-core'. It has some classes, and a directory etc/hibernate containing hibernate config - lookup.hbm.xml.
I have another project afd-public. It is a webapp, and needs the stuff in afd-core on it's classpath.
And I think I have tried everything.
afd-public->project referencers: added add-core as a referenced project
afd-public->java build path->projects: added afd-core
afd-public->java build path->order and export: marked afd-core as exported
afd-core->java build path->added etc/hibernate as a classpath entry
afd-core->order and export->marked etc/hibernate as exported
Didn't work. When I run add-public as a web app, complains that it cant find the hibernate config.
So I made etc/hibernate a source rather than a class direcrory. Still didn't work.
Explicitly added add-core/etc/hibernate as a class directory in the add-public project. Still didnt work. Marked those class drectories as 'exported'. Still didn't work.
Manually copied the hibernate config into afd-public/webapp/WEB-INF/classes . Ok, it finds the hibernate config, but it does not find the core class files.
In other words, the afd-public webapp is not including dependencies from afd-core AT ALL, not in any way, shape, or form into the webapp that it deploys locally to tomcat. Whether or not I mark them as exported from afd-core. Whether or not I include the project or the directories explicitly. Whether or not I do or dont export them from the afd-public webapp.
Nothing. nada. Won't go.
Help?
Found it. Goddamnit - I needed to fiddle with Deployment Assembly in afd-public. It seems that there are a couple of ways to do it.
I can include afd-public/build/classes and afd-public/etc/hibernate and have them deployed to WEBINF/classes, or I can deploy the add-core jarfile to lib.
To get the afd-core jarfile correct, I create afd-core as a j2ee "utility project" and check that the Deployment Assembly there is correct. Which it is.

ClassNotFoundException when using User Libraries in Eclipse build path

I'm using Eclipse 3.7 (STS) with Tomcat 7 running inside the IDE. I've created a new Dynamic Web project and added a single JSP file to the web content root folder. I can run Tomcat and access the JSP from within Eclipse with no problems.
I've added a few 3rd party JAR's to the project from User Libraries (I'm not using maven or auto dependecies managment). In the JSP I reference a class from the project's JAR file, I can compile this with no problem, but when I deploy on Tomcat the JSP throws ClassNotFoundException. Clearly, Tomcat can't find the JAR's from my library settings. I tried creating a Run As configuration for Tomcat Server and I set the classpath to match the classpath settings of the project, but I still get the same classnotfound problem.
I could get around the issue by manually copying all project JARs to the WEB-INF/lib directory so the webapp can find all dependencies, but that's absurd and I don't expect that to be the solution since it's a maintenance nightmare.
Am I missing something?
In project's properties, go to Deployment Assembly. Add there the buildpath entries as well which you've manually added as user libraries. It'll end up in /WEB-INF/lib of the deployed WAR.
You'll need to copy the jar files to the WEB-INF/lib folder: that is where they are supposed to be.
Eclipse should offer you the option of generating a WAR file that includes all the dependencies: I haven't used Web Tools for a good while but one way or another all dependencies have to be in WEB-INF/lib or the class loader won't be able to find them.

In eclipse, is there a way to specify a location other than the WEB-INF, for web.xml

I want to place development web.xml in another folder in eclipse.
This can be done using the Deployment Assembly properties. Right click on the web project, choose Properties, and then navigate to the Deployment Assembly panel. Remove the /WebContent entry (pointing to /) and then add another entry, of type Folder. It should be rooted where you want to keep the web.xml, and mapped to /.
This technique can be extended to make Eclipse work with arbitrary build tool source layouts.
You might want to use Apache Ant
for that purpose. You may define a "conf" directory and place all you config files there, or a resource directory for the same reason.
If haven't use ant for that purpose, I strongly recommend you to do so.
Here is a sample ant build.xml for a web app Sample Build.XML
I'll use Maven myself, but since you're just beginning, Ant would be just fine.
I am using the eclipse builder and not ant.
Actually what i did was that i defined web.xml in another folder. So now I have two web.xml, one for welogic with a lot weblogic specific stuff like filters. And i have another for development which i placed in another folder, in the web project and added this folder to the deployment descriptor for tomcat in eclipse. So now when i deploy the application, the web.xml for tomcat which is in my specified folder owerwrites the web.xml present in web-INF folder(in the deployment directory).
Looks to me a nice workaround.