How to run Vaadin 7 applications in Karaf? - osgi

I have been looking for days now, with lots of experiments, for an answer to this question. What do I need to do to be able to run applications, using version 7 of Vaadin Web framework, inside Karaf?
There are some information about it but none of the solutions I read worked. The only related question I found on SO (How to integrate Vaadin 7 with OSGi?) does not really have an valid answer, at least for my question. Every time I follow a solution found by googling I always get lots of missing dependencies and I found myself indefinitely searching and installing bundles in order to satisfy all the imports.
This cannot be so hard to achieve. Is there anyone that can give me some guidelines or indicate a good source with the answer to my question?

This is a working features.xml:
<?xml version="1.0" encoding="UTF-8"?>
<features xmlns="http://karaf.apache.org/xmlns/features/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.0.0 http://karaf.apache.org/xmlns/features/v1.0.0"
name="vaadin7-feature">
<feature install="true" name="vaadin7-feature" version="1.0.0-SNAPSHOT">
<feature>vaadin7-common</feature>
<bundle>mvn:com.vaadin/vaadin-themes/7.3.0</bundle>
<bundle>mvn:com.vaadin/vaadin-shared/7.3.0</bundle>
<bundle>mvn:com.vaadin/vaadin-server/7.3.0</bundle>
<bundle>mvn:com.vaadin/vaadin-client/7.3.0</bundle>
<bundle>mvn:com.vaadin/vaadin-client-compiled/7.3.0</bundle>
<bundle>mvn:com.vaadin/vaadin-push/7.3.0</bundle>
<bundle>mvn:com.vaadin/vaadin-sass-compiler/0.9.2</bundle>
</feature>
<feature name="vaadin7-common" version="1.0.0-SNAPSHOT">
<bundle>mvn:com.vaadin.external.google/android-json/0.0.20131108.vaadin1</bundle>
<bundle>mvn:org.jbundle.util.osgi.wrapped/org.jbundle.util.osgi.wrapped.c3p0/0.9.1.2</bundle>
<bundle>mvn:org.quartz-scheduler/quartz/2.2.1</bundle>
<bundle>mvn:joda-time/joda-time/2.4</bundle>
<bundle>wrap:mvn:org.springframework/spring-core/3.2.6.RELEASE$Bundle-SymbolicName=Spring-Framework&Bundle-Version=3.2.6.RELEASE</bundle>
<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.xpp3/1.1.4c_7</bundle>
<bundle>mvn:com.google.guava/guava/16.0.1</bundle>
<bundle>mvn:io.netty/netty/3.9.0.Final</bundle>
<bundle>mvn:org.apache.commons/commons-lang3/3.3.2</bundle>
<bundle>mvn:com.vaadin.external.flute/flute/1.3.0.gg2</bundle>
<bundle>mvn:com.vaadin.external.streamhtmlparser/streamhtmlparser-jsilver/0.0.10.vaadin1</bundle>
<bundle>mvn:com.vaadin.external.google/guava/16.0.1.vaadin1</bundle>
<bundle>mvn:org.eclipse.jetty.orbit/javax.servlet/3.0.0.v201112011016</bundle>
<bundle>wrap:mvn:org.w3c.css/sac/1.3$Bundle-SymbolicName=org-w3c-css-sac&Bundle-Version=1.3</bundle>
<bundle>mvn:org.jsoup/jsoup/1.6.3</bundle>
<bundle>mvn:com.vaadin.external.slf4j/vaadin-slf4j-jdk14/1.6.1</bundle>
<bundle>mvn:com.vaadin.external.atmosphere/atmosphere-runtime/2.1.2.vaadin3</bundle>
<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.gwt-dev/2.4.0_1</bundle>
<bundle>mvn:org.apache.commons/commons-jexl/2.1.1</bundle>
<bundle>mvn:com.vaadin.external.json/json/0.0.20080701</bundle>
<bundle>wrap:mvn:javax.validation/validation-api/1.0.0.GA$Bundle-SymbolicName=validation-api&Bundle-Version=1.0.0.GA</bundle>
<bundle>wrap:mvn:net.sourceforge.cssparser/cssparser/0.9.11$Bundle-SymbolicName=cssparser&Bundle-Version=0.9.11</bundle>
</feature>
</features>
Let me know if it helps you.

