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
Related
I'm getting following exception in a project using OpenFeign. Please suggest how to resolve this issue.
Exception is given below:
org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.seamless.ers.links.kyc.client.CustomerDetailsClient': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.springframework.cloud.openfeign.FeignClientFactoryBean] from ClassLoader [sun.misc.Launcher$AppClassLoader#18b4aac2]
at
...
Caused by: java.lang.ClassNotFoundException: feign.Feign$Builder
at java.net.URLClassLoader.findClass(URLClassLoader.java:382) ~[na:1.8.0_301]
at java.lang.ClassLoader.loadClass(ClassLoader.java:418) ~[na:1.8.0_301]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355) ~[na:1.8.0_301]
at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ~[na:1.8.0_301]
... 25 common frames omitted
Below are the dependencies added:
spring-cloud-starter
spring-cloud-openfeign-core
spring-boot-starter-test
spring-boot-starter-web
Most famous class loading exception and indicates that compiler have difficulties to detect proper dependent class i.e provided the dependency at runtime, following are most healer to issue
Check the version and probably duplication of your maven artifact for spring-cloud-starter - spring-cloud-openfeign-core if you are not using spring boot parent and if the artifacts imported properly from firtplace,
Check the scope of the dependencies, for the current case in hand the will be provided to compile <scope>provided</scope>
Exclude the duplicate dependencies that they provide spring feign as transparent dependency .
I am using Gradle in an IntelliJ project to manage dependencies in a Spring project to provide REST web services. As long as I run the project in the IDE it works fine, but if I execute the java -jar artifact.jar command it cannot start. The following error is printed
13:42:47.338 [main] WARN org.springframework.boot.SpringApplication - Unable to close ApplicationContext
java.lang.IllegalStateException: Failed to introspect Class [com.(...).web_services.JmsConfiguration] from ClassLoader [jdk.internal.loader.ClassLoaders$AppClassLoader#2cdf8d8a]
at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:481)
at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:358)
at org.springframework.util.ReflectionUtils.getUniqueDeclaredMethods(ReflectionUtils.java:414)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.lambda$getTypeForFactoryMethod$2(AbstractAutowireCapableBeanFactory.java:747)
at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1705)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryMethod(AbstractAutowireCapableBeanFactory.java:746)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:685)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:656)
at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1670)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:570)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:542)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:667)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:659)
at org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:1300)
at org.springframework.boot.SpringApplication.getExitCodeFromMappedException(SpringApplication.java:914)
at org.springframework.boot.SpringApplication.getExitCodeFromException(SpringApplication.java:902)
at org.springframework.boot.SpringApplication.handleExitCode(SpringApplication.java:889)
at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:830)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:349)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1340)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1329)
at com.(...).web_services.WebServicesApplication.main(WebServicesApplication.java:10)
Caused by: java.lang.NoClassDefFoundError: javax/jms/ConnectionFactory
at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3166)
at java.base/java.lang.Class.getDeclaredMethods(Class.java:2309)
at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:463)
... 21 common frames omitted
Caused by: java.lang.ClassNotFoundException: javax.jms.ConnectionFactory
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 25 common frames omitted
I suppose the javax.jms.ConnectionFactory class comes with the Spring ActiveMQ package, and I already tried to update Gradle manually but that did not solve the problem. Also importing javax.jms.ConnectionFactory in the JMS class did not help. Any clue?
The first attempt was to create a fat jar using the following custom gradle task (as suggested by #MatteoNNZ following this guide).
task customFatJar(type: Jar) {
manifest {
attributes 'Main-Class': '<myPackage>.<myMainClass>'
}
baseName = 'all-in-one-jar'
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}
However, as this didn't work, I ran the predefined gradle task buildDependents that created a working .jar in the build/libs folder.
I'm working on an EAR that will be deployed to a jboss wildfly server. There is a bunch of common code that gets shared between different projects that the ear depends on. That code gets packaged into a jar and placed into the lib directory of the EAR. So far so good, but as soon as I go to deploy I run into problems. 'Common.jar' has its own set of dependencies which the classloader doesn't seem to be able to locate. When I try to start up my server I get the following error:
10:49:08,686 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start service jboss.deployment.subunit."Person.ear"."Person-web.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.subunit."Person.ear"."Person-web.war".POST_MODULE: WFLYSRV0153: Failed to process phase POST_MODULE of subdeployment "Person-web.war" of deployment "Person.ear"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:183)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1739)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1701)
at org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1559)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1982)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: WFLYSRV0177: Error getting reflective information for class com.tura.common.servlet.LogoutServlet with ClassLoader ModuleClassLoader for Module "deployment.Person.ear" from Service Module Loader
at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:78)
at org.jboss.as.ee.metadata.MethodAnnotationAggregator.runtimeAnnotationInformation(MethodAnnotationAggregator.java:57)
at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.handleAnnotations(InterceptorAnnotationProcessor.java:106)
at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.processComponentConfig(InterceptorAnnotationProcessor.java:91)
at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.deploy(InterceptorAnnotationProcessor.java:76)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:176)
... 8 more
Caused by: java.lang.NoClassDefFoundError: org/stringtemplate/v4/STWriter
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:2583)
at java.lang.Class.getDeclaredFields(Class.java:1916)
at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:72)
at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:70)
... 13 more
Caused by: java.lang.ClassNotFoundException: org.stringtemplate.v4.STWriter from [Module "deployment.Person.ear" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:255)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:410)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
... 18 more
I have tried everything I can think of any nothing seems to help. All of the docs and information I have found so far are for dependencies on jboss modules. How do I set up a dependency on a third-party library nested in a jar?
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.
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