On a project, we are using Spring + Hibernate + JPA.
Updating to the last version of the COTS, having Hibernate 4.3.x :
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.OutOfMemoryError
Back with version 4.2.14, no problem.
I didn't find any reference to this error in the release notes or on google.
Anyone also had it ?
OutofMemoryerror is the error which we get if your application is making more objects than the Heap size allotted to it. You can increase the Heap size assigned to your project by passing appropriate arguments(xms and xmx) to the application. It could also mean that there is a probable memory leak lurking in your project. try setting appropriate heapsize and then if the issue still exist then you need to look at you implementation and find places where there could be memory leaks.
Please have a look at the following post to understand better : JVM params
Related
We have a project using Spring Boot and flyway.
When we run a migration that fails, with logs levels all set to DEBUG, we only got these messages:
[DEBUG] org.flywaydb.core.internal.command.DbValidate - Validating migrations ...
[DEBUG] org.flywaydb.core.internal.scanner.Scanner - Filtering out resource: db/migration/V1/V1_202103081030__account.sql (filename: V1_202103081030__account.sql)
[DEBUG] org.flywaydb.core.internal.scanner.Scanner - Filtering out resource: db/migration/V1/V1_202103081040__place.sql (filename: V1_202103081040__place.sql)
[DEBUG] org.flywaydb.core.internal.scanner.Scanner - Filtering out resource: db/migration/V1/V1_202103151608__document.sql (filename: V1_202103151608__document.sql)
[DEBUG] org.flywaydb.core.Flyway - Memory usage: 147 of 254M
[ERROR] org.springframework.boot.web.embedded.tomcat.TomcatStarter - Error starting Tomcat context. Exception: org.springframework.beans.factory.UnsatisfiedDependencyException. Message: Error creating bean with name 'webSecurityConfig': Unsatisfied dependency expressed through method 'setContentNegotationStrategy' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$EnableWebMvcConfiguration': Unsatisfied dependency expressed through method 'setConfigurers' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'openEntityManagerInViewInterceptorConfigurer' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/JpaBaseConfiguration$JpaWebConfiguration.class]: Unsatisfied dependency expressed through method 'openEntityManagerInViewInterceptorConfigurer' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'openEntityManagerInViewInterceptor' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/JpaBaseConfiguration$JpaWebConfiguration.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Invocation of init method failed; nested exception is org.flywaydb.core.api.exception.FlywayValidateException: Validate failed: Migrations have failed validation
...
[INFO ] org.apache.catalina.core.StandardService - Stopping service [Tomcat]
...
Caused by: org.flywaydb.core.api.exception.FlywayValidateException: Validate failed: Migrations have failed validation
There is no more details about the reason of the failure (a failing query, an unmatched checksum, ...).
I look at the spring.flyway application properties but found nothing that could be of any help here.
What should we do to display the flyway root error in our logs at server startup?
EDIT: To be clear, the problem is not the failure itself (setting a breakpoint in Flyway classes can reveal the source error). The problem is the missing error details in the logs.
I was having the same problem and found that it was related to the Flyway version I was on (Spring Boot 2.4.3, which uses Flyway 7.1.1). It's a known issue 2987 - Display all validate messages in exceptions, fixed in Flyway 7.2.0.
They recommend running flyway validate -outputType=json as a workaround to get a detailed error message. I tried that, but still didn't get a detailed error message.
The solution that worked for me was upgrading to Flyway 7.2.0, by specifying the version in my pom file:
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
<version>7.2.0</version>
</dependency>
I don't know specifically what is failing, but this might help point you in the right direction.
Open up DbValidate (flyway class). (Download sources if you need to)
Put a break point in the else statement on lines 186-187
Start server again
That will at least tell you which file is failing.
You then might be able to make an enhancement request to the Flyway project for better error reporting.
Well, a lot of things can happen, but one possible reason is that you've changed the migration file after you've applied it already. I'll explain by use case:
Let's say that at time X you have 2 migrations (technically implemented in SQL files): A1 and A2.
This is your first commit with A1 and A2 and when you run the application, flyway creates a special table in the database to see which migrations were already applied. Obviously, there are no migrations there yet at time X so it creates a table, applies A1 and A2, and adds 2 records in the table. These records among other things should include a checksum. Simply put you can think about these checksum as a hash (like sha1) of the content of A1 and A2 correspondingly.
So far so good, now fast forward in time (to time Y) when you introduce a new migration file A3.
When you re-deploy the application, flyway checks that A1 and A2 that have already been applied have not changed, and only after that it applies the new migration.
Now, this validation is really a prerequisite to applying migration A3 checks these hashes - checksums. This is reasonable - because if you happen to have changed A1 or A2 - what should the flyway do - how it can guarantee that migrations work as expected?
You can read also in the official flyway documentation about this validation, however, you get the idea I believe. Someone has changed the checksum by changing one of your existing migrations and have tried to redeploy the applications.
Simply put, Once the migration file has been applied - it can't be changed in a source tree
Now the scenario that I've described is one possible scenario, in general, you don't really have to even create migration A3, it is enough to change the existing migration and try to re-run the application - the validation will fail.
I am attempting to implement a quick feature flag solution for my teams that run both .net core and java spring boot. I was able to easily get a solution running with .net core using feature-management and was excited to see the spring equivalent because I was hoping for essentially the same tooling for all teams.However, I am having a problem because I just want to start by providing the flag values in the application/bootstrap.yaml and it keeps yelling at me with the following error.
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'spring.cloud.azure.appconfiguration-com.microsoft.azure.spring.cloud.config.AppConfigurationProperties': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: At least one config store has to be configured.
Caused by: java.lang.IllegalArgumentException: At least one config store has to be configured.
So, my question is, how do I specify a provider for a local file rather than spring cloud config? I do not have that implemented and it will take too long for me to do so in my environment.
I found my problem! I had an extra dependency that was not needed for what I was doing. Once I removed the following it worked fine.
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>spring-cloud-azure-appconfiguration-config</artifactId>
<version>1.2.2</version>
</dependency>
I'm trying to install axis2.jar (1.7) in Websphere 8.5 which is using java 8. I have selected parent last in axis2.jar. Axis2 has some wsdls installed and it'll communicate with oracle 12c to retrieve data. In axis2 shared libraries i'm including xdb6, ojdbc7.jar. When i start to post an xml through SOAP UI, im getting the below error in WAS.
"[7/30/18 11:19:04:368 EEST] 000000b7 IntegrationLa E
'IntegrationLandscapeService' is currently not availble OR does not
exist - RuntimeException : Error creating bean with name
'IntegrationLandscapeServiceImpl' defined in class path resource
[integrationLandscapeServiceContext.xml]: Instantiation of bean
failed; nested exception is
org.springframework.beans.BeanInstantiationException: Could not
instantiate bean class
[com.temenos.services.integrationlandscape.IntegrationLandscapeServiceImpl]:
Constructor threw exception; nested exception is
java.lang.LinkageError: loading constraint violation when overriding
method
"java/sql/SQLXML.getSource(Ljava/lang/Class;)Ljavax/xml/transform/Source;"
during creation of class "oracle/xdb/XMLType": loader
"com/ibm/ws/classloader/CompoundClassLoader#924d5a69" of class
"oracle/xdb/XMLType" and loader
"com/ibm/oti/vm/BootstrapClassLoader#e7afefce" of class
"java/sql/SQLXML" have different types for the method signature"
Oracle.xdb.XMLType is loaded from xdb6.jar and other applications using this xdb6.jar is working fine without issues. But when used from axis2.jar its creating the above error.
Can someone help me or shed some light on this since i couldnt figure out the issue here.
Try to use an isolated class loader. When you configure you shared lib check the "Use an isolated class loader for this shared library".
I am having circular dependency in my application. I did not get any circular dependency issue while server startup on my local setup or other 3 setups I was working on.
But, I was getting circular dependency error on server startup on production environment.
Below was the error :
Error creating bean with name 'someBean': Bean with name 'someBean' has been injected into other beans [someOtherBean] in its raw version as part of a circular reference, but has eventually been wrapped. This means that said other beans do not use the final version of the bean. This is often the result of over-eager type matching - consider using 'getBeanNamesOfType' with the 'allowEagerInit' flag turned off, for example.
when I added default-lazy-init = "true" in my application_context.xml file, error got resolved.
My question is, how come I wasn't getting any such error on my local or other setup even though I wasn't having default-lazy-init = "true" in my application_context.xml file. I came to know that the problem can be solved in several ways. But I would like to know the root cause of how spring differs in bean creation from one system to another. Or is it specific to OS or Tomcat server.
I am trying to start a deployment of a project to Websphere and I get the following error trail. (Shortened)
ERROR org.springframework.web.context.ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'birtView' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean 'birtEngine' while setting bean property 'birtEngine'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'birtEngine': FactoryBean threw exception on object creation; nested exception is java.lang.RuntimeException: Could not start the Birt engine!
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'birtEngine': FactoryBean threw exception on object creation; nested exception is java.lang.RuntimeException: Could not start the Birt engine!
Caused by: java.lang.RuntimeException: Could not start the Birt engine!
Caused by: org.eclipse.birt.core.exception.BirtException: error.CannotStartupOSGIPlatform
Caused by: org.eclipse.birt.core.framework.FrameworkException: Cant register the ExtensionRegistry classpath
Caused by: org.eclipse.core.runtime.CoreException: Extension registry provider is already set.
The solution to the 3rd from bottom error as I have found online was to delete the following line of code.
config.setEngineHome("C:/birt-runtime-3_7_0/ReportEngine");
However, this is not present and unnecessary for our setup.
It(the BIRT specific code used) is very similar to this example online:
http://www.springsource.org/BusinessIntelligenceWithSpringAndBIRT
The BirtView and BirtEngineFactory are the only relevant parts to my project.
I have gone to this Bug Page and forum entry and tried the code addition. It did not work. The project starts up and works on Tomcat 6x without any issue.
http://www.eclipse.org/forums/index.php/m/727929/
https://bugs.eclipse.org/bugs/show_bug.cgi?id=351052
I have the class loader order in Web Sphere set to "Classes loaded with application class loader first." as in the example in the link below.
http://wiki.eclipse.org/BirtPOJO_Viewer_WebSphere_Deployment
I still get the same set of errors and I'm not sure what else I should be doing.
I know it is a bit hard to ask this without posting code, but would someone have an idea as to what I should look for?
Thanks.
I had exactly the same error as yours. I am using BIRT 3.7.2 and IBM WAS 8.5
With reference to the bug detailed below,
org.eclipse.core.runtime.CoreException when restarting the ReportEngine
and the actual reason of the bug, specified below,
ServiceLauncher.shutdown() doesn't release default RegistryProvider
I added the following line before the Platform.startup(..) call
RegistryProviderFactory.releaseDefault();
After this, BIRT reports are working fine.
But, I'm doubtful, as to whether this will break anything in WAS's runtime or not.
The reason for this is ...
As explained in the bug, this exception occurs when Platform start-up is attempted for a second time. Here, on Platform.shutdown(), the RegistryProvider is not released, and hence the exception.
Now, in my case, IBM Websphere 8.5 internally uses OSGi and hence starts OSGi Platform.
Hence, when our application attempts to start the Platform again (the second start), the exception occurs.
My concern here is, this should not break anything with WAS’s runtime (as it uses OSGi internally).
The Registry Provider is not null, as its set by BIRT runtime, so, the only problem here can be of Class Version mismatch i.e., WAS’s Registry Provider and BIRTs Registry Provider, if different, then version clashes.
I'm not sure of the solution i have used.
Experts, please guide.