How to run Spring Samples? - spring

I check out mvc-ajax project into eclipse from this svn address
https://src.springframework.org/svn/spring-samples
and run it on server,but got the following error:
org.apache.jasper.JasperException: Unable to read TLD "META-INF/c.tld" from JAR file "file:/home/tom/source/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/mvc-ajax/WEB-INF/lib/jstl-1.2.jar": org.apache.jasper.JasperException: Failed to load or instantiate TagLibraryValidator class: org.apache.taglibs.standard.tlv.JstlCoreTLV
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:51)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:181)
at org.apache.jasper.compiler.TagLibraryInfoImpl.(TagLibraryInfoImpl.java:182)
at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:383)
at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:446)

Eclipse: Build Path -> Configure Build Path -> Libraries -> Add Library -> Server Runtime.
Then choose your server.

You are missing the c.tld taglib. Make sure you deploy it.

I was unable to reproduce this problem so this is a shot in the dark, but I often find I can fix unexpected deployment issues by cleaning my tomcat instance in Eclipse. Right click tomcat in your Servers view, and select Clean...

I can fix this issue by remove jsp-api.jar.
Not sure this is the best solution

I think I found a solution to the problem you were facing, while trying to solve mine.
This post proposes to comment the following dependences (due to problems with eclipse):
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
Kind Regards,
Despot

Even I too was facing the same problem while deploying into tomcat 6 server. I solved it by copying the jstl-1.2.jar into tomcat lib folder and solved.

Related

Imported Packages : com.day.cq.wcm.api,version=[1.29,2) and org.apache.sling.api.resource,version=[2.12,3) -- Cannot be resolved

I am facing a weird issue after creating the AEM project using the archetype 24 from https://experienceleague.adobe.com/docs/experience-manager-core-components/using/developing/archetype/overview.html?lang=en#available-properties
The project build successfully and deployed perfectly and somehow the osgi bundle is not "Active" because of below issue in bold: com.day.cq.wcm.api,version=[1.29,2) -- Cannot be resolved and org.apache.sling.api.resource,version=[2.12,3) -- Cannot be resolved
Imported Packages:
**com.day.cq.wcm.api,version=[1.29,2) -- Cannot be resolved**
**org.apache.sling.api.resource,version=[2.12,3) -- Cannot be resolved**
I have tried to add these dependencies in the parent pom finding in http://localhost:4502/system/console/depfinder
Somehow my efforts failed to resolve this issue, could anyone help me to resolve the issue.
thanks in advance
What you did to "solve" the issue is telling your bundle to accept any version of the packages. This very likely will cause problems later as you might get an incompatible implementation.
Instead what you should do is use the system console bundle view in AEM/sling to find out which versions of the packages are offered by the bundles. Probably the versions are lower than 1.29 and 2.12.
So the correct solution would be to use an older version of the archetype that matches the versions offered by your AEM/sling system.
Please change the language of the website to English and read the article here: https://flagtick.com/post/getting-started-with-aem-sites-setup-project-eduzone-system-part-7
It might help you a little bit.
</executions>
<dependencies>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.caconfig.bnd-plugin</artifactId>
<version>1.0.2</version>
</dependency>
</dependencies>
</plugin>
I had same problem with archetype 26.
resolved by adding this dependencies inside core/pom.xml
<!-- https://mvnrepository.com/artifact/com.day.cq.wcm/cq-wcm-api -->
<dependency>
<groupId>com.day.cq.wcm</groupId>
<artifactId>cq-wcm-api</artifactId>
<version>5.9.4</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.sling/org.apache.sling.api -->
<dependency>
<artifactId>org.apache.sling.api</artifactId>
<version>2.18.4</version>
<groupId>org.apache.sling</groupId>
<scope>provided</scope>
</dependency>

unable to resolve dependency for akamai edgegrid API

