JBoss 5.1: entity classes not found (vfszip)

I am using JBoss 5.1 with Hibernate 3.6, JPA 2.0 and Spring 3.0.5. I am using maven to create an EAR file that looks like this:

AutoTrader.ear -------> META-INF --------------> application.xml --------------> jboss-app.xml --------------> MANIFEST.MF -------> AutoTrader.war 

if I deploy this ear file in JBoss 5.1, I get an error

 org.springframework.dao.InvalidDataAccessApiUsageException: Not an entity: class uk.co.aol.shipmanager.domain.Manager; nested exception is ja va.lang.IllegalArgumentException: Not an entity: class uk.co.aol.shipmanager.domain.Subscription at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:286) ~[at_war-1.0.war:3 .0.5.RELEASE] at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:104) ~[at_war-1.0.war:3.0.5.RELEASE ] at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:368) ~[at_war-1. 0.war:3.0.5.RELEASE] at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:58 ) ~[at_war-1.0.war:3.0.5.RELEASE] 

However, if I breed a war file blown up, it works fine. Any suggestions are welcome.

Thanks Adi

UPDATE:

I added ResourceScanner, which extends NativeScanner:

 public class ResourceScanner extends NativeScanner { @Override public Set<Class<?>> getClassesInJar(final URL jarToScan, final Set<Class<? extends Annotation>> annotationsToLookFor) { return super.getClassesInJar(patchUrl(jarToScan), annotationsToLookFor); } @Override public Set<NamedInputStream> getFilesInJar(final URL jarToScan, final Set<String> filePatterns) { return super.getFilesInJar(patchUrl(jarToScan), filePatterns); } @Override public Set<Package> getPackagesInJar(final URL jarToScan, final Set<Class<? extends Annotation>> annotationsToLookFor) { return super.getPackagesInJar(patchUrl(jarToScan), annotationsToLookFor); } @Override public String getUnqualifiedJarName(final URL jarToScan) { return super.getUnqualifiedJarName(patchUrl(jarToScan)); } /** * Patch the VFS URL to a FILE protocol URL. * * @param url * original URL. * @return either the original, either the corresponding FILE protocol of given VFS URL. */ protected URL patchUrl(final URL url) { String protocol = url.getProtocol(); if (protocol.equals("vfs")) { try { File file = new File(url.getFile()); return file.toURI().toURL(); } catch (final MalformedURLException e) { return url; } catch (IOException e) { e.printStackTrace(); return url; } } return url; } } 

and, in spring -persistence.xml,

 <property name="hibernate.ejb.resource_scanner" value="uk.co.aol.shipmanager.ResourceScanner"/> 

This again works in a blown up war file.

But in the case of an EAR file, the vfszip protocol is not vfs.

Tell us what to do ???

+6
source share
1 answer

Have you tried to use the following system parameter and see if it helped solve the problem?

 -Dorg.jboss.net.protocol.file.useURI=false 
0
source

Source: https://habr.com/ru/post/914062/


All Articles