Java classpath seems to change after JBoss starts when application creates its own thread

Solution Unverified - Updated -

Issue

  • Our classpath seems to get corrupted/changed somehow after a while because we are observing a failure to find META-INF/persistence.xml when we attempt to build a RESOURCE_LOCAL EntityManagerFactory via:
    entityManagerFactory = Persistence.createEntityManagerFactory(persistenceUnit); 

We do this well after app server start up and it doesn't always happen. Why would the classpath be different after app server start up? What's going on here?

javax.persistence.PersistenceException: No Persistence provider for EntityManager named example
        at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:69)
        at com.example.server.transaction.ResourceLocalTransactionWrapper.buildEntityManagerFactory(ResourceLocalTransactionWrapper.java:123)
        ...
        at com.example.server.hacluster.HATopologyListenerBase.handleTopologyChange(HATopologyListenerBase.java:242)
        at com.example.server.hacluster.HATopologyListener.topologyChanged(HATopologyListener.java:121)
        at com.example.server.hacluster.HATopologyMonitor$1.run(HATopologyMonitor.java:130)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
        at java.util.concurrent.FutureTask.run(FutureTask.java:166)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:722)

Environment

Red Hat JBoss Enterprise Application Platform (EAP) 6.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content