How to connect tomee 9 to hibernate 6.1*

In Tomee 8 I used hibernate 5 and connects just fine with:

<jta-data-source>openejb:Resource/MYPA</jta-data-source>
<non-jta-data-source>openejb:Resource/MYPA</non-jta-data-source>

in newer hibernate releases openejb: is restricted only java: and osgi: are allowed, however I tried every combination I can think of with java:,java:/,osgi:,osgi:/, just MYJPA and not scheme and all of them report jndi name not found. Has anyone been able to get hibernate working with tomee 9 or know the correct text to use for <*-data-source> tags ?

I don’t know anything about Tomee, but did you read the documentation? Here is something about Hibernate in Tomee 9, and here something about configuration of the datasource or XA datasources.

According to this article, it seems that openejb:Resource/ is the proper prefix.

that is the proper prefix, I believe this change ,
HHH-15033 Restrict JNDI lookups to "java" scheme · hibernate/hibernate-orm@e38f63a · GitHub , which breaks tomee. Options where to either use eclipseLink, edit code for my own version of hibernate or use old version of hibernate. Obviously eclipseLink is only viable option of those 3

either tomee will have to change to use java: or hibernate code have to change, or is there a beef between the two projects?

There is no beef :grin:
I guess that we didn’t think anyone would use a different prefix so we tried to get rid of some attack surface. If you create an issue in the issue tracker(https://hibernate.atlassian.net) and describe this situation I’ll make sure we work on this.

So one thing you could do until a Hibernate integration for Tomee is created, is to create a custom JndiService that allows parsing this path. To register that, you need a org.hibernate.service.spi.ServiceContributor which is a Java Service loader contract.

public class MyServiceContributor implements org.hibernate.service.spi.ServiceContributor {
	@Override
	public void contribute(StandardServiceRegistryBuilder serviceRegistryBuilder) {
		serviceRegistryBuilder.addInitiator( MyJndiServiceInitiator.INSTANCE );
	}
}
public final class MyJndiServiceInitiator implements StandardServiceInitiator<JndiService> {
	public static final JndiServiceInitiator INSTANCE = new JndiServiceInitiator();

	@Override
	public Class<JndiService> getServiceInitiated() {
		return JndiService.class;
	}

	@Override
	public JndiService initiateService(Map<String, Object> configurationValues, ServiceRegistryImplementor registry) {
		return new MyJndiServiceImpl( configurationValues );
	}
}

where MyJndiServiceImpl is more or less a copy of the existing JndiServiceImpl, but with code adapted to allow parsing the openejb namespace.
Note that this change was done to reduce the security attack surface, and as far as I understand, there is no desire to make it easier than what I described here to get back to the old behavior.