This method will install Vaadin 7.6.8 to your Karaf 2.4.3.
Save below file somewhere
Open the Karaf shell
features:addurl file:///path/to/your/features.xml
features:install vaadin
This will install Vaadin as a feature to your Karaf installation.
features.xml
<?xml version="1.0" encoding="UTF-8"?>
<features xmlns="http://karaf.apache.org/xmlns/features/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.0.0 http://karaf.apache.org/xmlns/features/v1.0.0"
name="vaadin">
<feature install="true" name="vaadin" version="7.6.8">
<feature>vaadin-common</feature>
<bundle>mvn:com.vaadin/vaadin-themes/7.6.8</bundle>
<bundle>mvn:com.vaadin/vaadin-server/7.6.8</bundle>
<bundle>mvn:com.vaadin/vaadin-sass-compiler/0.9.13</bundle>
<bundle>mvn:com.vaadin/vaadin-shared/7.6.8</bundle>
<bundle>mvn:com.vaadin/vaadin-push/7.6.8</bundle>
<bundle>mvn:com.vaadin/vaadin-client/7.6.8</bundle>
<bundle>mvn:com.vaadin/vaadin-client-compiled/7.6.8</bundle>
</feature>
<feature name="vaadin-common" version="7.6.8">
<bundle>mvn:com.vaadin.external.flute/flute/1.3.0.gg2</bundle>
<bundle>mvn:com.vaadin.external.streamhtmlparser/streamhtmlparser-jsilver/0.0.10.vaadin1</bundle>
<bundle>mvn:com.vaadin.external.google/guava/16.0.1.vaadin1</bundle>
<bundle>mvn:com.vaadin.external.atmosphere/atmosphere-runtime/2.2.7.vaadin1</bundle>
<bundle>mvn:com.vaadin.external.flute/flute/1.3.0.gg2</bundle>
<bundle>mvn:org.jsoup/jsoup/1.8.3</bundle>
<bundle>mvn:javax.portlet/portlet-api/2.0</bundle>
<bundle>mvn:com.vaadin.external.slf4j/vaadin-slf4j-jdk14/1.6.1</bundle>
<bundle>wrap:mvn:javax.validation/validation-api/1.0.0.GA$BundleSymbolicName=javax-validation-api&Bundle-Version=1.0.0.GA</bundle>
<bundle>wrap:mvn:com.google.appengine/appengine-api-1.0-sdk/1.7.7$BundleSymbolicName=com-google-appengine-api-1.0-sdk&Bundle-Version=1.7.7</bundle>
<bundle>wrap:mvn:com.liferay.portal/portal-service/6.0.2$Bundle-SymbolicName=com-liferay-portal-service&Bundle-Version=6.0.2</bundle>
<bundle>wrap:mvn:org.w3c.css/sac/1.3$Bundle-SymbolicName=org-w3c-css-sac&Bundle-Version=1.3</bundle>
<bundle>wrap:mvn:com.yahoo.platform.yui/yuicompressor/2.4.8$Bundle-SymbolicName=com-yahoo-platform-yui-compressor&Bundle-Version=2.4.8</bundle>
</feature>
</features>

The easiest option for me was simply to use karaf's war deployer. It allows to simply deploy war into karaf, without having to write XML or other osgi whatnot. I have described the steps here: http://mavi.logdown.com/posts/7813065-deploying-vaadin-app-on-karaf

Related

How to set shared-session-context true by default

I've a Maven EAR with some modules that need to share the session context.
So when I run it on Liberty Server (on Eclipse) I've to add in the "Server Configuration" the application extension and set the shared-session-context flag to true.
I guess how can I set it by default, maybe in the pom.xml? I can find any information about it.
Thanks.
The recommended practice is to have in your source repo server.xml that is required for your application, and have all the required settings there. Then your maven build creates also Liberty server with your config and deploys app there.
If you dont want to store that in the server config file, you can add ibm-application-ext.xml file to your EAR/META-INF folder, with shared session enabled like this:
ibm-application-ext.xml contents:
<?xml version="1.0" encoding="UTF-8"?>
<application-ext xmlns="http://websphere.ibm.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-application-ext_1_1.xsd"
version="1.1">
<shared-session-context value="true"/>
</application-ext>

Apache Karaf feature prerequisite

