Я создал службу REST на основе ReasyEasy, которая развернута на сервере приложений Widlfly.
У меня есть POJO, как показано ниже, в котором я использую io.xlate.property-inject depdendency, чтобы установить значениясвойства в нем.
'' '@Inject @Property (systemProperty = "env.saml.private-key.location", resource = @ PropertyResource ("classpath: application.properties")) private String privateKeyLocation;
@Inject
@Property(systemProperty="env.saml.truststore.location", resource=@PropertyResource("classpath:application.properties"))
private String truststoreLocation;
'' 'Я запускаю Widfly с помощью -P и передаю путь к файлу application.properties.
При вызове конечной точки Rest я получаю следующее исключение:
Причина: javax.enterprise.inject.InjectionException: javax.enterprise.inject.InjectionException: ресурс пути к классу не найден: application.properties at io.xlate.inject.PropertyProducerBean.produceProperty (PropertyProducerBean.java: 57) на sun.reflect.NativeMethodAccessorImpl.invoke0 (собственный метод) на sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) на солнце.refle.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) в java.lang.reflect.Method.invoke (Method.java:498) в org.jboss.weld.injection.StaticMethodInjectionPoint.Mjhog: точка перехода в точку.jboss.weld..produce (AbstractMemberProducer.java:161) в org.jboss.weld.bean.AbstractProducerBean.create (AbstractProducerBean.java:180) в org.jboss.weld.contexts.unbound.DependentContextImpl.get (DependentConteavaImp.l)org.jboss.weld.bean.ContextualInstanceStrategy $ DefaultContextualInstanceStrategy.get (ContextualInstanceStrategy.java:100) в org.jboss.weld.bean.ContextualInstance.get (ContextualInstance.java:50) в org.jbosse.getReference (BeanManagerImpl.java:700) в org.jboss.weld.manager.BeanManagerImpl.getInjectableReference (BeanManagerImpl.java:800) в org.jboss.weld.injection.FieldInjectionPoint.inject (FieldInjectionPoint.java:92) в org.jboss.weld.util.Beans.injectBoundjava: поля (336) в org.jboss.weld.util.Beans.injectFieldsAndInitializers (Beans.java:347) в org.jboss.weld.injection.producer.ResourceInjector $ 1.proceed (ResourceInjector.java:69) в org.jboss.weld.jection.InjectionContextImpl.run (InjectionContextImpl.java:48) в org.jboss.weld.injection.producer.ResourceInjector.inject (ResourceInjector.java:71) в org.jboss.weld.injection.producer.BasicInjectionTarget.inject.Java: 117) в org.jboss.weld.bean.ManagedBean.create (ManagedBean.java:159) в org.jboss.weld.contexts.AbstractContext.get (AbstractContext.java:96) в org.jboss.weld.bean.ContextualInstanceStrategy $ DefaultContextualInstanceStrategy.get (ContextualInstanceStrategy.java:100) в org.jboss.weld.bean.ContextualInstanceStrategy $ CachingContextualInstanceStrategy.get (ContextualInstanceStrategy.java:177) в org.jboss.weld.bean.ContextualInstance.get (ContextualInstance.java:50) в org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance (ContextBeanInstance.javag0) at.weld.bean.proxy.com.tcs.insurance.platform.digital.authentication.service.AuthenticationService.buildSAMLRequest (AuthenticationService.java:128) в com.tcs.insurance.platform.digital.authentication.service.AuthenticationService $ Proxy $ $$ Welxy.buildSAMLRequest (Неизвестный источник) по адресу sun.reflect.NativeMethodAccessorImpl.invoke0 (собственный метод)в sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) в sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) в java.lang.hoj.jjjboss.resteasy.core.MethodInjectorImpl.invoke (MethodInjectorImpl.java:140) в org.jboss.resteasy.core.ResourceMethodInvoker.internalInvokeOnTarget (ResourceMethodInvoker.java:50.hogJava: 399) в org.jboss.resteasy.core.ResourceMethodInvoker.lambda $ invokeOnTarget $ 0 (ResourceMethodInvoker.java:363) в org.jboss.resteasy.core.interception.PreMatchContainerRequestContextava.Retain.Reg.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget (ResourceMethodInvoker.java:365) по адресу org.jboss.resteasy.core.ResourceMethodInvoker.invoke (ResourceMethodInvoker.java:ok_hodes.jpg).er.java:310) at org.jboss.resteasy.core.SynchronousDispatcher.invoke (SynchronousDispatcher.java:443) ... еще 57 Причина: javax.enterprise.inject.InjectionException: ресурс пути к классу не найден: приложение.свойства в io.xlate.inject.ClasspathURLStreamHandler.openConnection (ClasspathURLStreamHandler.java:24) в java.net.URL.openConnection (URL.java:979) в java.net.URL.openStream (URL.java:1045) в io.xlate.inject.PropertyFactory.getProperties (PropertyFactory.java:101) в io.xlate.inject.PropertyFactory.getProperty (PropertyFactory.java:85) в io.xlate.inject.PropertyProducerBean.getProperty (PropertyProducerBean.java4 ):30io.xlate.inject.PropertyProducerBean.produceProperty (PropertyProducerBean.java:55) ... еще 101
Я тестирую службу с помощью Почтальона.
При повторном вызове сервиса после того, как я получаю исключение выше, он работает нормально.
Я новичок в RestEasy, разработке JAX-RS.
Любая помощь, будет отличной.
Спасибо Milind