Spring circular references when running on Mac OS - java

I have been working on a Java application with Spring version 4.0.7 on a Windows machine which has worked fine over the past few years. Recently we have the requirement for developers to use MacBook Pro to develop and we've immediately had issues with circular references within our Spring configuration when running the application (build with Maven is fine). Does anyone know any reason why running Spring applications on Windows machines would be any different to Mac OS machines?
The Java version we are using is 1.7.0.80,
Details of exception:
Caused by: org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'reactor': Requested bean is currently in creation: Is there an unresolvable circular reference?
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.beforeSingletonCreation(DefaultSingletonBeanRegistry.java:334)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource(CommonAnnotationBeanPostProcessor.java:446)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:420)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:545)
at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:155)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:305)
... 127 more

Check this out first: http://forum.spring.io/forum/spring-projects/container/115998-circular-dependency-identification-inconsistent
Apparently, in some scenarios, the underlying OS api for listing files returns a different order.
However, you might try to solve the problem by either changing the order of the packages to scan in the #ComponentScan() annotation or by using the #dependsOn("reactor") annotation on the class that is triggering the exception.

Related

How to debug java.lang.ClassNotFoundException during Tomcat startup?

When Tomcat loads my war, I get this error:
Exception in thread "ClientMessageReceptor0" java.lang.NoClassDefFoundError: java/net/Inet6Address
at org.jacorb.orb.iiop.IIOPAddress.getNetworkInetAddresses(IIOPAddress.java:675)
at org.jacorb.orb.iiop.IIOPAddress.getLocalHost(IIOPAddress.java:591)
at org.jacorb.orb.iiop.IIOPAddress.getLocalHostAddress(IIOPAddress.java:574)
at org.jacorb.orb.listener.SSLListenerUtil.processException(SSLListenerUtil.java:73)
at org.jacorb.orb.iiop.IIOPConnection.handleCommFailure(IIOPConnection.java:77)
at org.jacorb.orb.etf.StreamConnectionBase.read(StreamConnectionBase.java:139)
at org.jacorb.orb.giop.GIOPConnection.getMessage(GIOPConnection.java:389)
at org.jacorb.orb.giop.GIOPConnection.receiveMessagesLoop(GIOPConnection.java:541)
at org.jacorb.orb.giop.GIOPConnection.receiveMessages(GIOPConnection.java:533)
at org.jacorb.orb.giop.MessageReceptor.doWork(MessageReceptor.java:69)
at org.jacorb.util.threadpool.ConsumerTie.run(ConsumerTie.java:60)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: Illegal access: this web application instance has been stopped already. Could not load [java.net.Inet6Address]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1375)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1226)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1188)
Our application uses Tomcat v9.0.41 and JDK 1.8.0_111 . This same combination works for others in my team and also it worked for me sometime back. I'm not sure what changed now. I have looked at other similar posts and they suggest mismatch between Tomcat and JDK version. But above combination of Tomcat and JDK works for others.
I have removed all other JDK and JRE version on my system.
Ensured JAVA_HOME points to JDK 1.8.0_111 and PATH points to correct JRE.
Any pointers on how to debug this further? Can I turn on some logging during Tomcat startup to see what paths are being used by Tomcat? Any suggestions are highly appreciated :).

How to solve java error on Geoserver GSR extension

