Reputation: 1
I wanted to create a sample servlet as a Jira-plugin according to a tutorial.
I have built the code as it is and I used the following pom.xml
to build the code.
When I run the servlet URL I'm getting the following issue about class cast.
[INFO] [talledLocalContainer] ERROR - 13:41:52,368 - com.atlassian.plugin.servlet.DefaultServletModuleManager - [http-bio-5990-exec-4] - Unable to create new reference LazyLoadedServletReference{d escriptor=com.atlassian.plugins.tutorial.refapp.adminUI:test (null), servletContext=org.apache.catalina.core.ApplicationContextFacade@2829d93e} [INFO] [talledLocalContainer] com.atlassian.util.concurrent.LazyReference$InitializationException: java.lang.ClassCastException: com.atlassian.plugins.tutorial.refapp.MyPluginServlet cannot be cast to javax.servlet.http.HttpServlet [INFO] [talledLocalContainer] at com.atlassian.util.concurrent.LazyReference.getInterruptibly(LazyReference.java:149)
Upvotes: 0
Views: 501
Reputation: 524
This is possibly a dependency issue in your pom.xml. Check to make sure you are not bundling resources into your plugin that already exist in the environment that is hosting your plugin.
In your case, you might want to check for this:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<scope>provided</scope>
</dependency>
With the key part here being <scope>provided</scope>
indicating this resource is needed for compilation but does not need to be bundled with the plugin as it is already provided by the runtime environment. If this line doesn't exist or the scope is anything other than provided, then try adding/changing it.
See this page for more info: Dependency Issues during Plugin Initialisation
Upvotes: 1