I am trying to use akamai edgegrid API for invalidating akamai chache. I have added below dependency in my pom.xml, but my bundle keeps in installed state. Below are more details-
pom.xml dependency-
<dependency>
<groupId>com.akamai.edgegrid</groupId>
<artifactId>edgegrid-signer-apache-http-client</artifactId>
<version>2.1.0</version>
<scope>provided</scope>
</dependency>
Bundle is in installed state, on felix console it says-
Imported Packages com.akamai.edgegrid.signer -- Cannot be resolved
error.log says -
Unable to resolve 497.82: missing requirement [497.82] osgi.wiring.package; (osgi.wiring.package=com.akamai.edgegrid.signer)
You have used <scope>provided</scope> , it means this jar will be used during compile time and during run time it will use the jar available on the run time environment. Unfortunately edgegrid-signer-apache-http-client-2.1.0.jar is not available on the AEM instance.
To resolve the issue, Do not use <scope>provided</scope> .
Updated POM -
<dependency>
<groupId>com.akamai.edgegrid</groupId>
<artifactId>edgegrid-signer-apache-http-client</artifactId>
<version>2.1.0</version>
</dependency>
Before deploying the bundle on AEM, extract the jar and check edgegrid-signer-apache-http-client.jar , edgegrid-signer-core.jar, httpclient.jar, httpcore.jar should be part of the bundle.
Hopefully it will solve your issue. All the best.
Please let me know if you still face any issue.
-Mrutyunjaya

Imported Git Repository but some imports are not found?

I have a Git Repository that I imported into Eclipse but it has some import errors.
I'm using Spring Redis version 1.8.4 and following their examples on how to do object mapping. I used the Jackson Mapper link and then followed that to the jackson-datatype-mongo mapper.
https://github.com/commercehub-oss/jackson-datatype-mongo
On my work computer everything is fine.
<dependency>
<groupId>com.commercehub.jackson</groupId>
<artifactId>jackson-datatype-mongo</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.7.6</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
<version>1.8.4.RELEASE</version>
</dependency>
If I remove the jackson-datatype-mongo dependency then the imports are fine but then I wouldn't have the MongoModule import. I tried one of eclipse's solutions and it said that it could an archive 'jackson-databind-2.8.1.jar' and everything would be clear. But then my '.classpath' file is now changed.
I don't understand how it is fine on one machine and all I did was clone the repository into another machine.
I solved the issue. I checked libraries in the project and it showed that the class was in there. So I went into '.m2\repository\com\fasterxml\jackson\core' and deleted the whole 'jackson-databind' folder and restarted eclipse and all the imports were now resolved.

After Cleaning a Maven Project from command prompt the server runtime library gets deleted

I am new to maven.
I created a dynamic web project and converted to maven project.
Then from command prompt i cleaned the project using mvn eclipse:clean
I refreshed the project in eclipse
It comes up with an error like JSP Problem : (the server runtime library deleted)
The superclass "javax.servlet.http.HttpServlet" was not found on the
Java Build Path home.jsp
After adding the server runtime library manually the problem solved.
Is there any other way to solve the problem or the problem will not occur at all.
Add below dependency in your pom.xml to avoid the exception:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>

Tomcat can not open sjsxp-1.0.2.jar

I have a maven project. And i am compiling intellij idea 13 without problems but i want to build in jenkins /home/tomcat/.m2/repository/com/sun/xml/stream/sjsxp/1.0.2/sjsxp-1.0.2.jar; error in opening zip file
this exception occur jenkins console. Anybody can help me ?
Thank you.
My maven dependency
<dependency>
<groupId>com.sun.xml.stream</groupId>
<artifactId>sjsxp</artifactId>
<version>1.0.2</version>
</dependency>
Thank you so much.
That typically means that the jar file has somehow been corrupt. Try deleting /home/tomcat/.m2/repository/com/sun/xml/stream/sjsxp/1.0.2/sjsxp-1.0.2.jar on the Jenkins-server and rerun the build.

Resources