previously initiated loading for a different type with name "javax/servlet/http/HttpServletRequest"

Brian-SadZebra July 1, 2016

I'm having a problem trying to get URL data using 

HttpServletRequest servReq = ServletActionContext.getRequest();
String test = servReq.getParameter("param");

Now i know that the first line "getRequest()" works fine, it is a problem with the "servReq.getParameter("param")".

I get the error stated in the title.

"Error rendering macro 'myMacro' : loader constraint violation: loader (instance of org/apache/felix/framework/BundleWiringImpl$BundleClassLoaderJava5) previously initiated loading for a different type with name "javax/servlet/http/HttpServletRequest"

Have no idea what this means really, i've been trying to figure it out for a while and still no luck.

This is the dependency in the POM

<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>servlet-api</artifactId>
    <version>2.4</version>
    <scope>provided</scope>
</dependency>

No i've tried to change somethings in the POM such as version and scope but nothing seems to stop the error.

Anyone know whats up with it or how to solve it?

If you you need any other information please comment.

Thanks.

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Petar Petrov (Appfire)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 1, 2016

This looks like a dependency conflict - the bundle class loader for your add-on has erroneously loaded the HttpServletRequest class. This means that this class is somehow packaged in your add-on. Your dependency scope seems correct, so there must be something else wrong with your pom. Do mvn clean install and open the produced jar file - do you see classes from javax.* packages inside? If yes - you need to figure out why this happens. If not, try running confluence again, maybe you did not run a clean build after your experiments with the pom?

Alok September 10, 2018

Thanks

TAGS
AUG Leaders

Atlassian Community Events