I have set up a Geoserver instance. Now I need the GSR extension to have an ArcGIS compatible REST API.
I installed the extension as described but on Geoserver startup I get a couple of errors and when I access the webpage a HTTP error 503.
I already tried different versions of Geoserver and JDK, all with the same result.
Here is the Java error:
11:52:17.791 [main] ERROR
org.springframework.web.context.ContextLoader - Context initialization
failed org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'gsrDispatcher' defined in URL
[jar:file:/home/nico/gs/webapps/geoserver/WEB-INF/lib/gs-gsr-2.21-SNAPSHOT.jar!/applicationContext.xml]:
Initialization of bean failed; nested exception is
javax.xml.stream.FactoryConfigurationError: Provider for
javax.xml.stream.XMLOutputFactory cannot be found
Thanks for any hint,
best regards
Nico
I did some more research and tested the following versions each with both openjdk version ("1.8.0_312" & "11.0.14.1"):
geoserver-2.18-SNAPSHOT-gsr-plugin.zip
Geoserver version:
2.18.2-6
Running without problems
geoserver-2.19-SNAPSHOT-gsr-plugin.zip
Geoserver version:
2.19.0-5
Problem: Error creating bean with name 'geoServicesExceptionResolver'
geoserver-2.19-SNAPSHOT-gsr-plugin.zip
Geoserver version:
2.19.6
Problem: Error creating bean with name 'gsrDispatcher'
geoserver-2.20-SNAPSHOT-gsr-plugin.zip
Geoserver version:
2.20.0-4
Problem: Error creating bean with name 'gsrDispatcher'
geoserver-2.21-SNAPSHOT-gsr-plugin.zip
Geoserver version:
2.21
Problem: Error creating bean with name 'gsrDispatcher'
So it seems something happened between geoserver version 2.18.6 and 2.19.0 and something more happened between version 2.19.5 and 2.19.6.
It would be helpful if someone could give me the contact of the community GSR extenstion. I can not find anything about it.
To get my geoserver updated it would be great to have this fixed soon.
Many thanks in advance.
Make sure you're installing the same plugin version for the same GeoServer version you're having.
I think you have did something wrong in applicationContext.xml file.

How to fix "Error creating bean with name"

My website is/was working just fine. But I am being forced to upgrade the OS of the servers it runs on, because the newer version of a piece of software I need to upgrade, won't run on the old OS. So, now I am in dependency hell.
So, on a test server, I've upgraded the OS from Ubuntu 14.04 to 18.04.1 . I was also forced to use a later version of Java from:
echo $JAVA_HOME
/usr/lib/jvm/java-7-oracle
to
echo $JAVA_HOME
/usr/lib/jvm/java-11-openjdk-amd64/
And the version of Tomcat from 7 to 8.
Having fiddled a bit (I started this in January, but have only just been able to get back to it, so I can't remember what exactly, though can search the history for clues if required), I can build my application OK, but it fails at the final hurdle:
BUILD SUCCESSFUL Total time: 19 seconds Using CATALINA_BASE:
/var/lib/tomcat8 Using CATALINA_HOME: /usr/share/tomcat8 Using
CATALINA_TMPDIR: /var/lib/tomcat8/temp Using JRE_HOME:
/usr/lib/jvm/java-11-openjdk-amd64/ Using CLASSPATH:
/usr/share/tomcat8/bin/bootstrap.jar:/usr/share/tomcat8/bin/tomcat-juli.jar
Using CATALINA_PID: /root/catalina.pid Tomcat started.
--2019-05-28 16:10:16-- http://localhost:8080/ Resolving localhost (localhost)... 127.0.0.1 Connecting to localhost
(localhost)|127.0.0.1|:8080... connected. HTTP request sent, awaiting
response... 404 2019-05-28 16:10:16 ERROR 404: (no description).
Further investigation reveals:
less /var/log/tomcat8/catalina.out
2019-05-28 16:10:06.418 UTC [localhost-startStop-1] ERROR
org.springframework.web.context.ContextLoader - Context initialization
failed org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'embedController' defined in ServletContext
resource [/WEB-INF/playground-servlet.xml]: Cannot resolve reference
to bean 'homeController' while settin g bean property
'homeController'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'homeController' defined in ServletContext
resource [/WEB-INF/playground-servlet.xml]: Cannot re solve reference
to bean 'execService' while setting bean property 'execService';
nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'execService': Invocation of init method
failed; nested exception is javax.ws.rs.ProcessingException:
java.net.ConnectException: Connection refused (Connection refused)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:326)
~[spring-beans-3.2.8.RELEASE.jar:3.2.8.RELEASE]
It should be abundantly clear by now that I don't have much clue what I'm doing. I have spent the afternoon doing lots of googling and looking at lots of Stack Overflow answers, but nothing seems relevant.
that error comes from Spring. For Java 11 support, you'd also need to upgrade Spring to the latest 5.x version (currently 5.2.x).
You may encounter various compatibility issues when upgrading an older environment to Java 11. Unless you absolutely need to upgrade, you may consider staying on a previous version. Java 8 is still being supported.

