Deploy Spring boot in weblogic 12c - INSTANCE - java

I tried to deploy an example in weblogic 12c, it is a simple spring boot app, spring-boot-weblogic, you can find it on github:
https://github.com/DISID/disid-proofs/tree/master/spring-boot-weblogic
And I have strange error:
weblogic.application.ModuleException: java.lang.NoSuchFieldError: INSTANCE
These are the images:
The exception in log is:
weblogic.application.ModuleException: java.lang.NoSuchFieldError: INSTANCE
at weblogic.application.internal.ExtensibleModuleWrapper.start(ExtensibleModuleWrapper.java:140)
at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:124)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:237)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:232)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45)
Truncated. see log file for complete stacktrace
Caused By: java.lang.NoSuchFieldError: INSTANCE
at org.springframework.boot.SpringApplication.asUnmodifiableOrderedSet(SpringApplication.java:1259)
at org.springframework.boot.SpringApplication.getListeners(SpringApplication.java:1169)
at org.springframework.boot.context.event.EventPublishingRunListener.<init>(EventPublishingRunListener.java:48)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
Truncated. see log file for complete stacktrace

Related

Getting Servlet: "AxisServlet" failed to preload on startup in Web application java.lang.StackOverflowError in Weblogic 12c

I am getting below error while deploying application on WLS 12c
<Jun 8, 2020 11:02:03,120 AM IST> <Error> <HTTP> <BEA-101216> <Servlet: "AxisServlet" failed to
preload on startup in Web application: "MyApplication1.0.war".
java.lang.StackOverflowError
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader$3.next(URLClassLoader.java:601)
at java.net.URLClassLoader$3.hasMoreElements(URLClassLoader.java:626)
at sun.misc.CompoundEnumeration.next(CompoundEnumeration.java:45)
at sun.misc.CompoundEnumeration.hasMoreElements(CompoundEnumeration.java:54)
Truncated. see log file for complete stacktrace
>
<Jun 8, 2020 11:02:08,698 AM IST> <Error> <Deployer> <BEA-149231> <Unable to set the activation state
to true for the application "MyApplication1.0".
weblogic.application.ModuleException: java.lang.StackOverflowError
at weblogic.application.internal.ExtensibleModuleWrapper.start(ExtensibleModuleWrapper.java:140)
at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:124)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:233)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:228)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45)
Truncated. see log file for complete stacktrace
Caused By: java.lang.StackOverflowError
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader$3.next(URLClassLoader.java:601)
at java.net.URLClassLoader$3.hasMoreElements(URLClassLoader.java:626)
at sun.misc.CompoundEnumeration.next(CompoundEnumeration.java:45)
at sun.misc.CompoundEnumeration.hasMoreElements(CompoundEnumeration.java:54)
Truncated. see log file for complete stacktrace
Below is my project structure
Same project is working fine with Weblogic 11G
I was able to resolve issue.
For people having similar issue.
Add weblogic.xml with following content in tag.
<container-descriptor>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>
This step will remove stackoverflow error.
Later you might get some dependency error which can be resolved as required.

I am getting this error Caused by: java.lang.ClassNotFoundException: javafx.scene.Node deploying war in Ubuntu tomcat server

I am getting this below error when deploying a war file (its a web service file)
Caused by: java.lang.ClassNotFoundException: javafx.scene.Node deploying war in Ubuntu tomcat server
After trying to start the war service which i deployed . When I check the status of the tomcat server
java.lang.ClassNotFoundException: javafx.scene.Node

Setting a property specific to ear / war application in web logic

