SRVE0283E: Exception caught while initializing context: org.springframework.beans.factory.BeanCreationException - macos

the project working fine on windows 7 , shows those Error when deploy the project on mac .
liberty server ,eclipse mars ,
strong text[ERROR ] SRVE0283E: Exception caught while initializing context: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jpaMapppingContext': Invocation of init method failed; nested exception is javax.persistence.PersistenceException: java.lang.LinkageError: loader constraint violation in interface itable initialization: when resolving method "com.ibm.db2.jcc.am.Connection.prepareSQLJCall(Ljava/lang/String;ILcom/ibm/db2/jcc/SQLJSection;Lcom/ibm/db2/jcc/SQLJColumnMetaData;Lcom/ibm/db2/jcc/SQLJColumnMetaData;ZZIIIILjava/lang/String;[Ljava/lang/Object;)Lcom/ibm/db2/jcc/SQLJCallableStatement;" the class loader (instance of com/ibm/ws/classloading/internal/AppClassLoader) of the current class, com/ibm/db2/jcc/am/Connection, and the class loader (instance of sun/misc/Launcher$ExtClassLoader) for interface com/ibm/db2/jcc/SQLJConnection have different Class objects for the type c/SQLJSection;Lcom/ibm/db2/jcc/SQLJColumnMetaData;Lcom/ibm/db2/jcc/SQLJColumnMetaData;ZZIIIILjava/lang/String;[Ljava/lang/Object;)Lcom/ibm/db2/jcc/SQLJCallableStatement; used in the signature
at

Based on the existence of Launcher$ExtClassLoader in the error message, it looks like you've put a copy of the JDBC driver into your Java Extension Class Loader path (usually JAVA_HOME/jre/lib/ext). Because of that, the environment has visibility to classes from both that location and the application class loader, and that causes a duplicate visibility that leads to the LinkageError.
There are extremely rare cases that require the use of the Java Extension loader, but I don't believe JDBC drivers are typically among them, so simply removing it from jre/lib/ext is probably the most straightforward solution.

Related

How to create a Batch project that doesn't need a data source?

I am creating a batch project that does not have a need to hit a database and when I run a context load, I get an exception
"Factory method 'dataSource' threw exception; nested exception is
org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException:
Failed to determine a suitable driver class".
I believe that there are a few dependencies like spring-data-jpa, that may require a data source to be supplied within my project and when I add a random data source, my context loads just fine.

Spring Boot application cannot join Coherence cluster on server: Join request was aborted

I have developed a small REST API application with Spring Boot after another sample application with classic Spring XML configuration. It imports context from a library with a Coherence cache set up.
When I developed it locally, running the Spring Boot app with Intellij Idea runner, there were no issues, the application worked fine and the endpoint worked connecting to that cache.
When I deployed the application to the Unix server, I am getting the following error during the application startup:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'coreSearchSync' defined in class path resource [core-search-core-context.xml]: Cannot resolve reference to bean 'corePersistenceManager' while setting bean property 'corePersistenceManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'corePersistenceManager': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ' coreSearchResultCache' defined in class path resource [core-search-coherence-context.xml]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.tangosol.net.NamedCache]: Factory method 'getCache' threw exception; nested exception is (Wrapped: Failed to start Service "Management" (ServiceState=SERVICE_STOPPED)) java.lang.RuntimeException: Join request was aborted
The application on the server is using the application.properties but they are the same as in the application.yaml locally.
I am not sure where to continue the investigation...
The problem was solved by passing JVM arguments to the script to start the application:
-Dtangosol.coherence.clusterport=<port> -Dtangosol.coherence.site=<site> -Dtangosol.coherence.clusteraddress=<cluster_ip_ddress> -Dtangosol.coherence.cluster=<cluster_name>
It appears that these properties are not applied from the application properties because starting the coherence cluster works on the system level and/or starts before the properties are initialized. Or those properties are not visible to the coherence.

Spring Error : java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer

