Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide PersistenceAnnotationBeanPostProcessor without JNDI dependency. [SPR-6679] #11345

Closed
spring-projects-issues opened this issue Jan 13, 2010 · 6 comments
Assignees
Labels
type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Jan 13, 2010

Marcel Overdijk opened SPR-6679 and commented

org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor currently entends JndiLocatorSupport and catches a couple of NamingException's.

This causes problem when using the PersistenceAnnotationBeanPostProcessor on Google App Engine.
So I think it would be good to refactor out common stuff and provide a PersistenceAnnotationBeanPostProcessor (default; also supports JNDI) and a ContextOnlyPersistenceAnnotationBeanPostProcessor. The ContextOnlyPersistenceAnnotationBeanPostProcessor could also be useful in other non-JEE environments where JNDI would not be supported.

I've attached my own ContextOnlyPersistenceAnnotationBeanPostProcessor which is a copy of the PersistenceAnnotationBeanPostProcessor but without JNDI support and dependencies.

Also see these articles realted to this problem on Google App Engine:
http://blog.smart-java.nl/blog/index.php/2009/06/05/getting-on-the-cloud/
http://objectuser.wordpress.com/2009/05/19/spring-jpa-in-google-app-engine/


Affects: 3.0 GA

Attachments:

Issue Links:

Referenced from: commits cef44f6

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

We are aware of this problem but find it very Google App Engine specific: On all other environments, SE as well as EE, the JNDI API is reliably available - since it became part of J2SE back in 1.4.

Note that Spring's PersistenceAnnotationBeanPostProcessor has optional JNDI capabilities only and doesn't insist on a JNDI runtime to work: It just insists on the JNDI API being present, which is a perfectly viable thing to do in a J2SE world. It's rather Google App Engine that breaks the contract by removing standard J2SE API packages without a good reason... (It could easily provide the JNDI API even if it does not provide a working JNDI runtime, just like any standard J2SE environment.)

We may nevertheless provide a context:annotation-config variant (and hence PersistenceAnnotationBeanPostProcessor variant) that is capable of adapting to Google App Engine. It's just a pain to have to do it for no other reason than GAE breaking the J2SE API packages contract...

Juergen

@spring-projects-issues
Copy link
Collaborator Author

Marcel Overdijk commented

Thanks for the comments Juergen.

@spring-projects-issues
Copy link
Collaborator Author

Marcel Overdijk commented

Could you consider setting a fix version for this issue. Thanks.

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

I'm working on a revision of PersistenceAnnotationBeanPostProcessor itself, refactoring JNDI API usage into an internal delegate class that will only be touched when actual JNDI lookups are needed. This should work fine on Google App Engine with standard context:annotation-config setup then.

Juergen

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

Revised for Spring 3.0.1 - will be available in tonight's 3.0.1 snapshot already. Feel free to give it an early try!

Juergen

@spring-projects-issues
Copy link
Collaborator Author

Marcel Overdijk commented

Great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants