user1721446
user1721446

Reputation: 31

jpa 2.1 spring boot with web sphere 8.5.5.8(full version) jdk 7

i followed the approach suggested by jeff https://gist.github.com/jeffsheets/aec3e94870ef903ce7efe33e00563d3c

I was able to overcome the jpa 2.1 java.lang.ClassCastException: com.ibm.websphere.persistence.PersistenceProviderImpl incompatible with javax.persistence.spi.PersistenceProvider.

But i get the following error A servlet named com.x...JerseyConfig can not be dynamically added because a servlet configuration with the same name already exists. i am using WebSphere 8.5.5.8 Full version with JDK 1.7 spring boot 1.4.0.M3.

In my JerseyConfig.java

@Component
@PropertySources(value = {
    @PropertySource("classpath:application.properties"),
    @PropertySource("classpath:ValidationMessages.properties")})
@DependsOn("hibernatePersistenceProviderResolver")
public class JerseyConfig extends ResourceConfig {
    public JerseyConfig() {
        packages("com.x.package");
    }
}

Thanks for any hints or pointers.

Upvotes: 1

Views: 584

Answers (1)

user1721446
user1721446

Reputation: 31

I did the following to make it work (in addition to @DependsOn mentioned previously).

1) load local class loader first and parent last.

2) Add the JVM property at the WebSphere Appserver com.ibm.websphere.jaxrs.server.DisableIBMJAXRSEngine to true in order to use only the JAX RS shipped with the application. (which fixes the servlet name already exists). 3) After deploying successfully when i ran my REST endpoint i got the following error at run time.

UOWManager transaction processing failed; nested exception is com.ibm.wsspi.uow.UOWException: java.lang.VerifyError: com/ibm/websphere/uow/UOWSynchronizationRegistry.registerInterposedSynch ronizat ion(Ljavax/transaction/Synchronization)V

To fix this add spring.jta.enabled=false to use the WebShpere JTA. (Ideally prefer to override web sphere JTA and use spring JTA, need to figure out a way).

Upvotes: 1

Related Questions