First 2 Parts Solved --- I still Got Another Error Below >>>>
I am having trouble w. this Struts - Spring - Hibernate Application.
I got the error while accessing the Action class on Struts. It failed during instantion of the ActionClass due to Spring failed to create a Hibernate object bean.
Then I used log4j to get the info. It complained about :
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in class path resource [factory/bean.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [factory/bean.xml]: Invocation of init method failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.hibernate.cfg.Configuration]: Constructor threw exception; nested exception is java.lang.NoSuchFieldError: INSTANCE
Here is the full log4j log on the console :pastebin/z6FFAUEE
Here is my bean.xml : pastebin.com/nREBZ99N
I am honestly not very sure what the error is about, because this is my first time using Spring Hibernate and also the AOP aspects.
I think I have all the libs needed, but I am not very sure too. I think it could be on the xml setting or some missing parameters.
Any helps / pointers is appreciated.
Thx
^^^^SOLVED -- Now I got another error
Caused by: java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.<init>(Z)V
this is probably another library issue : Google Caused by: java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.(Z)V
but i m not again vr sure since, I am new using this framework, I am not vr familiar / knowledgable.
Any help poiting out the error/cause would sincerely be appreciated.
There is a ton of libs jars and I am only familiar with few of them, mostly just guessing the others. The libs is inherited from other application. Any links on good reference on libs also appreciated.
Here they are : http://pastebin.com/tgz8UFfs
^^^^SOLVED - Solution : I removed the text files from lib.
I had this error now, complaining that: java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer
It complains about error on creating serviceProxyTemplate .. etc cannot initiate ^ class
here is the full stack trace : http://pastebin.com/c7rqk5cR
What library is the error / what lib do I need ?
Thx for the help

OAUTH2 transaction manager grails mongodb

I am working on an app that uses a mongodb, is built in grails, and is using oauth2 as an authentication service. I have the services and controller built out (I think) and am trying to run my server to manually test connectivity with google. I am running into an "Error creating bean with name transactionManagerPostProcessor..." that I can't solve. I know I need to either install a plug-in that takes care of the "transactions" for me, or create a bean in resources.groovy.
I have done a lot of researching and reading up on this, but I have been at a dead end for the last couple days trying to get this implemented. Can someone tell me how to solve this problem, create the correct bean, or install the correct plug-in? Partial stack trace below, with link to full stack trace:
|Loading Grails 2.3.4
|Configuring classpath
.
|Environment set to development
.................................
|Packaging Grails application
............................................
|Running Grails application
Configuring Spring Security Core ...
... finished configuring Spring Security Core
Error |
2014-01-16 09:30:52,840 [localhost-startStop-1] ERROR context.GrailsContextLoader - Error initializing the application: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongoTransactionManager': Cannot resolve reference to bean 'mongoDatastore' while setting bean property 'datastore'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongoDatastore': Cannot resolve reference to bean 'mongoMappingContext' while setting bean property 'mappingContext'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongoMappingContext': FactoryBean threw exception on object creation; nested exception is java.lang.NoClassDefFoundError: org/springframework/format/datetime/DateFormatterRegistrar
Full stacktrace can be found at: http://pastebin.com/5mW5uwtu
I have tried adding
static transaction = 'mongo'
to the service that calls google to authenticate the user. This is a solution I found on a similiar question on stackoverflow. I have also fiddled with different plugins and dependencies in my build-config. Not sure what else there is to try.
Thank you!
To work around this issue with some plugins, I've added the following to the beans block in resources.groovy
// some plugins need a transaction manager,
// although the mongo one isn't properly transactional
// and could produce unexpected results in some cases.
springConfig.addAlias('transactionManager', 'mongoTransactionManager')
However, the specific error you're seeing relates to the Spring class DateFormatterRegistrar not being found. Are you using an up-to-date version of Grails (e.g. 2.3+) and the mongo plugin? Have you added the mongo plugin as a compile plugin dependency in BuildConfig?:
compile ":mongodb:1.3.3"

Send Email using spring?

Thanks in advance. I have to send mail using spring. When i tried the code it shows following Bean Exception in my console.
Exception in thread "main" org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'mailSender' defined in class path resource [mail-simple.xml]:
Instantiation of bean failed;
nested exception is java.lang.ClassFormatError: Absent Code attribute in method that
is not native or abstract in class file javax/mail/MessagingException.
Caused by: java.lang.ClassFormatError: Absent Code attribute in method that
is not native or abstract in class file javax/mail/MessagingException
Can anyone please help me to find this problem?
I've never seen anything like this, but the exception seems to be saying that it is trying to load a malformed class file for javax.mail.MessagingException. I suggest that you download a fresh copy of the JAR file that contains that class, etcetera.

Resources