• Community
  • Products
  • Jira Software
  • 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"

Patricia Hevia May 14, 2012

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

1 vote
Answer accepted
Patricia Hevia May 14, 2012

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
Patricia Hevia May 15, 2012

Thank you very much!

0 votes
JamieA
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.
May 14, 2012

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

Alexej Geldt
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.
January 8, 2014

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.

JamieA
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.
January 8, 2014

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

Alexej Geldt
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.
January 9, 2014

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.

Suggest an answer

Log in or Sign up to answer