Neo4j store upgrade error

I have created a large graph using the Neo4j's 2.2M02 import tool.
Now I want to use the same database in embedded version in 2.2RC01. I get the following error in Java, when I initialize the database:
Exception in thread "main" java.lang.RuntimeException: Error starting org.neo4j.kernel.EmbeddedGraphDatabase, D:\Neo4j\data\test3.db
at org.neo4j.kernel.InternalAbstractGraphDatabase.run(InternalAbstractGraphDatabase.java:331)
at org.neo4j.kernel.EmbeddedGraphDatabase.<init>(EmbeddedGraphDatabase.java:59)
at org.neo4j.graphdb.factory.GraphDatabaseFactory.newDatabase(GraphDatabaseFactory.java:103)
at org.neo4j.graphdb.factory.GraphDatabaseFactory$1.newDatabase(GraphDatabaseFactory.java:90)
at org.neo4j.graphdb.factory.GraphDatabaseBuilder.newGraphDatabase(GraphDatabaseBuilder.java:176)
at RCNeo4j.initDB(RCNeo4j.java:419)
at RCNeo4j.main(RCNeo4j.java:46)
Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.kernel.impl.transaction.state.DataSourceManager#2c7e0aa0' was successfully initialized, but failed to start. Please see attached cause exception.
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:513)
at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:115)
at org.neo4j.kernel.InternalAbstractGraphDatabase.run(InternalAbstractGraphDatabase.java:326)
... 6 more
Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.kernel.NeoStoreDataSource#37b86b14' was successfully initialized, but failed to start. Please see attached cause exception.
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:513)
at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:115)
at org.neo4j.kernel.impl.transaction.state.DataSourceManager.start(DataSourceManager.java:117)
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:507)
... 8 more
Caused by: org.neo4j.kernel.impl.storemigration.StoreUpgrader$UnexpectedUpgradingStoreVersionException: 'neostore.nodestore.db' has a store version number that we cannot upgrade from. Expected 'v0.A.3' but file is version 'NodeStore v0.A.4'.
at org.neo4j.kernel.impl.storemigration.UpgradableDatabase.checkUpgradeable(UpgradableDatabase.java:88)
at org.neo4j.kernel.impl.storemigration.StoreMigrator.needsMigration(StoreMigrator.java:157)
at org.neo4j.kernel.impl.storemigration.StoreUpgrader.getParticipantsEagerToMigrate(StoreUpgrader.java:259)
at org.neo4j.kernel.impl.storemigration.StoreUpgrader.migrateIfNeeded(StoreUpgrader.java:134)
at org.neo4j.kernel.NeoStoreDataSource.upgradeStore(NeoStoreDataSource.java:562)
at org.neo4j.kernel.NeoStoreDataSource.start(NeoStoreDataSource.java:471)
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:507)
... 11 more
message.log inside the database doesn't seem to show any exception either. I get the same error when I try to move from 2.1.7 to RC01.
Also, on a different note I would also like to know if it's possible to use the database generated from 2.2M02 in 2.1.7 (kind of like a downgrade). Because I prefer to have a more stable version to do some analysis.
Neo4j does not provide an upgrade path between milestone releases, so there is no direct way to upgrade 2.2.0-M02 to 2.2.0-RC1. Upgrades are only supported from one stable to another stable version. Downgrades are not supported at all in the product.
However there is a potential way to do it. Use Michael's store-utils (https://github.com/jexp/store-utils) and change the code using classloader separation in a way that the store you're reading from and the one you're writing to are using separate classloaders with different Neo4j versions.

ClassNotFoundException when calling EJB running on weblogic 10.3 from app running on weblogic 10.0

