Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.

AEM 6.5 Custom Servlet Not found

Avatar

Level 3

Hi everyone,

 

My problem is similar to this thread 解決済み: AEM 6.4 Servlet POST request not hitting servlet - Adobe Experience League Community - 252974 but my problem is when I do the request, I get a 404 error. 

Seems like it is not installed at all and maybe something wrong with my pom file so i really prefer some help.

This is my pom file:

 

<dependency>      
        <groupId>com.adobe.aem</groupId>       
        <artifactId>aem-sdk-api</artifactId>         
        <version>${aem.sdk.api}</version>  
        <scope>provided</scope>
</dependency>

<dependency>
    <groupId>com.adobe.acs</groupId>
    <artifactId>acs-aem-commons-content</artifactId>
    <version>5.3.4</version>
    <type>zip</type>
</dependency>
                 
<dependency>               
        <groupId>com.adobe.cq</groupId>              
        <artifactId>core.wcm.components.core</artifactId>              
        <version>${core.wcm.components.version}</version>          
</dependency>         
                 
<dependency>               
        <groupId>org.junit</groupId>                
        <artifactId>junit-bom</artifactId>            
        <version>5.8.2</version>           
        <type>pom</type>               
        <scope>import</scope>         
</dependency>
                 
<dependency>              
        <groupId>org.mockito</groupId>              
        <artifactId>mockito-core</artifactId>               
        <version>4.1.0</version>             
        <scope>test</scope>    
</dependency>
                 
<dependency>              
        <groupId>org.mockito</groupId>             
        <artifactId>mockito-junit-jupiter</artifactId>           
        <version>4.1.0</version>       
        <scope>test</scope>
</dependency>
                 
<dependency>              
        <groupId>junit-addons</groupId>              
        <artifactId>junit-addons</artifactId>            
        <version>1.4</version>             
        <scope>test</scope>           
</dependency>
                 
<dependency>           
        <groupId>io.wcm</groupId>          
        <artifactId>io.wcm.testing.aem-mock.junit5</artifactId>           
        <version>4.1.8</version>             
        <scope>test</scope>      
</dependency>
                 
<dependency>           
        <groupId>org.apache.sling</groupId>           
        <artifactId>org.apache.sling.testing.caconfig-mock-plugin</artifactId>        
        <version>1.3.6</version>       
</dependency>
                 
<dependency>            
        <groupId>com.adobe.cq</groupId>             
        <artifactId>core.wcm.components.testing.aem-mock-plugin</artifactId>             
        <version>${core.wcm.components.version}</version>             
        <scope>test</scope>         
</dependency>
                 
<dependency>       
        <groupId>uk.org.lidalia</groupId>           
        <artifactId>slf4j-test</artifactId>        
        <version>1.0.1</version>
        <scope>test</scope>     
</dependency>
 
<dependency>             
        <groupId>com.day.commons</groupId>   
        <artifactId>day.commons.datasource.poolservice</artifactId>            
        <version>1.0.10</version>  
        <scope>provided</scope>    
</dependency>
5 Replies

Avatar

Community Advisor

Could you check whether the bundle is in active state? is it path servlet or resource type servlet? Or a code snippet would help to identify 

Avatar

Level 3

Hi!Thank you for your response!

 

The bundle is in active state and it is a path servlet.

code below

 

package com.adobe.training.core.servlets;

import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.SlingHttpServletResponse;
import org.apache.sling.jcr.api.SlingRepository;
import org.apache.sling.api.servlets.SlingAllMethodsServlet;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
import java.io.IOException;
import javax.jcr.Session;
import javax.servlet.Servlet;
import javax.servlet.ServletException;
import org.apache.sling.api.servlets.HttpConstants;
import org.osgi.framework.Constants;


@Component(
    service = Servlet.class,
    property = {
        Constants.SERVICE_DESCRIPTION + "=Video servlet",
                        "sling.servlet.paths=" + "/bin/damUpload/video",
                "sling.servlet.methods=" + HttpConstants.METHOD_POST
        })
public class SimplePostServlet extends SlingAllMethodsServlet {
//
}

Avatar

Community Advisor

@zonghuiliu as part of your servlet class can you check in the bundle if the servlet is in satified state or in unsatified state. 

Avatar

Level 3

Hi!Thank you for your response!

 

I'm not sure but seems like it is in unsatified state.

Could you please share the right way to confirm the state?