Closed poojashree-mc closed 1 year ago
Hi @poojashree-mc , can you please show the code you used to add the config properties file to the ShrinkWrap deployment archive?
I tried it out and it looks like adding this line works:
.addAsManifestResource(new File("src/main/resources/META-INF", "microprofile-config.properties"))
so, e.g.:
WebArchive archive = ShrinkWrap.create(WebArchive.class, WARNAME)
.addAsManifestResource(new File("src/main/resources/META-INF", "microprofile-config.properties"))
.addPackages(true, "io.openliberty.guides.system");
@poojashree-mc could you please add a comment here if you have any updates on this issue? It looks like I might have gotten an email about it but it's better to work through the issue. Thank you.
Thank you @scottkurz it works
@poojashree-mc glad to help. I'm thinking I'm going to write this up on StackOverflow as a Q&A. I'll give it a couple days in case you want to do it first (if you do please just post a link here and I'll go take a look). Thanks.
@scottkurz,
It will be really helpful if I get link or guide for testing persistence(DB2) layer and RestAPI end point form open liberty.
Issue Overview
Unable to run testcase case project contains finish\src\main\resources\META-INF/microprofile-config.properties
Expected Behaviour
Unable to run mvn failsafe:integration-test
Current Behaviour
Should be able to run mvn failsafe:integration-test
Additional Information
Hi Team, I am stuck with this issue. I am facing issue while writing integration testing I cloned git clone https://github.com/openliberty/guide-arquillian-managed.git (https://openliberty.io/guides/arquillian-managed.html)
code:
Added property file under finish\src\main\resources\META-INF\microprofile-config.properties AppConfig.java --->
@ApplicationScoped public class AppConfig { @Inject @ConfigProperty(name="serviceName") private String serviceName;
public String getServiceName() { return serviceName; } public void setServiceName(String serviceName) { this.serviceName = serviceName; } } server.xml
Exception : io.smallrye.config.inject.ConfigException: SRCFG02000: Failed to Inject @ConfigProperty for key serviceName into io.openliberty.guides.system.AppConfig.serviceName since the config property could not be found in any config source at io.smallrye.config.inject.ConfigExtension.validate(ConfigExtension.java:183) at io.openliberty.microprofile.config.internal.extension.OLSmallRyeConfigExtension.validate(OLSmallRyeConfigExtension.java:65) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:95) at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:85) at org.jboss.weld.injection.MethodInvocationStrategy$SimpleMethodInvocationStrategy.invoke(MethodInvocationStrategy.java:168) at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:330) at org.jboss.weld.event.ExtensionObserverMethodImpl.sendEvent(ExtensionObserverMethodImpl.java:123) at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:308) at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:286) at jakarta.enterprise.inject.spi.ObserverMethod.notify(ObserverMethod.java:125) at org.jboss.weld.util.Observers.notify(Observers.java:166) at org.jboss.weld.event.ObserverNotifier.notifySyncObservers(ObserverNotifier.java:285) at org.jboss.weld.event.ObserverNotifier.notify(ObserverNotifier.java:273) at org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:177) at org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:171) at org.jboss.weld.bootstrap.events.AbstractContainerEvent.fire(AbstractContainerEvent.java:53) at org.jboss.weld.bootstrap.events.AbstractDeploymentContainerEvent.fire(AbstractDeploymentContainerEvent.java:35) at org.jboss.weld.bootstrap.events.AfterDeploymentValidationImpl.fire(AfterDeploymentValidationImpl.java:28) at org.jboss.weld.bootstrap.WeldStartup.validateBeans(WeldStartup.java:510) at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:93) at com.ibm.ws.cdi.impl.CDIContainerImpl.startInitialization(CDIContainerImpl.java:178) at com.ibm.ws.cdi.liberty.CDIRuntimeImpl.applicationStarting(CDIRuntimeImpl.java:492) at com.ibm.ws.container.service.state.internal.ApplicationStateManager.fireStarting(ApplicationStateManager.java:51) at com.ibm.ws.container.service.state.internal.StateChangeServiceImpl.fireApplicationStarting(StateChangeServiceImpl.java:50) at com.ibm.ws.app.manager.module.internal.SimpleDeployedAppInfoBase.preDeployApp(SimpleDeployedAppInfoBase.java:547) at com.ibm.ws.app.manager.module.internal.SimpleDeployedAppInfoBase.installApp(SimpleDeployedAppInfoBase.java:508) at com.ibm.ws.app.manager.module.internal.DeployedAppInfoBase.deployApp(DeployedAppInfoBase.java:349) at com.ibm.ws.app.manager.war.internal.WARApplicationHandlerImpl.install(WARApplicationHandlerImpl.java:65) at com.ibm.ws.app.manager.internal.statemachine.StartAction.execute(StartAction.java:182) at com.ibm.ws.app.manager.internal.statemachine.ApplicationStateMachineImpl.enterState(ApplicationStateMachineImpl.java:1367) at com.ibm.ws.app.manager.internal.statemachine.ApplicationStateMachineImpl.performAction(ApplicationStateMachineImpl.java:1211) at com.ibm.ws.app.manager.internal.statemachine.ApplicationStateMachineImpl.run(ApplicationStateMachineImpl.java:918) at com.ibm.ws.threading.internal.ExecutorServiceImpl$RunnableWrapper.run(ExecutorServiceImpl.java:245) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:750)
$mvn --version
Maven home: /usr/share/maven/latest Java version: 1.7.0_79, vendor: Oracle Corporation Java home: /usr/java/jdk1.7.0_79/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "4.7.7-200.fc24.x86_64", arch: "amd64", family: "unix"