Hi All,
Suddenly I have started getting this error on my page. Below are some more details on the error.
Error Message: org.apache.sling.api.scripting.ScriptEvaluationException: org.apache.sling.scripting.jsp.jasper.JasperException: The absolute uri: http://www.mercer.com/taglibs/mhrtaglib/1.0 cannot be resolved in either web.xml or the jar files deployed with this application
Here is my sample JSP
<%@include file="/libs/foundation/global.jsp" %> <%@taglib prefix="mhr" uri="http://www.mercer.com/taglibs/mhrtaglib/1.0"%> <% %> <html> <head> <title>A sample custom tag</title> <cq:includeClientLib css="etc.designs.mercer.clientlibs"/> </head> <body> <mhr:Hello/> </body>
and here is the tld
<taglib> <tlib-version>1.0</tlib-version> <jsp-version>2.0</jsp-version> <short-name>Example TLD</short-name> <uri>http://www.mercer.com/taglibs/mhrtaglib/1.0</uri> <tag> <name>Hello</name> <tag-class>com.mercer.taglibs.tags.HelloWorld</tag-class> <body-content>empty</body-content> </tag> </taglib>
and also providing the dependencies because I think somewhere the problem is with the libs:
<dependencyManagement> <dependencies> <dependency> <groupId>org.osgi</groupId> <artifactId>org.osgi.core</artifactId> <version>4.2.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.osgi</groupId> <artifactId>org.osgi.compendium</artifactId> <version>4.2.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.apache.felix</groupId> <artifactId>org.apache.felix.scr.annotations</artifactId> <version>1.6.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>biz.aQute</groupId> <artifactId>bndlib</artifactId> <version>1.43.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.5.10</version> <scope>provided</scope> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>2.5</version> <scope>provided</scope> </dependency> <dependency> <groupId>javax.jcr</groupId> <artifactId>jcr</artifactId> <version>2.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.api</artifactId> <version>2.2.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.jcr.api</artifactId> <version>2.1.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.8.1</version> <scope>test</scope> </dependency> <!-- dependency defined by AnkitC for CQ APIs::Start --> <dependency> <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.jcr.jcr-wrapper</artifactId> <version>2.0.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>com.day.cq.wcm</groupId> <artifactId>cq-wcm-api</artifactId> <version>5.6.2</version> <scope>provided</scope> </dependency> <dependency> <groupId>com.day.cq</groupId> <artifactId>cq-commons</artifactId> <version>5.6.2</version> <scope>provided</scope> </dependency> <dependency> <groupId>com.day.cq.wcm</groupId> <artifactId>cq-wcm-commons</artifactId> <version>5.6.2</version> <scope>provided</scope> </dependency> <dependency> <groupId>com.day.commons</groupId> <artifactId>day-commons-jstl</artifactId> <version>1.1.4</version> <scope>provided</scope> </dependency> <dependency> <groupId>com.day.cq.wcm</groupId> <artifactId>cq-wcm-taglib</artifactId> <version>5.6.2</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.scripting.jsp.taglib</artifactId> <version>2.1.8</version> <scope>provided</scope> </dependency> <dependency> <groupId>com.adobe.granite</groupId> <artifactId>com.adobe.granite.xssprotection</artifactId> <version>5.5.22</version> <scope>provided</scope> </dependency> <!-- dependency provided by AnkitC::Stop --> <!-- dependency provided by AnkitC::Start --> <dependency> <groupId>com.adobe.granite</groupId> <artifactId>com.adobe.granite.ui.commons</artifactId> <version>5.5.60</version> <scope>provided</scope> </dependency> <!-- dependency provided by AnkitC::Stop --> <!-- dependency provided by AnkitC::Start --> <dependency> <groupId>com.day.cq.wcm</groupId> <artifactId>cq-wcm-core</artifactId> <version>5.6.4</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> <version>3.0.1</version> <scope>provided</scope> </dependency> <dependency> <groupId>com.googlecode.json-simple</groupId> <artifactId>json-simple</artifactId> <version>1.1</version> </dependency> <dependency> <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.commons.osgi</artifactId> <version>2.2.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>jstl</artifactId> <version>1.2</version> </dependency> <dependency> <groupId>javax.servlet.jsp</groupId> <artifactId>jsp-api</artifactId> <version>2.1</version> </dependency> <!-- dependency defined by AnkitC for CQ APIs::Stop --> </dependencies> </dependencyManagement>
Do let me know if there is some more information I need to provide.
Thanks in advance,
Ankit
Solved! Go to Solution.
Views
Replies
Total Likes
All Java that you build in CQ are placed into an OSGi bundle -- CQ is really an OSGi service container :
http://blogs.adobe.com/kmossman/2012/04/osgi-sling-service-example.html
I recommend building your Java using as OSGi, deploy it to CQ. You can use the Felix Console to determine its running. See this community article to build a basic OSGi for CQ using CRXDE:
http://scottsdigitalcommunity.blogspot.ca/2012/04/creating-osgi-bundles-for-adobe-digital.html
When you get more comfortable with building OSGi -- you can start building them with Maven. See this one as an example of building an OSGi with Maven:
http://scottsdigitalcommunity.blogspot.ca/2013/01/persisting-cq-data-in-java-content.html
First thing to do is to take the Java you want to use in your tag libs and make sure you got it successfully in an OSGi. For example - assume you want to get this into an OSGi:
package
com.adobe.test;
import
com.adobe.myexample.*;
public
class
Echo {
public
String getMessage(String msg)
{
EchoService2 echo =
new
EchoService2();
String msg2 = echo.sayHello(msg);
return
msg2;
}
}
Get this into an OSGi. Once you get that into an OSGi -- you can call it from a JSP using syntax like:
<%@include file=
"/libs/foundation/global.jsp"
%>
<%@ page import=
"com.adobe.test.Echo"
%>
<h1><%= properties.get(
"title"
, currentPage.getTitle()) %></h1>
<%
Echo hw =
new
Echo();
%>
<h3><%= hw.getMessage(
"Hi There"
) %></h3>
Make sure that you can do that -- then go to tags that you have in your example. That is - before tags will work - you have to ensure that the Java is deployed and in an Active state. Read the 2 links above.
Hope this helps.
Views
Replies
Total Likes
Can you see your Java deployed to CQ using the Felix console?
Views
Replies
Total Likes
Thanks for the response smacdonald2008. But how do I check that.
Views
Replies
Total Likes
All Java that you build in CQ are placed into an OSGi bundle -- CQ is really an OSGi service container :
http://blogs.adobe.com/kmossman/2012/04/osgi-sling-service-example.html
I recommend building your Java using as OSGi, deploy it to CQ. You can use the Felix Console to determine its running. See this community article to build a basic OSGi for CQ using CRXDE:
http://scottsdigitalcommunity.blogspot.ca/2012/04/creating-osgi-bundles-for-adobe-digital.html
When you get more comfortable with building OSGi -- you can start building them with Maven. See this one as an example of building an OSGi with Maven:
http://scottsdigitalcommunity.blogspot.ca/2013/01/persisting-cq-data-in-java-content.html
First thing to do is to take the Java you want to use in your tag libs and make sure you got it successfully in an OSGi. For example - assume you want to get this into an OSGi:
package
com.adobe.test;
import
com.adobe.myexample.*;
public
class
Echo {
public
String getMessage(String msg)
{
EchoService2 echo =
new
EchoService2();
String msg2 = echo.sayHello(msg);
return
msg2;
}
}
Get this into an OSGi. Once you get that into an OSGi -- you can call it from a JSP using syntax like:
<%@include file=
"/libs/foundation/global.jsp"
%>
<%@ page import=
"com.adobe.test.Echo"
%>
<h1><%= properties.get(
"title"
, currentPage.getTitle()) %></h1>
<%
Echo hw =
new
Echo();
%>
<h3><%= hw.getMessage(
"Hi There"
) %></h3>
Make sure that you can do that -- then go to tags that you have in your example. That is - before tags will work - you have to ensure that the Java is deployed and in an Active state. Read the 2 links above.
Hope this helps.
Views
Replies
Total Likes
Thank you for the detailed response and I am already using maven to build the OSGi bundles. The problem is it was working fine till a couple of days before, not sure what exactly went wrong. I am using eclipse as the IDE and maven to build the project.
Also, while I am building the project I am getting the following warnings:
dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: javax.servlet.jsp:jsp-api:jar -> version 2.1 vs (?) @ line 169, column 15
'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: javax.servlet.jsp:jsp-api:jar -> version 2.1 vs (?) @ line 104, column 15
Also, I can see in the install folder of local CQ workspace, there versions of jar. Any reason why this happening ?
Can this be the reason ?
Regards,
Ankit
Views
Replies
Total Likes
In this community article:
http://scottsdigitalcommunity.blogspot.ca/2012/04/creating-osgi-bundles-for-adobe-digital.html
It talks about how to use the Felix console to see if the OSGi is installed and active - check that first to rule out if that is the issue.
[img]ADeploy.png[/img]
See if your bundle is active.
Views
Replies
Total Likes
I have been able to resolve this now. I tried everything but nothing worked. So I had to replace the trunk in my code with the branch. Anyway, thanks for all the inputs. Learned something new !
Regards,
Ankit
Views
Replies
Total Likes