Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » ElementCollection List<String> Exception during deployment
ElementCollection List<String> Exception during deployment [message #1828023] Fri, 29 May 2020 09:42 Go to next message
Marc Fisch is currently offline Marc FischFriend
Messages: 3
Registered: May 2020
Junior Member
Hi all,

I hope somebody can help me out with this issue, for which I could not find an answer to.

I am using ElementCollections for a List of Strings in which I store some configuration items.


@Entity
@Table(name = "T_TABLE")
public class MyEntity implements Serializable {
   
    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "REPORT_SEQ")
    @SequenceGenerator(name = "REPORT_SEQ", sequenceName = "REPORT_SEQ", allocationSize = 1, initialValue = 100)
    private long id;

    @ElementCollection(targetClass = java.lang.String.class, fetch = FetchType.EAGER)
    private List<String> users = new ArrayList<>();

... getter and setters...



When I deploy my code on a Payara 5.193 and 5.194 full I get the following exception, but the application runs totally fine.
I also get the same error when testing locally with H2DB.

java.lang.ClassNotFoundException: java.util.Listjava.lang.String
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:419)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:352)
	at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1475)
	at org.apache.felix.framework.BundleWiringImpl.access$300(BundleWiringImpl.java:79)
	at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1982)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:352)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:264)
	at org.eclipse.persistence.internal.jpa.metadata.accessors.objects.MetadataAsmFactory.getVirtualMetadataClass(MetadataAsmFactory.java:542)
	at org.eclipse.persistence.internal.jpa.metadata.accessors.objects.MetadataAsmFactory.buildClassMetadata(MetadataAsmFactory.java:143)
	at org.eclipse.persistence.internal.jpa.metadata.accessors.objects.MetadataAsmFactory.getMetadataClass(MetadataAsmFactory.java:177)
	at org.eclipse.persistence.internal.jpa.metadata.accessors.objects.MetadataAccessibleObject.getMetadataClass(MetadataAccessibleObject.java:73)
	at org.eclipse.persistence.internal.jpa.metadata.accessors.objects.MetadataAnnotatedElement.getRawClassWithGenerics(MetadataAnnotatedElement.java:395)
	at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.MappingAccessor.getRawClassWithGenerics(MappingAccessor.java:965)
	at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.MappingAccessor.getReferenceClassWithGenerics(MappingAccessor.java:996)
	at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.DirectCollectionAccessor.processDirectCollectionMapping(DirectCollectionAccessor.java:463)
	at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.ElementCollectionAccessor.process(ElementCollectionAccessor.java:875)
	at org.eclipse.persistence.internal.jpa.metadata.MetadataProject.processDirectCollectionAccessors(MetadataProject.java:1622)
	at org.eclipse.persistence.internal.jpa.metadata.MetadataProject.processStage3(MetadataProject.java:1911)
	at org.eclipse.persistence.internal.jpa.metadata.MetadataProcessor.processORMMetadata(MetadataProcessor.java:584)
	at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processORMetadata(PersistenceUnitProcessor.java:629)
	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:2003)
	at org.eclipse.persistence.jpa.PersistenceProvider.createContainerEntityManagerFactoryImpl(PersistenceProvider.java:350)
	at org.eclipse.persistence.jpa.PersistenceProvider.createContainerEntityManagerFactory(PersistenceProvider.java:316)
	at org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:207)
	at org.glassfish.persistence.jpa.PersistenceUnitLoader.<init>(PersistenceUnitLoader.java:114)
	at org.glassfish.persistence.jpa.JPADeployer$1.visitPUD(JPADeployer.java:225)
	at org.glassfish.persistence.jpa.JPADeployer$PersistenceUnitDescriptorIterator.iteratePUDs(JPADeployer.java:525)
	at org.glassfish.persistence.jpa.JPADeployer.createEMFs(JPADeployer.java:240)
	at org.glassfish.persistence.jpa.JPADeployer.prepare(JPADeployer.java:170)
	at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:1045)
	at com.sun.enterprise.v3.server.ApplicationLifecycle.prepare(ApplicationLifecycle.java:475)
	at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:538)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:558)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:554)
	at java.security.AccessController.doPrivileged(Native Method)
	at javax.security.auth.Subject.doAs(Subject.java:360)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:553)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:584)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:576)
	at java.security.AccessController.doPrivileged(Native Method)
	at javax.security.auth.Subject.doAs(Subject.java:360)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:575)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1496)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:120)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1878)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1754)
	at org.glassfish.admin.rest.resources.admin.CommandResource.executeCommand(CommandResource.java:409)
	at org.glassfish.admin.rest.resources.admin.CommandResource.execCommandSimpInMultOut(CommandResource.java:236)
	at sun.reflect.GeneratedMethodAccessor411.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.java:52)
	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:124)
	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:167)
	at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:176)
	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:79)
	at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:469)
	at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:391)
	at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:80)
	at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:253)
	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:248)
	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:244)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:292)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:274)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:244)
	at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:265)
	at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:232)
	at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:680)
	at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:353)
	at org.glassfish.admin.rest.adapter.JerseyContainerCommandService$3.service(JerseyContainerCommandService.java:179)
	at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:189)
	at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:520)
	at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:217)
	at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:182)
	at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:156)
	at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:218)
	at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:95)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:260)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:177)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:109)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:88)
	at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:53)
	at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:524)
	at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:89)
	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:94)
	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:33)
	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:114)
	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:569)
	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:549)
	at java.lang.Thread.run(Thread.java:748)