Karaf 4.0.3
I have the following pseudo-feature:
<features name="my-feature" xmlns="http://karaf.apache.org/xmlns/features/v1.3.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.3.0 http://karaf.apache.org/xmlns/features/v1.3.0">
<feature name="C" version="${project.version}" start-level="25" install="auto">
<bundle start-level="25">...BundleC1...</bundle>
</feature>
<feature name="A" version="${project.version}" start-level="30" install="auto">
<feature prerequisite="true">C</feature>
<bundle start-level="30">...BundleA1...</bundle>
</feature>
<feature name="B" version="${project.version}" start-level="35" install="auto">
<feature prerequisite="true">C</feature>
<bundle start-level="35">...BundleB1...</bundle>
</feature>
C is independant
A depends on C
B depends on C
In this example the bundle 'BundleB1' imports wrong major version of 'BundleC1' and we get the "missing requirement" error (as expected). However if I log into the karaf console and run 'feature:list' I will see that C is Started, A is Uninstalled and B is Uninstalled.
I expect A to be Started since it only has dependencies to C. A will start fine if I comment out the entire C feature or if I afterwards run feature:install A
If I put each of these three features in seperate feature.xml files I get the expected outcome of C+A as Started and B as Uninstalled.
What am I doing wrong?
Am I misunderstanding how the prerequisite attribute works? As a sidenote, if I skip the prerequisite attribute all together then no feature will get installed whatsover...
This is the expected behavior in Karaf 4 : Karaf creates one subsystem with all the features to install. This subsystem is resolved in one pass : either it success or it fails, as a whole.
The prerequisite attribute tells Karaf to install this feature in an independent subsystem : All the bundles are installed and started before trying to resolve the others features.
In your case :
C is installed/started ;
A+B is resolved, but it fails

No resource identifier found for attribute 'MvxBind' in package in Xamarin Android app

I'm using Xamarin Studio v5.10.1 and Xamarin Android v6.0.0.34 and MvvmCross v3.5.1.
I keep getting this error message when I build the solution:
No resource identifier found for attribute 'MvxBind' in package my.package
I've seen all the question in stack overflow regarding this error but nothing helped.
Here is what I tried:
Clean everything and rebuild
Used res-auto instead of my package name
Upgrade to the latest Mono Android
It seems that the file MvxBindingAttributes.xml is not copied to the Resources/Values folder. I assume it is supposed to be extract from Cirrious.MvvmCross.Binding.Droid.dll but somehow it doesn't.
I also tried creating the MvxBindingAttributes.xml file myself in the right place. It fixed the compilation error but a runtime error complaining about the same thing (resource id's not found).
Adding the MvxBindingAttributes.xml to the Resources/values folder in the solution worked for me.
https://github.com/MvvmCross/MvvmCross/blob/3.5/Cirrious/Cirrious.MvvmCross.Binding.Droid/Resources/values/MvxBindingAttributes.xml
I am also using xmlns:local="http://schemas.android.com/apk/res-auto" in the axml file
For me, my namespace in the XAML wasn't defined correctly...
I had:
xmlns:local="http://schemas.android.com/apk/res/AndroidApp1.Resource"
...
local:MvxBind
But the namespace of my app (in project properties) was AndroidApp1.AndroidApp1 (its a PoC :)).
So when I fixed that - it all worked:
xmlns:local="http://schemas.android.com/apk/res/AndroidApp1.AndroidApp1"
...
local:MvxBind
In my case, I mistyped the package name in the android manifest. Ensure that your xmlns:local attribute in the .axml file match the package name.
YOUR-PACKAGE-NAME must be the same here...
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res/YOUR-PACKAGE-NAME"
android:layout_width="match_parent"
android:layout_height="match_parent">
and here
Hope it helps
OK. I just checked. It doesn't seem like the NuGet actually installs MvxBindingAttributes.xml into the Resources\values folder. So you have to create it yourself:
The contents need to be this: https://github.com/MvvmCross/MvvmCross/blob/3.5/Cirrious/Cirrious.MvvmCross.Binding.Droid/Resources/values/MvxBindingAttributes.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="MvxBinding">
<attr name="MvxBind" format="string"/>
<attr name="MvxLang" format="string"/>
</declare-styleable>
<declare-styleable name="MvxControl">
<attr name="MvxTemplate" format="string"/>
</declare-styleable>
<declare-styleable name="MvxListView">
<attr name="MvxItemTemplate" format="string"/>
<attr name="MvxDropDownItemTemplate" format="string"/>
</declare-styleable>
<declare-styleable name="MvxExpandableListView">
<attr name="MvxGroupItemTemplate" format="string"/>
</declare-styleable>
<item type="id" name="MvxBindingTagUnique"/>
<declare-styleable name="MvxImageView">
<attr name="MvxSource" format="string"/>
</declare-styleable>
</resources>
EDIT:
This information is not valid for MvvmCross 4.x where MvxBindingAttributes.xml is included in the MvvmCross.Binding package. This means, that it is no longer necessary to include this file yourself or through a NuGet into your project.
I know this question is real old but if you are having this error in Xamarin Studio version 6.1.5 and MvvmCross version 4.4.0 make sure you are creating a "Blank Android App" instead of a "Android App" This makes sure that no packages are included by default that will not play with with MvvmCross off the bat.
Try adding a reference from Manage NuGet Packages and from the search tap write MvvmCross.Bind and then install it.
I know it is old topic but I found another solution.
When you create new project remember to name core: name.Core and android app: name.Droid . It solved all my problems.

