• Community
  • Products
  • Jira
  • Questions
  • loader (instance of org/apache/felix/framework/ModuleImpl$ModuleClassLoader) previously initiated loading for a different type with name "javax/servlet/http/HttpServletRequest"

loader (instance of org/apache/felix/framework/ModuleImpl$ModuleClassLoader) previously initiated loading for a different type with name "javax/servlet/http/HttpServletRequest"

Hello,

I am developing a webwork action that has a reading a xlsx file to use this POI. In implementing the action get the following errors:

[WARNING] [talledLocalContainer] GRAVE: Servlet.service() para servlet action lanz¾ excepci¾n

[WARNING] [talledLocalContainer] java.lang.LinkageError: loader constraint violation: loader (instance of org/apache/felix/framework/ModuleImpl$ModuleClassLoader) previously initiated loading for a different type with name "javax/servlet/http/HttpServletRequest"

[WARNING] [talledLocalContainer] at java.lang.ClassLoader.defineClass1(Native Method)

[WARNING] [talledLocalContainer] at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)

[WARNING] [talledLocalContainer] at java.lang.ClassLoader.defineClass(ClassLoader.java:616)

[WARNING] [talledLocalContainer] at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.findClass(ModuleImpl.java:1829)

[WARNING] [talledLocalContainer] at org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:716)

[WARNING] [talledLocalContainer] at org.apache.felix.framework.ModuleImpl.access$200(ModuleImpl.java:73)

[WARNING] [talledLocalContainer] at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1690)

[WARNING] [talledLocalContainer] at java.lang.ClassLoader.loadClass(ClassLoader.java:248)

The pom.xml is:

<dependencies>

<dependency>

<groupId>com.atlassian.jira</groupId>

<artifactId>atlassian-jira</artifactId>

<version>${jira.version}</version>

<scope>provided</scope>

</dependency>

<dependency>

<groupId>junit</groupId>

<artifactId>junit</artifactId>

<version>4.6</version>

<scope>test</scope>

</dependency>

<dependency>

<groupId>com.atlassian.jira</groupId>

<artifactId>jira-func-tests</artifactId>

<version>${jira.version}</version>

<scope>test</scope>

</dependency>

<dependency>

<groupId>com.atlassian.core</groupId>

<artifactId>atlassian-core</artifactId>

<version>4.0</version>

<scope>provided</scope>

</dependency>

<dependency>

<groupId>javax.servlet</groupId>

<artifactId>servlet-api</artifactId>

<version>2.4</version>

</dependency>

</dependencies>

Thank you very much!

Patri.

3 answers

1 accepted

Thank you very much, it worked but I have another problem. Reading the xlsx file with POI gives the following error:

[INFO] [talledLocalContainer] Warning: Caught exception attempting to use SAX to load a SAX XMLReader
[INFO] [talledLocalContainer] Warning: Exception was: java.lang.ClassCastException: org.apache.xerces.parsers.SAXParser cannot be cast to org.xml.sax.XMLReader
[INFO] [talledLocalContainer] Warning: I will print the stack trace then carry on using the default SAX parser
[INFO] [talledLocalContainer] java.lang.ClassCastException: org.apache.xerces.parsers.SAXParser cannot be cast to org.xml.sax.XMLReader
[INFO] [talledLocalContainer] at org.xml.sax.helpers.XMLReaderFactory.loadClass(Unknown Source)
[INFO] [talledLocalContainer] at org.xml.sax.helpers.XMLReaderFactory.createXMLReader(Unknown Source)
[INFO] [talledLocalContainer] at org.dom4j.io.SAXHelper.createXMLReader(SAXHelper.java:74)
[INFO] [talledLocalContainer] at org.dom4j.io.SAXReader.createXMLReader(SAXReader.java:647)
[INFO] [talledLocalContainer] at org.dom4j.io.SAXReader.getXMLReader(SAXReader.java:530)
[INFO] [talledLocalContainer] at org.dom4j.io.SAXReader.read(SAXReader.java:309)
[INFO] [talledLocalContainer] at org.dom4j.io.SAXReader.read(SAXReader.java:261)

The pom.xml is:

<dependencies>
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>atlassian-jira</artifactId>
<version>${jira.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.6</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-func-tests</artifactId>
<version>${jira.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>opensymphony</groupId>
<artifactId>webwork</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.8</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.8</version>
</dependency>
</dependencies>
Any ideas?

Thank you very much!

Patri.

0 votes

The scope for the servlet API should be provided, not the default, which is compile.

can you explain why?

I am getting java.lang.LinkageError with my own library and trying to figure out where it comes from. Im suspecting the scope of dependency for my own library might be wrong.

What is the library, is it one that is also included in jira itself?

no it is my own library which is a simple maven project.

actually, i have already found a workaround. let me tell you the whole story...

i have developed this library a while ago. I have pulled in the dependency in my jira plugin. Then i was able to use that library as it seemed. However, one of the classes failed to load at runtime (just one class, most classes were loading without problems) with LinkageError telling me that there were multiple classes of this type on classpath.

now i have solved this problem by instantiating this class manually instead of using constructor injection as i was used to. This solved the problem.

So i guess, it may be related to OSGi or Spring dependency management. Not sure if it is a bug or not.

Thank you very much!

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,083 views 13 18
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot