How to make a wso2 enterprise integrator custom mediator with dependencies - mediator

When I make a custom mediator in wso2 enterprise integrator, I compile it without dependencies (in maven), because if I do with that, then wso2 not run, because that dependencies included, break wso2.
I'd like to make a wso2 mediator whith its own dependencies. How can I do It?

You have to create your mediator as osgi bundle (don't let ei convert it to osgi because then it will bind the wrong classes). I've had a similar issue where I had to use another version of javax.xml.crypto in my mediator. I therefor modified the pom.xml like this and build the mediator.
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.4</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>smybolicName</Bundle-SymbolicName>
<Bundle-Name>bundleName</Bundle-Name>
<Import-Package>
!javax.xml.crypto.*; version="1.4.2.patched",
org.apache.xml.security;version="0.0.0",
*
</Import-Package>
</instructions>
</configuration>
</plugin>
Hope that helps.

Related

Vaadin: Reduce package.json to the only used dependencies in production mode

We're using in our project BlackDuck from Synopsis to identify the licenses of our used dependencies. There is actualy an small issue with Vaadin: When we build the frontend - based on Vaadin Core - in production mode the package.json is stuffed with a lot more dependencies than we use. And it includes also features from the pro-version. Since the detect-script for BlackDuck scans this package.json we get a lot of "false-positives". So is there a way of reducing the package.json to the only required dependencies by creating the build via Vaadin? As far as i could see the package.json will be always overwritten, when starting the build. Of course i can "hack" the package.json afterwards with a script, but this is not the way i look for.
Here is our profile for creating the "production ready" frontend sources:
<profile>
<id>production-mode</id>
<build>
<plugins>
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>build-frontend</goal>
</goals>
<phase>compile</phase>
</execution>
</executions>
<configuration>
<productionMode>true</productionMode>
</configuration>
</plugin>
</plugins>
</build>
</profile>
Thanks for your help in advance!
Update: This response was based on speculation rather than how things actually work.
The dependencies that Vaadin generates into package.json are based on the Java dependencies that are defined through Maven or Gradle.
If you want to have all the free components but want to avoid the commercial ones, then you can just change the com.vaadin:vaadin dependency to com.vaadin:vaadin-core. If you want to be even more granular, then you can either exclude the ones you don't want or build your own platform by including only the things you think you need out of the dependencies listed in https://mvnrepository.com/artifact/com.vaadin/vaadin-core/23.0.8.

GeoServer OAuth 2.0

Is anyone out there using OAuth to authenticate GeoServer users? I've been through installing and configuring this extension. I've tried Google and GitHub providers. I end up with a 404 error trying to access the login page. Same issue as here. There are no errors in the log with the debug level elevated as suggested.
Answering my own question here...
For me the 404 problem solved by building from source and accounting for the required dependencies using a maven plugin. Previously, I was attempting to use the prebuilt binaries and lib/ depedencies.
I built the modules from source (2.18.3) and modified the file maven file to copy the dependencies to the target folder, which I then copied to WEB-INF/lib.
Here is the pom file addition I made to get the dependencies.
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/classes/lib</outputDirectory>
<includeScope>runtime</includeScope>
</configuration>
</execution>
</executions>
</plugin>
</plugins>

Spring cloud data flow custom application properties

I created a custom spring cloud data flow application.
I would like to create a stream with it and put some application properties in it, as we can add for the provided application log (0/3 properties):
I tried with application.yml file in resources folder:
spring:
application:
toto: 'titi'
but it didn't work.
I also tried to create some Properties.class
public class Properties {
//public static final String PREFIX = "portin";
private String toto;
public Properties(String toto) {
this.toto = toto;
}
public Properties() {
}
public String getToto() {
return toto;
}
public void setToto(String toto) {
this.toto = toto;
}
}
and add the folowing declaration in dataflow-configuration-metadata-whitelist.properties file:
configuration-properties.classes=com.mycompany.Properties
but that was not a success and the aplication doesn't have any property.
I couldn't find anything relevant in documentation (I am not English speaking native so I may have misread something).
Thanks for helping
EDIT after moving dataflow-configuration-metadata-whitelist.properties in META-INF folder
the whitelist property files were not under META-INF folder.
Now I have this project:
but it doesn't help. The pom.xml is:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-app-starter-metadata-maven-plugin</artifactId>
<executions>
<execution>
<id>aggregate-metadata</id>
<phase>compile</phase>
<goals>
<goal>aggregate-metadata</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
then I build the application with docker. Is there something docker specific to do then?
I could read the documentation but cannot see what is missing on my project
For the custom application properties, you can make sure if you follow Spring Boot configuration properties configuration correctly. You can see some of the examples from the out of the box apps here
I am not sure which version of SCDF do you use. If you are on the release before SCDF 2.x, then the name of the whitelist properties needs to be spring-configuration-metadata-whitelist.properties as the whitelist properties file with the name dataflow-configuration-metadata-whitelist.properties is supported only from SCDF 2.x.
Also, make sure to place the whitelist properties file into /META-INF directory under classpath (src/main/resources directory) for example here.
Regarding the documentation, please follow the instructions mentioned here in the SCDF documentation.
I could do the job thanks to this post: Spring Cloud Dataflow Kubernetes get properties of jar from dockerfile
The way I registered the app was wrong.
Now, I add the companion metadata URI and it works

Failed to read artifact descriptor for org.apache.maven.plugins:maven-source-plugin:jar:2.4

Thanks to a Dropwizard Maven archetype I generated a sample Dropwizard Maven project. The pom.xml notably uses maven-source-plugin:
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
When I run "clean install" I have the following error :
Plugin org.apache.maven.plugins:maven-source-plugin:2.4 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-source-plugin:jar:2.4: Could not transfer artifact org.apache.maven.plugins:maven-source-plugin:pom:2.4 from/to central (http://repo.maven.apache.org/maven2): Connection refused: connect -> [Help 1]
The "maven-source-plugin" dependency is stored in the Nexus repository of my company. So I tried the adding of the plugin dependency between dependencies and /dependencies :
<dependencies>
...
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.4</version>
</dependency>
</dependencies>
but it did not correct the problem. I also tried to add the dependency at the call of the plugin :
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.4</version>
</dependency>
</dependencies>
</plugin>
but it did not work either
Two possible situations :
Your company uses a proxy to connect to the public Maven repository. Then ask someone in your company what the IP address of the proxy is then put it in your settings.xml file
Your company has its/their own Maven repository/ies (Nexus repository for example). Then ask someone in your company what the Nexus repository is then put it in your pom.xml or in your settings.xml. See Adding maven nexus repo to my pom.xml and https://maven.apache.org/guides/mini/guide-multiple-repositories.html
It may happen, e.g. after an interrupted download, that Maven cached a broken version of the referenced package in your local repository.
Solution: Manually delete the folder of this plugin from cache (i.e. your local repository), and repeat maven install.
How to find the right folder? Folders in Maven repository follow the structure:
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.4</version>
</dependency>
is cached in ${USER_HOME}\.m2\repository\org\apache\maven\plugins\maven-source-plugin\2.4
Update the apache-maven-3.5.0-bin\apache-maven-3.5.0\conf\settings.xml file.
Check your internet explorer proxy --> Setting --> Internet explorer -->Connection --> LAN Setting
<proxy>
<id>optional</id>
<active>true</active>
<protocol>http</protocol>
<username>user</username>
<password>****</password>
<host>proxy</host>
<port>8080</port>
</proxy>
I am using JDK 7 for maven project and I used -Dhttps.protocols=TLSv1.2 as argument in JRE. It has allowed to download all maven repository which were failing earlier.
org.apache.maven.plugins:maven-source-plugin does not exist in the repository http://repo.maven.apache.org/maven2.
You have to download it from Maven central where it exists => maven-source-plugin
Verify your pom definition or your settings.xml file.
so I am assuming that this project you are doing in your private eclipse (not company provided eclipse where you work). The same problem I resolved just as below
quick fix : got to .m2 file --> create a backup of settings.xml --> remove settings.xml --> restart your eclipse.
On my side it was coming from an error in my settings.xml file.
I had a bad tag. Just removed it, refreshed and i was good to go.
Remove the content of the folder \.m2\repository\org\apache\maven\plugins\maven-resource-plugin\2.7. The cached info turned out to be the issue.
I use intelliJ and finally I created my own settings.xml and added the following content structure to it. In my project's pom.xml, the nexus repositories were defined but for some reason it was always hitting the external apache maven repo which is blocked in my company.
<settings>
<mirrors>
<id>nexus</id>
<url>nexusURL </url>
<mirrorOf>central</mirrorOf>
<mirror>
<profiles>
<profile>
<repositories>
<repository>
</settings>

How to create JAXWS web service server skeletons from wsdl ( not in IDE)

i can't find any where how to create web service from server skeletons ( java pojo's )from
wsdl using JAXWS. The only tutorials I see are using automated wizard in NetBeans and and axis2 in eclipse. Can someone please give me hints on how to generate server side classes from given wsdl?
Thanks
UPADATE:
I just need to do :
wsimport.bat -Xendorsed SOAP.WSDL
and it creates the artifacts.
But now how do I implement it in the server ?
In addition to client side classes, wsimport also generates a SEI (Service Endpoint Interface). All you need to do is creating an implementation for that.
Then it should be ready for deployment in your application server.
Answer extended:
If you are using Metro, this is a tutorial on how to map your SEI and SIB (Service Implementation Bean) to the config files and get it ready for deployment.
You can do this using wsdl2j during build phases using maven or ant. Also quite good is the cxf codegen plugin for maven.
As pointed out by kevin, this can be done with cxf. They also maintain a maven plugin.
Here's an example on how to generate a server side implementation skeleton:
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>2.7.7</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>src/main/gen</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>src/main/webapp/WEB-INF/wsdl/yourWsdl.wsdl
</wsdl>
<wsdlLocation>classpath:wsdl/yourWsdl.wsdl</wsdlLocation>
<!-- Generate WS impl Skeleton -->
<extraargs>
<extraarg>-impl</extraarg>
</extraargs>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
The -impl option will create a skeleton impl class that provides a basic implementation for your #WebService interface on the server side (provider). Note that this also create a Service class (consumer/client side).

Resources