spring data - hibernate exception - spring

Spring data jpa (1.11.0) throws an exception
java.lang.NoSuchMethodError: org.hibernate.engine.spi.SessionFactoryImplementor.getProperties()Ljava/util/Properties;
at org.hibernate.jpa.internal.EntityManagerFactoryImpl.(EntityManagerFactoryImpl.java:124) ~[hibernate-entitymanager-5.0.11.Final.jar:5.0.11.Final]
with hibernate-core:5.2.6
It was reported that SPR-14365 was around this issue and has been closed, but the issue is still showing up.
Is there a workaround for this problem.

Related

Upgrading from WebLogic 12.1.3 to 12.2.1.4 breaks our application using Spring Framework 3.0.2

Our company is having us upgrade from Oracle WebLogic 12.1.3 to 12.2.1.4 since 12.1.3 is out of support/going out of support.
We have a major application that is using Spring Framework v3.0.2. When we deploy the EAR to 12.2.1.4 and attempt to consume any of the web services, we get this error stack trace. I've removed names that specify our company with generic names but you should be able to get the gist of what is happening:
2021-06-02 15:21:50.019/27.406 Oracle Coherence GE 12.2.1.4.0 (thread=[STANDBY] ExecuteThread: '10' for queue: 'weblogic.kernel.Default (self-tuning)', member=n/a): Configured versioned, multi-cluster Management over ReST
02.06.2021 15:22:11 - error trying to getBean("DefaultJBL"): Error creating bean with name 'DefaultJBL' defined in URL [zip:C:/javadev/server/appserver.12.2.1.4/user_projects/domains/base_domain/servers/AdminServer/tmp/_WL_user/lasor/2wlg44/lib/Lasor_core-1.0.jar!/com/foo/app/corebuslogic/common/jbl/DefaultJBL.class]: Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigException: Unexpected AOP exception; nested exception is java.lang.RuntimeException: java.lang.ClassNotFoundException: com.foo.app.corebuslogic.common.exceptions.LoggedException
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'DefaultJBL' defined in URL [zip:C:/javadev/server/appserver.12.2.1.4/user_projects/domains/base_domain/servers/AdminServer/tmp/_WL_user/app/2wlg44/lib/App_core-1.0.jar!/com/foo/app/corebuslogic/common/jbl/DefaultJBL.class]: Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigException: Unexpected AOP exception; nested exception is java.lang.RuntimeException: java.lang.ClassNotFoundException: com.aep.lasor.corebuslogic.common.exceptions.LoggedException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1045)
at com.foo.util.FOOApplicationContext.fetchBean(FOOApplicationContext.java:203)
at com.foo.app.buslogic.common.generic.GenericSessionBean.getBL(GenericSessionBean.java:293)
at com.foo.app.buslogic.common.generic.GenericSessionBean.query(GenericSessionBean.java:97)
I also believe the API is SOAP in 12.1.3 but I see REST specified in the 12.2.1.4 logs. Could this be the issue or am I reading that incorrectly?
Also, the classes is says it cannot find I've verified are there in the deployment area of WebLogic so I'm not sure why it can't find them.
Here is where the code throws an exception no matter what bean name I pass in but they've all been defined. The class is our FOOApplicationContext that implements org.springframework.context.ApplicationContextAware and has a fetchBean function that does the following:
public static Object fetchBean(final String beanName) throws FOOException {
Object object = null;
if (beanName == null) {
throw new FOOException("beanName is null");
}
try {
object = currentSpringContext().getBean(beanName);
} catch (Exception e) {
final String message = "error trying to getBean('"" + beanName + "\"): " + e.getMessage();
throw new FOOException(message, e);
}
return object;
}
When getBean() is called under WebLogic 12.1.3, it works. But it throws the AOP Exception error listed above when this exact same function is called under WebLogic 12.4.1.2. No code changes, etc. Not sure why this is.
We haven't created an actual server yet to deploy to, but instead I've installed it locally on my development machine. I've set up the database connections, etc the same way as do when locally installing 12.1.3. Is there something that has changed in regards to Spring Framework? The code was written over 8+ years ago and I inteherited the support for it and now I have to get us moved to WebLogic 12.2.1.4 before the end of this year and this is a major part of a very important application. The WebLogic application houses all the business logic and database access in it so without it, the front-end app is dead in the water.
Also, none of our registered beans will instantiate at all under WebLogic 12.2.1.4 but it works under 12.1.3. I've even recompiled the EAR file and again, it works under 12.1.3 but not 12.2.1.4.
I've found what appears to be a possibly circular reference between 2 objects that are not registered as beans, but the beans do depend on. So those 2 objects are not registered as beans. Not sure why it was done that way, but in any case, this doesn't seem to create a problem in 12.1.3. But one of the objects (FOOException) shows up in the error thrown when trying to create the DefaultJBL bean within the FOOApplicationContext object.
I'm not sure what else I can provide. Searching around the internet has not found a solution to my issue. I've found some that appeared as if they would fix it, but they turn out to not apply. I cannot seem to find anyone else with this issue, but Google and Duck Duck Go all find various "solutions" that don't apply to my situation.
Thanks!
ClassNotFound Exception, You may need to update the Dependencies pertaining to Spring Framework

