List of deprecated Java packages in AEM 6.2


Here is a list of deprecated packages in AEM 6.2 that you should keep handy for your reference.
If you are not sure the new package/API you just Googled out is deprecated or not, then just
do a quick search here.

If it is there in the list , it shouldn't be there in your code!!



com.adobe.aem.formsndocuments.listeners
com.adobe.cq.creativecloud.cloudims
com.adobe.cq.creativecloud.filesync
com.adobe.cq.creativecloud.home
com.adobe.cq.dms.tagmanager
com.adobe.cq.mcm.silverpop
com.adobe.cq.social.blog
com.adobe.cq.social.blog.antispam
com.adobe.cq.social.blog.antispam.process
com.adobe.cq.social.blog.search
com.adobe.cq.social.blog.search.process
com.adobe.cq.social.blog.trackback
com.adobe.cq.social.blueprint.endpoints
com.adobe.cq.social.sc.lucene
com.adobe.cq.social.scoring.util
com.adobe.granite.ocs.api
com.adobe.granite.ocs.api.goals
com.adobe.granite.ocs.api.provider
com.adobe.livecycle.formsmanagement.api
com.adobe.livecycle.formsmanagement.exception
com.day.cq.activitystreams.api
com.day.cq.auth.pin
com.day.cq.dam.html
com.day.cq.jobs.core
com.day.cq.searchpromote.feed
com.day.cq.searchpromote.feed.api
com.day.crx.sc.api
com.day.crx.sc.osgi
com.day.crx.sc.qom
org.apache.aries.subsystem
org.apache.commons.imaging.formats.bmp.pixelparsers
org.apache.commons.imaging.formats.bmp.writers
org.apache.commons.imaging.formats.tga
org.apache.felix.prefs
org.apache.felix.scr
org.apache.jackrabbit.mk.api
org.apache.jackrabbit.oak.commons.mk
org.apache.jackrabbit.oak.kernel
org.apache.jackrabbit.oak.security.authentication.ldap
org.apache.sling.event
org.apache.sling.jcr.compiler
org.eclipse.equinox.region
org.joda.time.tz.data
org.joda.time.tz.data.Africa
org.joda.time.tz.data.America
org.joda.time.tz.data.America.Argentina
org.joda.time.tz.data.America.Indiana
org.joda.time.tz.data.America.Kentucky
org.joda.time.tz.data.America.North_Dakota
org.joda.time.tz.data.Antarctica
org.joda.time.tz.data.Asia
org.joda.time.tz.data.Atlantic
org.joda.time.tz.data.Australia
org.joda.time.tz.data.Etc
org.joda.time.tz.data.Europe
org.joda.time.tz.data.Indian
org.joda.time.tz.data.Pacific
org.osgi.service.prefs
org.osgi.service.repository
org.osgi.service.subsystem

Let me know about any issues. Suggestions are always welcome....


A solution for javax.jcr.lock.LockException

In one of my previous posts I showed how to connect to JCR using a simple
main() method , Java program
.
This is a simple program and should work fine in most of the cases.
But for some people it might throw a javax.jcr.lock.LockException.

Solution:

While connecting to the JCR we may use something like below.

 Session session = repository.login(new SimpleCredentials("admin", "admin".toCharArray()));
This statement may sometimes lead to an error in applications like AEM.
To avoid this we need to mention the default environemnt we are logging into.

So we should USE THIS INSTEAD.

Session session = repository.login( new SimpleCredentials("admin", "admin".toCharArray()),"crx.default");



I would be happy to hear back from you. Please leave your suggestions in the comment section below. Cheers!!



[FIX]:  javax.inject,version=[0.0,1) -- Cannot be resolved

The Scene:

So on a Saturday afernoon I was working on some AEM backend services and I came
across this issue which I have never faced before. It was something to do with the
javax.inject package that is used when we are using the @Inject annotations
in our classes.

The Problem:

So like a normal developer bloke I Googled around a bit and came to know that this was some
kind of dependency issue. But I was surprised that even though we can find the dependency using
depfinder --> http://localhost:4502/system/console/depfinder it was not resolved.


Finally the SOLUTION:

So I tried adding the javax.inject dependencies to my project POM file (i was using Maven)
and it WORKED!!!

    <dependency>
        <groupId>org.apache.geronimo.specs</groupId>
        <artifactId>geronimo-atinject_1.0_spec</artifactId>
        <version>1.0</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.inject</groupId>
        <artifactId>javax.inject</artifactId>
        <version>1</version>
    </dependency>


The Cause:

Though I am not quite sure about the cause for this issue but I believe
this is a problem persistent in AEM version 6.2 (AEM 6.2 javax.inject dependency problem)
as I have executed the same code in AEM 6.1 without issues.

Please let me know in the comments below if you have the reason or additional info.

Remove SOAP Request XML parameter programmatically.

SOAP is a protocol that allows systems to communicate using HTTP and uses predominantly XML
for communication. The necessity of web applications to inter communicate made it necessary for
a protocol to be designed.

Sometimes when setting the web service parameters there are compulsory parameters whose values needs
to be set. But passing these parameter might cause the Web Service to fail. So a situation may arise
where we need to both set the web service parameter value as well as remove the parameter from the
request XML!!!

So lets say for example you have a webservice parameter like this:

<ProductName>CoderMagnet<ProductName>
<CodeValue>...</CodeValue>
<ProductId>ABCXYZ<ProductId>


Suppose passing this value in the request xml is giving an error.
And also lets assume this is being set from the JAVA program like this.


product.setProductName("CoderMagnet");
product.setCodeValue("ABC123");
product.setProductId("004");



Now to remove this parameter from the web service request XML we just need to set
the parameter as NULL. This will remove the web service parameter from the request XML.


product.setProductName("CoderMagnet");
product.setCodeValue(null);
product.setProductId("004");



Afer you set a web service parameter to null. It will automatically
be dropped like shown below.


<ProductName>CoderMagnet<ProductName>
<ProductId>004<ProductId>



We can see from the above XML that the CodeValue got dropped.