I am deploying an ear file in web logic .
This ear file is a RMI client and uses some 3rd party jars .
These 3rd party jars need the following properties :
System.setProperty("java.naming.provider.url", "localhost:1099");
System.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
The problem with these properties is that these mess up weblogic admin console.
The console no longer is accessible once the above two properties get fired .
when I try to access weblogic console after these properties are set I get the following exception :
<24/05/2019 5:23:34 PM EST> <Error> <Console> <BEA-240003> <Administration Console encountered the following error: java.io.IOException: Unable to create InitialContext: javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]
at weblogic.management.remote.wlx.ClientProvider.findRMIServer(ClientProvider.java:126)
at weblogic.management.remote.wlx.ClientProvider.newJMXConnector(ClientProvider.java:103)
at javax.management.remote.JMXConnectorFactory.newJMXConnector(JMXConnectorFactory.java:369)
at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:267)
at com.bea.console.utils.MBeanUtils.lookupMBeanServerConnection(MBeanUtils.java:3658)
at com.bea.console.utils.MBeanUtils.getDomainRuntimeMBeanServerConnection(MBeanUtils.java:1840)
at com.bea.console.utils.MBeanUtils.getDomainRuntimeServiceMBean(MBeanUtils.java:1916)
at com.bea.console.utils.MBeanUtilsInitializer.initMBeanUtils(MBeanUtilsInitializer.java:70)
at com.bea.console.utils.MBeanUtilsInitializer.access$000(MBeanUtilsInitializer.java:20)
at com.bea.console.utils.MBeanUtilsInitializer$1.run(MBeanUtilsInitializer.java:49)
at weblogic.work.ContextWrap.run(ContextWrap.java:40)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:548)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:311)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:263)
Caused by: javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:674)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:307)
at javax.naming.InitialContext.init(InitialContext.java:242)
at javax.naming.InitialContext.<init>(InitialContext.java:216)
at weblogic.management.remote.wlx.ClientProvider.findRMIServer(ClientProvider.java:124)
... 13 more
Caused by: java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory
at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:357)
at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:318)
at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:80)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:186)
at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:50)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:270)
at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:72)
at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:61)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:671)
... 17 more
>
<24/05/2019 5:23:34 PM EST> <Error> <Console> <BEA-240003> <Administration Console encountered the following error: Error when initilize JMX connection>
<24/05/2019 5:23:37 PM EST> <Error> <Console> <BEA-240003> <Administration Console encountered the following error: java.io.IOException: Unable to create InitialContext: javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]
at weblogic.management.remote.wlx.ClientProvider.findRMIServer(ClientProvider.java:126)
at weblogic.management.remote.wlx.ClientProvider.newJMXConnector(ClientProvider.java:103)
at javax.management.remote.JMXConnectorFactory.newJMXConnector(JMXConnectorFactory.java:369)
so clearly setting properties at System level is not a good idea and it is messing up web logic .
Since these properties are being used by 3rd party jars ( code which I cannot change ) how do I provide these properties to the jars without impacting web logic?
essentially these properties should be set specific to my application without interfering with web logic.

Apache Felix and Spring boot application : Class not found issue

I wrote a spring boot application which was working fine without any issues. Then I changed pom and added activator class and make it a Felix OSGI bundle. Then I was able to install it with Felix console as well.
But when I start it with Felix controller, I was getting following error,
g! start 21
org.osgi.framework.BundleException: Activator start error in bundle company.iot.devops [21].
at org.apache.felix.framework.Felix.activateBundle(Felix.java:2276)
at org.apache.felix.framework.Felix.startBundle(Felix.java:2144)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998)
at org.apache.felix.gogo.command.Basic.start(Basic.java:739)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Caused by: java.lang.NoClassDefFoundError: org/springframework/boot/SpringApplication
at company.iot.devops.IOTMain.main(IOTMain.java:10)
at company.iot.devops.osgi.Activator.start(Activator.java:35)
Then I tried with
<Embed-Dependency>!company*;*;scope=compile|runtime</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
In the POM and resolved that issue. But now I am getting different issue,
16:51:03.914 [Gogo shell] ERROR org.springframework.boot.SpringApplication - Application startup failed
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [company.iot.devops.IOTMain]; nested exception is java.io.FileNotFoundException: class path resource [org/springframework/boot/autoconfigure/EnableAutoConfigurationImportSelector.class] cannot be opened because it does not exist
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:182)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:321)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:243)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:273)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:98)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:678)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:520)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766)
Caused by: java.io.FileNotFoundException: class path resource [org/springframework/boot/autoconfigure/EnableAutoConfigurationImportSelector.class] cannot be opened because it does not exist
at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:172)
at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:50)
at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataRea
....
org.osgi.framework.BundleException: Activator start error in bundle company.iot.devops [42].
at org.apache.felix.framework.Felix.activateBundle(Felix.java:2276)
at org.apache.felix.framework.Felix.startBundle(Felix.java:2144)
....
Caused by: java.io.FileNotFoundException: class path resource [org/springframework/boot/autoconfigure/EnableAutoConfigurationImportSelector.class] cannot be opened because it does not exist
at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:172)
at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:50)
I can see jar file spring-boot-autoconfigure-1.3.5.RELEASE.jar in the bundle and it reffered from "Embedded-Artifacts" in the MANIFEST.MF as well.
Not sure why Spring boot can't find this class.
Thanks

Error when trying to access my application in JBoss AS 7.1