<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="...xmlns.jcp.org/xml/ns/persistence"
	xmlns:xsi="...www.w3.org/2001/XMLSchema-instance" version="2.2"
	xsi:schemaLocation=".../xmlns.jcp.org/xml/ns/persistence ...xmlns.jcp.org/xml/ns/persistence/persistence_2_2.xsd">


	<persistence-unit name="punit" transaction-type="JTA">
		<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
		<jta-data-source>java:global/app/AppDS</jta-data-source>


		<class>FullyQualifiedNameToEntity</class>

		<properties>
			<property name="eclipselink.target-database"
				value="org.eclipse.persistence.platform.database.PostgreSQLPlatform" />
			<property name="eclipselink.jdbc.batch-writing" value="JDBC" />
			<property name="eclipselink.jdbc.batch-writing.size"
				value="1000" />
			<property name="eclipselink.logging.level" value="FINE" />
			<property name="eclipselink.logging.level.sql" value="FINE" />
			<property name="eclipselink.logging.parameters" value="true" />
		</properties>

	</persistence-unit>
</persistence>


I use this type of ElementCollection multiple times, but I only get one exception thrown during deployment.

Does anybody have an idea what I am doing wrong?

Thanks
Re: ElementCollection List<String> Exception during deployment [message #1828098 is a reply to message #1828023] Mon, 01 June 2020 16:25 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
Registered: July 2009
Senior Member
Odd it seems to be looking for "java.util.Listjava.lang.String".
Have you tried removing the targetClass definition?
    @ElementCollection(fetch = FetchType.EAGER)
    private List<String> users = new ArrayList<>();


or even
    @ElementCollection(targetClass=String.class, fetch = FetchType.EAGER)
    private List<String> users = new ArrayList<>();

Re: ElementCollection List<String> Exception during deployment [message #1828099 is a reply to message #1828098] Mon, 01 June 2020 16:41 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
Registered: July 2009
Senior Member
Looking more closely at the stack trace, the issue is with the generics. You can try removing <String> from the List which will avoid the problem.

What version of EclipseLink are you using? The line numbers and methods don't match up to what I have locally, so I suspect you are using an older version with a bug that might have been fixed.
Re: ElementCollection List<String> Exception during deployment [message #1828356 is a reply to message #1828099] Mon, 08 June 2020 10:58 Go to previous messageGo to next message
Marc Fisch is currently offline Marc FischFriend
Messages: 3
Registered: May 2020
Junior Member
Hi Chris,

thanks for your reply. I finally got around to test your suggestions.

Changing the target Class did not help.

But removing the type for the List did remove the exception.
Now I have my IDE and Sonar yelling at me. List is a raw type, should be parameterised.

I have tested it locally with up to eclipslink 2.7.6. Whenever I try to use 2.7.7 in my pom eclipse will not retrieve it.

I encounter the same issues with 2.7.6.

I still do not understand why I get this error. It should not come up.
Re: ElementCollection List<String> Exception during deployment [message #1828384 is a reply to message #1828356] Mon, 08 June 2020 20:49 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
Registered: July 2009
Senior Member
Is this an exception or just a log message? MetadataAsmFactory.getVirtualMetadataClass in my code view seems to catch and log exceptions from Class.forName under 'finest' logging
log.logThrowable(SessionLog.FINE, SessionLog.METADATA, failed);
but looks like it should just continue on without issue. Method suggests it is trying to determine if this is an entity class and just recording the class loader errors it gets - if this was some entity or mapped class, you might need this for debugging purposes, but shouldn't be relevant to your situation
Re: ElementCollection List<String> Exception during deployment [message #1828431 is a reply to message #1828384] Tue, 09 June 2020 14:42 Go to previous messageGo to next message
Marc Fisch is currently offline Marc FischFriend
Messages: 3
Registered: May 2020
Junior Member
Hi Chris,

it seems to be a log message, as the as the "exception" only appears when I set the logging to FINEor FINEST.
When I set logging to INFO or SEVERE the trace does not appear.

So you are saying this is a non-issue? Or should a log a bug as the behaviour is misleading?

Thanks again for your help! :)
Re: ElementCollection List<String> Exception during deployment [message #1828440 is a reply to message #1828431] Tue, 09 June 2020 15:49 Go to previous message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
Registered: July 2009
Senior Member
I'm going to try to saying nothing as I made the initial assumption your stack was an exception preventing your application from running. But if you don't have an issue, there isn't one I can see.

Feel free to log a bug about the FINE message it is logging; I don't know how urgent it is or if anyone will ever get to it, but might help as another searchable reference should someone else see the same message and wonder about it.

[Updated on: Tue, 09 June 2020 15:50]

Report message to a moderator

Previous Topic:NamedEntityGraph hint does not use table joins
Next Topic:How to validate JSON with Moxy on marshaling/unmarshaling?
Goto Forum:
  


Current Time: Wed Dec 04 00:18:23 GMT 2024

Powered by FUDForum. Page generated in 0.03104 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top