Quarkus Stork Service Discovery using DNS - service-discovery

Does anyone have a working example of Stork DNS Service Discovery working in Quarkus.... I see lots of examples using consul but not using DNS and I cannot get the properties or Inject beans when using DNS.
#ApplicationScoped
#RegisterRestClient(baseUri = "stork://auth-service/")
#RegisterProvider(OidcClientRequestFilter.class)
public interface KeycloakService {
I placed the following in my properties file but I get a compiler warning saying it is being ignored.
quarkus.stork.auth-service.service-discovery.type=dns
and my POM
<dependency>
<groupId>io.smallrye.stork</groupId>
<artifactId>stork-service-discovery-dns</artifactId>
<version>1.2.0</version>
</dependency>
The error I am getting is
Caused by: java.lang.IllegalArgumentException: The value of URL was invalid stork://auth-service

Related

Liferay scheduled job fails on missing Liferay's classes

I have a Liferay job written using this guide. I am running liferay-ce-portal-tomcat-7.0-ga3. The job uses DLAppServiceUtil to work with document library.
The job starts exactly as scheduled. But the problem is this exception:
Exception in thread "liferay/scheduler_dispatch-407" java.lang.NoClassDefFoundError: com/liferay/portlet/documentlibrary/service/DLAppServiceUtil
What's wrong?
My pom.xml is:
<!-- ... -->
<dependency>
<groupId>com.liferay.portal</groupId>
<artifactId>portal-service</artifactId>
<version>7.0.0-nightly</version>
<scope>provided</scope>
</dependency>
<!-- ... -->
My job class is:
public class MyJob implements MessageListener {
#Override
public void receive(Message message) throws MessageListenerException {
// DLAppServiceUtil usage...
}
}
How can I fix it?
In Liferay 7, do not use the serviceUtil classes any more (provided you write an OSGi bundle).
Instead add
#Reference
DLAppService dlAppService;
to your component class. Look up how to make the listener a proper OSGi component. Liferay's blade-samples on github might have a template. I am on my phone which makes it hard to look up&explain everything in more detail.
If this doesn't work (as you indicate in your comment), you'll have to check your build process: Make sure that the plugin's Manifest declares the dependencies that it has on the required service. From this you can see that I'm recommending to build OSGi plugins - I'm assuming that you're not doing this, because OSGi would not start your plugin until the dependencies are resolved.
You can do so by utilizing bnd. Check the numerous Maven examples within the blade-samples for more detail.
The classes are no longer part of portal-service, com.liferay.portal.kernel is the correct artifact.
Weird that IDE doesn't complain...

Liberty profile: birt and jsf integration

I'm building a web application running on Liberty profile 8.5, with JSF 2.0 feature enabled (jsf-2.0 in server.xml) and BIRT integration in the web app.
The web application includes all BIRT needed libs in WEB-INF/lib folder, but the only way to make it working (specially for chart report) is to set the classloader to 'parentlast' in the server.xml:
<webApplication contextRoot="MyApp" id="MyApp" location="MyApp.war" name="MyApp">
<classloader delegation="parentLast"/>
</webApplication>
In this way, I correctly see charts and reports.
But the 'parentlast' setting makes JSF not working, with this exception:
[ERROR ] SRVE0315E: An execption occurred:
com.ibm.ws.webcontainer.webapp.WebAppErrorReport:
javax.servlet.ServletException: SRVE0207E: Uncaught initialization
exception created by servlet at
com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:385)
at [internal classes] Caused by: javax.servlet.ServletException:
SRVE0207E: Uncaught initialization exception created by servlet ... 3
more
Caused by: java.lang.IllegalStateException: No Factories configured for this Application. This happens if the faces-initialization does not work at all - make sure that you properly include all configuration settings necessary for a basic faces application and that all the necessary libs are included. Also check the logging output of your web application and your container for any exceptions!
If you did that and find nothing, the mistake might be due to the fact that you use some special web-containers which do not support registering context-listeners via TLD files and a context listener is not setup in your web.xml.
A typical config looks like this;
<listener><listenerclass>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>
Without the parentlast setting, the JSF pages are correctly shown, but BIRT charts don't work.
I understand this behaviour, as the parentlast classloading makes the application seeing at first the application libs, where JSF is not included (it's loaded at server scope).
Any suggestion?
Thank you in advance!

Exception while consuming Spring Web Service using spring-ws-core API

I am consuming Spring Web Service using Spring-ws-core API. But when I am getting error when Add following dependency in my project's pom.xml file :
<!-- SPRING WEB-SERVICE DEPEDENCY INJECTION -->
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-core</artifactId>
<version>2.1.4.RELEASE</version>
</dependency>
The exception details is as below :
2015-08-07 03:12:15,097 ERROR | main | org.mortbay.log | Nested in org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/spring-config/netverifier-process-integration.xml]; nested exception is org.springframework.beans.FatalBeanException: Class [org.springframework.integration.config.xml.IntegrationNamespaceHandler] for namespace [http://www.springframework.org/schema/integration] does not implement the [org.springframework.beans.factory.xml.NamespaceHandler] interface:
org.springframework.beans.FatalBeanException: Class [org.springframework.integration.config.xml.IntegrationNamespaceHandler] for namespace [http://www.springframework.org/schema/integration] does not implement the [org.springframework.beans.factory.xml.NamespaceHandler] interface
at org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver.resolve(DefaultNamespaceHandlerResolver.java:126) ~[spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1330) ~[spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1325) ~[spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at
Can anyone please help me to solve this issue ?

java.lang.IllegalArgumentException: Multiple entries with same key: interface javax.validation.constraints.Min

I'm running an EAR with EJB + EJB + WAR deployment in JBoss WildFly 8.2.0.Final with JSF 2.2 and RichFaces 4.5.2.Final. My problem is, that all RichFaces resources fail to load properly in the client. The generated URL don't resolve and return with HTTP 404.
The deployment is build upon Maven und results in the following structure:
The reason for using <scope>compile</scope> in the EJB module and not the WAR is that I need to extend RichFaces classes from within my EJB module. We've build a dynamic form generator based on some of the components.
As soon as I add JARs to EAR/lib/ and WAR/WEB-INF/lib/ by using <scope>compile</scope> instead of <scope>provided</scope> in the WAR module I get the following stacktrace while starting the application server:
Caused by: java.lang.IllegalArgumentException: Multiple entries with same key: interface javax.validation.constraints.Min=org.richfaces.javascript.LibraryFunctionImplementation#c77af4e and interface javax.validation.constraints.Min=org.richfaces.javascript.LibraryFunctionImplementation#5a903150
at com.google.common.collect.ImmutableMap.checkNoConflict(ImmutableMap.java:150)
at com.google.common.collect.RegularImmutableMap.checkNoConflictInBucket(RegularImmutableMap.java:104)
at com.google.common.collect.RegularImmutableMap.<init>(RegularImmutableMap.java:70)
at com.google.common.collect.ImmutableMap$Builder.build(ImmutableMap.java:254)
at org.richfaces.javascript.ClientServiceConfigParser.parseConfig(ClientServiceConfigParser.java:75)
at org.richfaces.application.ValidatorModule.createClientScriptService(ValidatorModule.java:65)
at org.richfaces.application.ValidatorModule.configure(ValidatorModule.java:60)
at org.richfaces.application.ServicesFactoryImpl.init(ServicesFactoryImpl.java:60)
at org.richfaces.application.InitializationListener.createFactory(InitializationListener.java:110)
at org.richfaces.application.InitializationListener.onStart(InitializationListener.java:69)
at org.richfaces.application.InitializationListener.processEvent(InitializationListener.java:167)
at javax.faces.event.SystemEvent.processListener(SystemEvent.java:108)
at com.sun.faces.application.ApplicationImpl.processListeners(ApplicationImpl.java:2190)
at com.sun.faces.application.ApplicationImpl.invokeListenersFor(ApplicationImpl.java:2163)
at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:303)
at org.jboss.as.jsf.injection.weld.ForwardingApplication.publishEvent(ForwardingApplication.java:294)
at com.sun.faces.config.ConfigManager.publishPostConfigEvent(ConfigManager.java:692)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:260)
... 9 more
How can I solve this problem?
Frontend artifacts don't belong in EAR's /lib. They belong in WAR's /WEB-INF/lib. It would otherwise make the backend (the EJB) totally unreusable on other frontends (other WARs), such as Spring MVC, JAX-RS RESTful, "Plain vanilla" JSP/Servlet, etc..etc.. Using/importing JSF FacesContext and friends such as Servlet's HttpServletRequest in an EJB class is already a seriously big red alert. You should not be doing that.
Move that code to WAR. Or, if you intend to make it reusable across various WARs, make it a web fragment project instead which can then end up as another JAR in /WEB-INF/lib.
See also:
JSF Service Layer

Websphere 8.5 upgrade and java2 security - strange error in spring transaction

We are migrating from WAS 6.1 to 8.5. I simply copied the EAR file which we used to deploy in 6.1 to 8.5. The application worked fine and I was happy until web-sphere admin decided to turn on Java2 security. The current was.policy file had java.security.AllPermission. But I guess this does not work with java2 security, so I changed it and granted io permission to every file which is read/written. After this, all permissions related errors are gone, but i am stuck with a strange exception:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'wsJtaTm' defined in ServletContext resource [/WEB-INF/applicationContext.xml]:
Instantiation of bean failed; nested exception is
org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.transaction.jta.WebSphereTransactionManagerFactoryBean]:
Constructor threw exception; nested exception is
org.springframework.transaction.TransactionSystemException: Could not find WebSphere 5.1/6.0/6.1 TransactionManager factory class; nested exception is
java.lang.ClassNotFoundException: com.ibm.ws.Transaction.TransactionManagerFactory
My spring transaction is defined like this:
<bean id="wsJtaTm"
class="org.springframework.transaction.jta.WebSphereTransactionManagerFactoryBean" />
<bean id="transactionManager"
class="org.springframework.transaction.jta.JtaTransactionManager">
<property name="transactionManager" ref="wsJtaTm" />
</bean>
I don't understand why the app would work when Java2 security is turned off, and why would it throw ClassNotFound exception when i turn the java2 security on.
According to my knowledge, com.ibm.ws.Transaction.TransactionManagerFactory should be loaded by server itself and should be made available to the app. i don't have any jar in my app having this class.
The error is originating from the constructor of bean id wsJtaTm. Am I missing something in was.policy file?
On further research, i found that this class is present inside a jar file named com.ibm.ws.runtime.jar in the plugins folder of server installation. I don't understand why this jar becomes in-visible when java2 security is turned on.
Please note I am using spring v2.5
Kindly help.
The com.ibm.ws.Transaction.TransactionManagerFactory class is not API, and WebSphere Application Server restricts access to non-API classes when Java 2 security is enabled (if applications could access internal classes, they could easily circumvent Java 2 security). Try using Spring's org.springframework.transaction.jta.WebSphereUowTransactionManager, which uses the supported UOWManager API.

Resources