Mule maven build updating config.resource property of mule-deploy.properties failed for a newly created mule project which was not deployed anytime

I have use case to build a mule project using maven and i experienced a scenario where if a new mule project created in mule studio with multi flows which was not run/deployed anytime.
I performed a maven build for the mule project There were two observations
1) when the mule build deployed in mule stand alone it got deployment failure with error
org.mule.module.launcher.InstallException: Config for app ...not found....mule-config.xml.
2)when i checked the config.resource property of mule-deploy.properties was not assigned(config.resources=) with flow config file .
Please let me know any suggestions where i am going wrong.
The easiest thing to do is just update the property with the name of the config xml in mule-deploy.properties.
config.resources=my-projects-config.xml
1) Go to <>/src/main/app/mule-deploy.properties, verify config.resources=test.xml<>. If any other files are assigned, remove it.
or
2) Keep a dummy mule-config.xml in the directory src/main/app
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.0/mule.xsd">
<!-- empty config to avoid the hot deployment classloader choking on a missing config file -->
</mule>
Although we create a "default" application in the "apps" folder, it's empty and thus hot deploy complains about a missing mule-config.xml file

Is there a way to specify one artifactsDirectory for the whole site in CruiseControl.Net?

so from what i can tell, you have to specify artifacts and working directory per project, every time.
I guess I'm looking for a way to move the cc.net project name folder to other than where the server was launched from, so that I can do something like:
<cruisecontrol xmlns:cb="urn:ccnet.config.builder">
<!-- something like this should exist
<baseDirectory>D:\Integration</baseDirectory>
-->
<project name="MyProject1">
<workingDirectory>D:\Integration\working\MyProject1</workingDirectory>
<artifactDirectory>D:\Integration\artifacts\MyProject1</artifactDirectory>
<state type="state" directory="D:\Integration\state\MyProject1" />
</project>
<project name="MyProject2">
<workingDirectory>D:\Integration\working\MyProject2</workingDirectory>
<artifactDirectory>D:\Integration\artifacts\MyProject2</artifactDirectory>
<state type="state" directory="D:\Integration\state\MyProject2" />
</project>
</cruisecontrol>
Then, I won't have to specify these directories separately for each project. They will just get created under the project name under some default folder structure based on - i.e. D:\Integration\working\ being the base for
Ever thought about using preprocessor commands?
<cruisecontrol xmlns:cb="urn:ccnet.config.builder">
<cb:define name="project.template">
<project name="$(project.name)">
<workingDirectory>D:\Integration\working\$(project.name)</workingDirectory>
<artifactDirectory>D:\Integration\artifacts\$(project.name)</artifactDirectory>
<state type="state" directory="D:\Integration\state\$(project.name)" />
</project>
</cb:define>
<cb:project.template project.name="MyProject1" />
<cb:project.template project.name="MyProject2" />
</cruisecontrol>
OK, now I see. I don't think currently there is a way to do that, but would be a good feature. You should go to the google group ccnet-devel and post a message there as a feature request. I too, could use this. Good Idea.

Resources