I recently migrated my application from JBoss AS 4.2.1 to JBoss AS 7.1, but I am not being able to access the application vua http request since I am getting the below error:
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Unable to instantiate Action, payment.PaymentBean, defined for 'prepayment' in namespace '/payment'javax.naming.NamingException: JBAS011843: Failed instantiate InitialContextFactory org.jnp.interfaces.NamingContextFactory from classloader ModuleClassLoader for Module "deployment.TPGWeb.war:main" from Service Module Loader - action - vfs:/content/TPGWeb.war/WEB-INF/classes/struts.xml:26:64
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:518)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:421)
root cause
Unable to instantiate Action, payment.PaymentBean, defined for 'prepayment' in namespace '/payment'javax.naming.NamingException: JBAS011843: Failed instantiate InitialContextFactory org.jnp.interfaces.NamingContextFactory from classloader ModuleClassLoader for Module "deployment.TPGWeb.war:main" from Service Module Loader - action - vfs:/content/TPGWeb.war/WEB-INF/classes/struts.xml:26:64
com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:289)
com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:360)
com.opensymphony.xwork2.DefaultActionInvocation.access$000(DefaultActionInvocation.java:38)
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:78)
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
com.opensymphony.xwork2.DefaultActionInvocation.<init>(DefaultActionInvocation.java:70)
com.opensymphony.xwork2.DefaultActionInvocation.<init>(DefaultActionInvocation.java:66)
com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:189)
org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:41)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:497)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:421)
root cause
java.lang.RuntimeException: javax.naming.NamingException: JBAS011843: Failed instantiate InitialContextFactory org.jnp.interfaces.NamingContextFactory from classloader ModuleClassLoader for Module "deployment.TPGWeb.war:main" from Service Module Loader
utils.ResourceCenter.lookupGatewaySecurityBean(ResourceCenter.java:76)
payment.PaymentBean.<init>(PaymentBean.java:39)
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
java.lang.reflect.Constructor.newInstance(Constructor.java:532)
java.lang.Class.newInstance0(Class.java:372)
java.lang.Class.newInstance(Class.java:325)
com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:121)
com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:152)
com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:141)
com.opensymphony.xwork2.ObjectFactory.buildAction(ObjectFactory.java:111)
com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:270)
com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:360)
com.opensymphony.xwork2.DefaultActionInvocation.access$000(DefaultActionInvocation.java:38)
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:78)
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
com.opensymphony.xwork2.DefaultActionInvocation.<init>(DefaultActionInvocation.java:70)
com.opensymphony.xwork2.DefaultActionInvocation.<init>(DefaultActionInvocation.java:66)
com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:189)
org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:41)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:497)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:421)
root cause
javax.naming.NamingException: JBAS011843: Failed instantiate InitialContextFactory org.jnp.interfaces.NamingContextFactory from classloader ModuleClassLoader for Module "deployment.TPGWeb.war:main" from Service Module Loader
org.jboss.as.naming.InitialContextFactoryBuilder.createInitialContextFactory(InitialContextFactoryBuilder.java:64)
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:681)
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:305)
javax.naming.InitialContext.init(InitialContext.java:240)
javax.naming.InitialContext.<init>(InitialContext.java:192)
utils.ResourceCenter.lookupGatewaySecurityBean(ResourceCenter.java:66)
payment.PaymentBean.<init>(PaymentBean.java:39)
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
java.lang.reflect.Constructor.newInstance(Constructor.java:532)
java.lang.Class.newInstance0(Class.java:372)
java.lang.Class.newInstance(Class.java:325)
com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:121)
com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:152)
com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:141)
com.opensymphony.xwork2.ObjectFactory.buildAction(ObjectFactory.java:111)
com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:270)
com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:360)
com.opensymphony.xwork2.DefaultActionInvocation.access$000(DefaultActionInvocation.java:38)
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:78)
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
com.opensymphony.xwork2.DefaultActionInvocation.<init>(DefaultActionInvocation.java:70)
com.opensymphony.xwork2.DefaultActionInvocation.<init>(DefaultActionInvocation.java:66)
com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:189)
org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:41)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:497)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:421)
note The full stack trace of the root cause is available in the JBoss Web/7.0.13.Final logs.
JBoss Web/7.0.13.Final
Add "Dependencies: org.jboss.remote-naming" to META-INF/manifest.mf of your .WAR file. This will load org.jboss.remote-naming module and eliminate "Failed instantiate InitialContextFactory" exception. Details here: https://docs.jboss.org/author/display/AS71/Class+Loading+in+AS7
use jboss-ejb-client.properties file and place it to WEB-INF folder vs content like this:
remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false
remote.connections=default
remote.connection.default.host=your host
remote.connection.default.port=your port
remote.connection.default.username=you user
remote.connection.default.password=you password
remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
and lookup this way:
Properties jndiProps = new Properties();
jndiProps.puy(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
jndiProps.put(Context.SECURITY_PRINCIPAL, JBOSS_USER);
jndiProps.put(Context.SECURITY_CREDENTIALS, JBOSS_PWD);
jndiProps.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
jndiProps.put(Context.PROVIDER_URL, "remote://yourhost:yourport");
InitialContext initialContext = new InitialContext(jndiProps);
YourRemote remote=(YourRemote)initialContext.lookup("java:/app-name/ejb-jar-name/YourBean!package.YourRemote");
For details see:
https://docs.jboss.org/author/display/AS71/EJB+invocations+from+a+remote+client+using+JNDI
Good luck!
From post above... "Add "Dependencies: org.jboss.remote-naming" to META-INF/manifest.mf of your .WAR file."
Thanks so much for the above help. It got me a step closer to migrating to JBoss EAP 6.
An alternative to above, if you have a War file that has to be deployed on non-JBoss servers, is to add the following to the jboss-deployment-structure.xml file.
That has the benefit of separating out the JBoss specific elements to their own JBoss specific files.
<sub-deployment name="yourWebApp.war">
<dependencies>
<module name="org.jboss.remote-naming" />
</dependencies>
</sub-deployment>
regards,
Owen

Categories