How to fix failing service calls in a web environment

Crownpeak employee
Crownpeak employee
3 1 1,370

Recently more people seem to use FirstSpirits capabilities to extend functionality with custom services and custom components.And I'm always happy to support this. Smiley Happy

One common pitfall seems to be the communication between a custom input component (aka Gadget) and a service, which fails with a ServiceNotFoundException caused by a ClassNotFoundException.

This is the common failure trace:

de.espirit.firstspirit.access.ServiceNotFoundException: Service '<custom service interface name>' not found






     <part from custom code>    

     <long part from FirstSpirit code>

Caused by: java.lang.IllegalStateException: java.lang.ClassNotFoundException: <custom service interface name>



     ... XX more

Caused by: java.lang.ClassNotFoundException: <custom service interface name>

     <potentially long part from web container code>

     at java.lang.ClassLoader.loadClass(


     ... ZZ more

The cause is that the class is simply not known within the scope of the web environment.

To fix this, first your module needs to define the web-app block in the descriptor (module.xml😞


















Relevant are the web-resources line which must reference your JAR file and the web-xml line.

The web.xml file itself may have minimal content:

<?xml version="1.0" encoding="ISO-8859-1"?>

<web-app xmlns:xsi="" xmlns="" xsi:schemaLocation="" version="2.4">




The structure of your FSM file should then (at least) look like this:

+ lib

    - your.jar



   -  module.xml

- web.xml

The next step is to add and deploy the web application (at least into the Preview scope):


After these steps, the ClassNotFoundException is history.

[tested with upcoming 5.1 release - release 5.0 may be less restrictive when "Internal Jetty" is used as web server]

1 Comment
Version history
Last update:
‎03-27-2014 04:15 AM
Updated by: