I created a solution, could you review it, please? I'm working on a test to it.
On Thu, Jan 17, 2019 at 10:09 AM Otávio Gonçalves de Santana < osant...@tomitribe.com> wrote: > > > I put these codes at CmpJpaConversion: > > > URL resource = CmpJpaConversion.class.getResource("."); > Path path = Paths.get(resource.toURI()); > Stream<Path> list = Files.list(path); > list.map(Path::getFileName).forEach(System.out::println); > > > > The output: > > SunConversion$SunColumnName.class > WsDeployer.class > EjbJarInfoBuilder.class > DeploymentModule$ID.class > ConfigurableClasspathArchive.class > DeploymentException.class > ReadDescriptors$UrlSource.class > DeploymentLoader$ExternalConfiguration.class > SunConversion$EntityData.class > RemoteServer$CleanUpThread.class > FinderFactory.class > GeneratedClientModules$Prune.class > WebappAggregatedArchive.class > ClearEmptyMappedName.class > OpenEjb2Conversion$EntityData.class > FinderFactory$ModuleLimitedFinder$FieldPredicate.class > DeploymentLoader$2.class > Deployment.class > AnnotationDeployer$ProcessAnnotatedBeans$AccessTimeoutHandler.class > AppInfoBuilder$1.class > EjbModule.class > OpenEJBDeploymentManager$DeploymentStatusImpl.class > ReportValidationResults$Level.class > ValidationRule.class > DebuggableVmHackery.class > DeploymentsResolver$DeploymentsConfigurationException.class > ConvertJMSConnectionFactoryDefinitions.class > AnnotationDeployer$1.class > TldScanner$2.class > OpenEJBDeploymentManager$TargetImpl.class > ServiceUtils.class > ValidationFailure.class > CompManagedBean$1.class > AnnotationDeployer$ProcessAnnotatedBeans$AnnotationHandler.class > AnnotationDeployer$3.class > FinderFactory$ModuleLimitedFinder$AnnotatedClassPredicate.class > AutoDeployer$1.class > AppValidator.class > AppInfoBuilder.class > ValidationWarning.class > ContainerUtils.class > Deploy.class > ConvertDataSourceDefinitions.class > OpenEJBDeploymentManager$ProgressObjectImpl.class > BeanProperties.class > FinderFactory$ModuleLimitedFinder.class > FinderFactory$OpenEJBAnnotationFinder.class > Cipher.class > VmDeploymentManager.class > WsModule.class > AnnotationDeployer$ProcessAnnotatedBeans$TransactionAttributeHandler.class > DeploymentsResolver$1.class > DeploymentLoader$1.class > AnnotationDeployer$ProvidedJAXRSApplication.class > Undeploy.class > OpenEJBDeploymentManager.class > PojoConfiguration.class > ScanConstants.class > PersistenceContextAnnFactory$PersistenceContextReader.class > NewLoaderLogic$3.class > DeploymentLoader.class > BuiltInEnvironmentEntries.class > MBeanDeployer.class > DeploymentModule.class > JndiEncInfoBuilder$1.class > ValidationException.class > CompManagedBean.class > Module.class > ConfigurationDeployer.class > OpenEJBDeploymentManager$TargetModuleIDImpl.class > VmDeploymentFactory.class > PersistenceContextAnnFactory$PersistenceContextVisitor$1.class > ConfigurationFactory$Chain.class > DeploymentsResolver$ClasspathSearcher.class > ConfigurableClasspathArchive$FakeModule.class > OutputGeneratedDescriptors.class > ContextRef.class > Undeploy$DeploymentTerminatedException.class > ActivationConfigPropertyOverride$MdbContainerDetails.class > RESTModule.class > QuickJarsTxtParser.class > Service.class > JPAPropertyConverter.class > MappedNameBuilder.class > PersistenceContextAnnFactory$PersistenceContextVisitor.class > AutoDeployer.class > NewLoaderLogic.class > FinderFactory$DebugArchive.class > AnnotationDeployer$2.class > SunConversion.class > Deploy$DeploymentTerminatedException.class > AnnotationDeployer.class > ConvertJMSDestinationDefinitions.class > NoSuchProviderException.class > LegacyProcessor.class > BeanTypes.class > ReadDescriptors$1.class > GeneratedClientModules.class > ConfigUtils.class > EmptyEjbJar.class > provider > ServiceUtils$ProviderInfo.class > AnnotationDeployer$FolderDDMapper.class > event > CompManagedBean$NoExtendedKeyedCollection$NoExtendedMap.class > FinderFactory$ModuleLimitedFinder$AnnotatedFieldPredicate.class > ValidationError.class > ScanUtil.class > NewLoaderLogic$OptimizedExclusionFilter.class > VmDeploymentManager$TargetModuleIDImpl.class > NameFiltering.class > PersistenceContextAnn.class > ApplicationComposerDeployer.class > SystemProperty.class > AnnotationDeployer$ProcessAnnotatedBeans$LockHandler.class > AnnotationDeployer$4.class > ReadDescriptors$2.class > NewLoaderLogic$1.class > SystemPropertiesOverride.class > AppModule.class > ModuleProperties.class > ConfigurationFactory.class > VmDeploymentManager$DeploymentStatusImpl.class > TldScanner.class > RequireDescriptors.class > AnnotationDeployer$ProcessAnnotatedBeans.class > FinderFactory$1.class > RemoteServer.class > EffectiveTomEEXml.class > AutoConfig$1.class > GeneratedClientModules$Add.class > LinkBuiltInTypes.class > SystemApps.class > AutoDeployer$DirectoryInfo.class > GeronimoMappedName.class > AppInfoBuilder$2.class > PersistenceContextAnnFactory$DirectPersistenceContext.class > ConfigurationFactory$1.class > typed > ActivationConfigPropertyOverride.class > AnnotationDeployer$FieldMember.class > ConfigurationFactory$ProxyBeanClassUpdate.class > AppInfoBuilder$PersistenceProviderProperties.class > PersistenceContextAnnFactory$1.class > ConnectorModule.class > RemoteServer$1.class > WebModule.class > ReadDescriptors$3.class > ServiceEndpoint.class > ApplicationProperties.class > MergeWebappJndiContext.class > FinderFactory$DoLoadClassesArchive.class > SunConversion$TokenType.class > AnnotationDeployer$ProcessAnnotatedBeans$ConcurrentMethodHandler.class > AutoDeployer$FileInfo.class > FinderFactory$ModuleLimitedFinder$MethodPredicate.class > PersistenceContextAnnFactory$AsmPersistenceContext.class > AnnotationDeployer$FilledMember.class > AnnotationDeployer$Member.class > UnsupportedModuleTypeException.class > DynamicDeployer.class > JndiEncInfoBuilder$SimpleRef.class > FinderFactory$ModuleLimitedFinder$ConstructorPredicate.class > PersistenceContextAnnFactory.class > AnnotationDeployer$MethodMember.class > WebappAggregatedArchive$ScanXmlSaverFilter.class > ResourcesModule.class > CompManagedBean$NoExtendedKeyedCollection.class > ConfigurationFactory$TopicOrQueueDefaults.class > CmpJpaConversion.class > AnnotationDeployer$DiscoverAnnotatedBeans.class > JndiEncInfoBuilder$Ref.class > NewLoaderLogic$2.class > TldScanner$1.class > Messages.properties > ReadDescriptors$Source.class > VmDeploymentManager$ProgressObjectImpl.class > InitEjbDeployments.class > PersistenceUnitLinkResolver.class > DeploymentsResolver.class > DeploymentFilterable.class > AppContextConfigDeployer.class > AnnotationDeployer$ProcessAnnotatedBeans$BusinessInterfaces.class > ReadDescriptors.class > rules > SystemAppInfo.class > AdditionalBeanDiscoverer.class > JPAPropertyConverter$Pair.class > BaseConvertDefinitions.class > ReadDescriptors$StringSource.class > OpenEjb2Conversion.class > FinderFactory$ModuleLimitedFinder$Predicate.class > CleanEnvEntries.class > ValidationFailedException.class > FinderFactory$ModuleLimitedFinder$AnnotatedMethodPredicate.class > ConfigurationFactory$DefaultService.class > RemoveWebServices.class > AutoConfig$AppResources.class > UnknownModuleTypeException.class > ScanUtil$ScanHandler.class > AutoConfig.class > JndiEncInfoBuilder.class > FinderFactory$ModuleLimitedFinder$ClassPredicate.class > ValidationContext.class > sys > QuickServerXmlParser.class > ValidateModules.class > ApplyOpenejbJar.class > ValidationResults.class > ClientModule.class > WlsConversion.class > VmDeploymentManager$TargetImpl.class > PersistenceModule.class > EnvEntriesPropertiesDeployer.class > ReportValidationResults.class > > > > On Thu, Jan 17, 2019 at 9:50 AM Jonathan Gallimore < > jonathan.gallim...@gmail.com> wrote: > >> I'd say we should try the same jar that persistence.xml is in. That said, >> I >> thought it was loaded via the classloader, so what's on the classpath when >> we try and read this file? >> >> Jon >> >> On Thu, Jan 17, 2019 at 11:44 AM Otávio Gonçalves de Santana < >> osant...@tomitribe.com> wrote: >> >> > Given an EAR package that has an EJB jar with a persistence.xml within a >> > mapping-file element. >> > The CmpJpaConversion >> > < >> > >> https://github.com/apache/tomee/blob/master/container/openejb-core/src/main/java/org/apache/openejb/config/CmpJpaConversion.java#L109L128 >> > > >> > does not find this reference because when it reads, this file reference >> > isn’t in the jar anymore but in the EAR location. >> > It seems that the DeploymentLoader >> > < >> > >> https://github.com/apache/tomee/blob/master/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java >> > > >> > goes to all jar files to find the persistence XML. However, it doesn’t >> load >> > the others resources files. >> > >> > IMHO: that does not look an easy solution, because it raises some >> > decisions: >> > >> > - What happens if have one or more jar file with the same file name? >> > - Should we have priorities? >> > - Should we read the mapping-file just from the specific jar file? >> > >> > Ref: https://github.com/apache/tomee/pull/374 >> > >> >