Spring Data Mongo : Rollback if exception occurs

I'm working on a project using Spring Data and MongoDB.
I'm wondering if there is some kind of solution to rollback when some exception (standard or custom) occurs.
I tried this solution but unfortunately it didn't work :
#Transactional(rollbackFor = SomeException.class)
For the moment I'm doing the rollback manually by saving what's already deleted and vis-versa.
NOTE: The exception may occur when contacting a foreign micro-service using http.
NOTE2 : I'm using an Exception handler, I removed it and still not working.

eclipselink and weblogic12g CLOB ClassCastException

I have an application deployed in a Weblogic 12g, and a datasource configured against an oracle RAC.
It uses as JPA provider; EclipseLink 2.4.1.
The problem is this exception;
Caused by: Exception [EclipseLink-3001] (Eclipse Persistence Services - 2.4.1.v20121003-ad44345): org.eclipse.persistence.exceptions.ConversionException
Exception Description: The object [weblogic.jdbc.wrapper.Clob_oracle_sql_CLOB#87a98a], of class [class weblogic.jdbc.wrapper.Clob_oracle_sql_CLOB], could not be converted to [class java.lang.String].
Internal Exception: java.lang.ClassCastException: oracle.sql.CLOB
....
Caused by: java.lang.ClassCastException: oracle.sql.CLOB
at weblogic.jdbc.wrapper.Clob_oracle_sql_CLOB.length(Unknown Source)
at org.eclipse.persistence.internal.helper.ConversionManager.convertObjectToString(ConversionManager.java:679)
at org.eclipse.persistence.internal.helper.ConversionManager.convertObject(ConversionManager.java:100)
....
Well, I understand what is the problem but I can't understand why only occurs when some Oracle instance in the Oracle RAC was reset. When this occurs, the only thing to do is restart the WLS instance. ah! While I have this error, the rest of the datatypes work well!.
Maybe there are some kind of direct relaction between LOB types and instances of Oracle servers inside a RAC? It's possible some kind of scenario that restarting an Oracle instance inside a RAC the CLOB datatypes don't works?
Thanks in advance!
Best regards

IllegalStateException in ExposeInvocationInterceptor after upgrading to Spring 4.1.x

After upgrading to Spring 4.1.4 and Spring Data Jpa 1.7.1 (from 4.0.2 and 1.5.1, respectively) I started to get IllegalStateException from ExposeInvocationInterceptor#currentInvocation()
At first I thought it could be somehow related to the following fix https://jira.spring.io/browse/SPR-12351 but I got the same exceptions also with Spring 4.1.1.
Any ideas what could be the problem?
Below is an excerpt from the exception stack trace:
java.lang.IllegalStateException: No MethodInvocation found: Check that an AOP invocation is in progress, and that the ExposeInvocationInterceptor is upfront in the interceptor chain. Specifically, note that advices with order HIGHEST_PRECEDENCE will execute before ExposeInvocationInterceptor!
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.currentInvocation(ExposeInvocationInterceptor.java:73)
at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$ThreadBoundTargetSource.createObject(CrudMethodMetadataPostProcessor.java:226)
at org.springframework.aop.target.AbstractLazyCreationTargetSource.getTarget(AbstractLazyCreationTargetSource.java:86)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:187)
at com.sun.proxy.$Proxy112.getLockModeType(Unknown Source)
at org.springframework.data.jpa.repository.support.SimpleJpaRepository.findOne(SimpleJpaRepository.java:224)
...

IBM Websphere: Getting error for Spring AOP

I am getting following error while booting up the server. Application has Spring as well as AspectJ classes in it.
Caused by: java.lang.VerifyError: JVMVRFY013 class loading constraint violated; class=org/springframework/aop/aspectj/MethodInvocationProceedingJoinPoint, method=getSourceLocation()Lorg/aspectj/lang/reflect/SourceLocation;, pc=0
at java.lang.J9VMInternals.verifyImpl(Native Method)
at java.lang.J9VMInternals.verify(J9VMInternals.java:93)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:170)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.currentJoinPoint(AbstractAspectJAdvice.java:83)
As a first pass I gave PARENT_FIRST option for Enterprise Application
Well, I'll write it here again as my first reply was deleted without any explanation though it was the correct one.
Given the exception you encounter you're likely at WAS 8.5.5.0. There's a known issue documented under APAR PM90932 about this. An ifix has been publisehd for this issue and you can read about it and download it from here. Once the ifix is installed, the issue won't appear again.

Resources