I am trying to access this url for my autocomplete in the search box..
http://localhost:8080/api/v1/catalog/search/products?q=sauce
But, I am getting the following error.. It seems here that the
@Resource(name = "blExploitProtectionService")
protected ExploitProtectionService exploitProtectionService;
exploitProtectionService is null
And here is the error..
HTTP ERROR 500
Problem accessing /api/v1/catalog/search/products. Reason:
Server Error
Caused by:
java.lang.NullPointerException
at org.broadleafcommerce.core.web.api.endpoint.catalog.CatalogEndpoint.findProductsByQuery(CatalogEndpoint.java:190)
at com.mycompany.api.endpoint.catalog.CatalogEndpoint.findProductsByQuery(CatalogEndpoint.java:75)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
My web.xml is as follows
<servlet>
<servlet-name>RESTApiServlet</servlet-name>
<servlet-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>com.mycompany.api.endpoint</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>RESTApiServlet</servlet-name>
<url-pattern>/api/v1/*</url-pattern>
</servlet-mapping>
Next, my applicationContext.xml is
<context:component-scan base-package="org.broadleafcommerce.core.web.api"/>
and applicationContext-security.xml is
<!-- Set up Spring security for the RESTful API -->
<sec:http pattern="/api/**" create-session="stateless">
<sec:http-basic />
<sec:custom-filter ref="blRestCustomerStateFilter" after="REMEMBER_ME_FILTER"/>
</sec:http>
<!-- Used for REST api calls. This just takes in the passed in customerId and uses it to establish the customer. -->
<!-- Additional considerations MUST be made for implementations that are allowing external access to APIs. -->
<bean id="blRestCustomerStateFilter" class="org.broadleafcommerce.profile.web.core.security.RestApiCustomerStateFilter"/>
How to solve this problem? How do I make the exploitProtectionService
variable not null. How can it be initialized?
Thanks in advance.