I have a stateless EJB (3.0) running on weblogic 10.3 (Java 6).
I am able to call the EJB using a standalone client without any problems (using the weblogic jars). I am using the correct jndi name.
When I try to call the EJB from an application running on weblogic 10.0 (Java 5). I get the following root exception:
Caused by: javax.naming.CommunicationException [Root exception is java.rmi.UnmarshalException: failed to unmarshal class java.lang.Object; nested exception is:
java.lang.ClassNotFoundException: weblogic.ejb.spi.BusinessObject: This error could indicate that a component was deployed on a cluster member but not other members of that cluster. Make sure that any component deployed on a server that is part of a cluster is also deployed on all other members of that cluster]
at weblogic.jndi.internal.ExceptionTranslator.toNamingException(ExceptionTranslator.java:74)
at weblogic.jndi.internal.WLContextImpl.translateException(WLContextImpl.java:426)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:382)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:367)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:155)
at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:88)
at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:153)
at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:178)
at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:104)
at org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:105)
at org.springframework.ejb.access.AbstractRemoteSlsbInvokerInterceptor.lookup(AbstractRemoteSlsbInvokerInterceptor.java:98)
at org.springframework.ejb.access.AbstractSlsbInvokerInterceptor.getHome(AbstractSlsbInvokerInterceptor.java:159)
at org.springframework.ejb.access.AbstractSlsbInvokerInterceptor.create(AbstractSlsbInvokerInterceptor.java:214)
at org.springframework.ejb.access.AbstractRemoteSlsbInvokerInterceptor.newSessionBeanInstance(AbstractRemoteSlsbInvokerInterceptor.java:221)
at org.springframework.ejb.access.SimpleRemoteSlsbInvokerInterceptor.getSessionBeanInstance(SimpleRemoteSlsbInvokerInterceptor.java:141)
at org.springframework.ejb.access.SimpleRemoteSlsbInvokerInterceptor.doInvoke(SimpleRemoteSlsbInvokerInterceptor.java:97)
... 75 more
Caused by: java.rmi.UnmarshalException: failed to unmarshal class java.lang.Object; nested exception is:
java.lang.ClassNotFoundException: weblogic.ejb.spi.BusinessObject: This error could indicate that a component was deployed on a cluster member but not other members of that cluster. Make sure that any component deployed on a server that is part of a cluster is also deployed on all other members of that cluster
at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:231)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:338)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:252)
at weblogic.jndi.internal.ServerNamingNode_1001_WLStub.lookup(Unknown Source)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:379)
... 89 more
Caused by: java.lang.ClassNotFoundException: weblogic.ejb.spi.BusinessObject: This error could indicate that a component was deployed on a cluster member but not other members of that cluster. Make sure that any component deployed on a server that is part of a cluster is also deployed on all other members of that cluster
at weblogic.j2ee.ApplicationManager.loadClass(ApplicationManager.java:218)
at weblogic.common.internal.ProxyClassResolver.resolveProxyClass(ProxyClassResolver.java:71)
at weblogic.common.internal.ProxyClassResolver.resolveProxyClass(ProxyClassResolver.java:40)
at weblogic.rjvm.MsgAbbrevInputStream.resolveProxyClass(MsgAbbrevInputStream.java:427)
at weblogic.rjvm.MsgAbbrevInputStream$NestedObjectInputStream.resolveProxyClass(MsgAbbrevInputStream.java:668)
at java.io.ObjectInputStream.readProxyDesc(ObjectInputStream.java:1500)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1463)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1699)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
at weblogic.utils.io.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:195)
at weblogic.rjvm.MsgAbbrevInputStream.readObject(MsgAbbrevInputStream.java:565)
This error could indicate that a component was deployed on a cluster member but not other members of that cluster. Make sure that any component deployed on a server that is part of a cluster is also deployed on all other members of that cluster
This does not make sense there aren't any clusters involved (two separate weblogic instances running on my local machine).
Any idea what the cause of the exception might be?
UPDATE: If I copy wlclient.jar from weblogic 10.3 to the lib of the domain running on weblogic 10.0 the call works but that isn't a good solution and I don't understand why it has an dependency on weblogic classes.
Clearly this is a jar issue. Please verify all the location the classpath is referencing and make sure none of the jar files is present twice and also make sure that the jar file containing the weblogic.ejb.spi.BusinessObjec is present on the classpath.
Hope this helps .

Categories

Resources