[jbosstools-issues] [JBoss JIRA] Commented: (JBIDE-8765) "Provider org.apache.xerces.jaxp.SAXParserFactoryImpl not found" error with HibernateJpaProject with m2eclipse

Snjezana Peco (JIRA) jira-events at lists.jboss.org
Tue Apr 26 16:21:18 EDT 2011


    [ https://issues.jboss.org/browse/JBIDE-8765?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12598114#comment-12598114 ] 

Snjezana Peco commented on JBIDE-8765:
--------------------------------------

The issue can also be reproduced without m2eclipse. Some plugin that requires org.apache.xerces can be the cause of the problem (o.j.t.smooks.ui, o.j.t.common.model.ui, for instance).

The issue can be reproduced in the following way:

- disable the JPA validator
- comment or remove the line 277 in the HibernateConsolePlugin.class(JptJpaCorePlugin.getJpaProjectManager().getJpaProjects())
- create a Seam Web Project
- add the JPA facet 2.0 to the project
- restart Eclipse
- open the created Console Configuration

Eclipse will throw an exception and will disable a content handler (smooks, m2eclipse ...). 
Problem will not happen later because the content handler will be disabled.

It happens because of the way the ConsoleConfiguration classloader is defined(see ConsoleConfiguration.createClassLoader).
The classloader overrides loadClass and findClass methods what forces it to use the context of the org.hibernate.eclipse plugin.
However, the classloader doesn't override the getResource method and resources are being searched using the context of the plugin that called the action.
If the plugin includes xerces, this classloader finds the META-INF/services/javax.xml.parsers.SaxParserFactory resource that defines org.apache.xerces.jaxp.SAXParserFactoryImpl
Since classes are loaded using the classloader of the org.hibernate.eclipse plugin, this class can't be found. Eclipse throws the exception and disables the content handler. 

Solution:
- add the getResource method to the ConsoleConfiguration classloader

The line 277 in the HibernateConsolePlugin class can be commented/removed. This would also fix some other potential issues related to ConsoleConfiguration.

We can't include the org.eclipse.jpt.jpa.core dependency to the org.hibernate.eclipse.console plugin and exclude the org.eclipse.jst.j2ee.web plugin. The org.eclipse.jpt.jpa.core plugin indirectly requires the org.eclipse.jst.j2ee.web plugin and can't be started without it (see JptJpaCorePlugin.java line 203-204).

Attached is a patch.


> "Provider org.apache.xerces.jaxp.SAXParserFactoryImpl not found" error with HibernateJpaProject with m2eclipse
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: JBIDE-8765
>                 URL: https://issues.jboss.org/browse/JBIDE-8765
>             Project: Tools (JBoss Tools)
>          Issue Type: Bug
>          Components: Hibernate
>    Affects Versions: 3.3.0.M1
>            Reporter: Snjezana Peco
>            Assignee: Snjezana Peco
>         Attachments: jbide-8765.patch
>
>


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jbosstools-issues mailing list