GRPC client is not working - grpc

when i'm running the grpc client i'm getting the following error.my grpc-server is working well ....................................................................................................................................................
mvn exec:java -Dexec.mainClass="com.example.grpc.client.MyGrpcClient.java" -e
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Detecting the operating system and CPU architecture
[INFO] ------------------------------------------------------------------------
[INFO] os.detected.name: linux
[INFO] os.detected.arch: x86_64
[INFO] os.detected.release: ubuntu
[INFO] os.detected.release.version: 14.04
[INFO] os.detected.release.like.ubuntu: true
[INFO] os.detected.release.like.debian: true
[INFO] os.detected.classifier: linux-x86_64
[WARNING] Failed to inject repository session properties.
java.lang.NoSuchMethodError: org.apache.maven.execution.MavenSession.getRepositorySession()Lorg/eclipse/aether/RepositorySystemSession;
at kr.motd.maven.os.RepositorySessionInjector.injectRepositorySession(RepositorySessionInjector.java:22)
at kr.motd.maven.os.DetectExtension.injectSession(DetectExtension.java:148)
at kr.motd.maven.os.DetectExtension.afterProjectsRead(DetectExtension.java:107)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:274)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
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:497)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building simple-grpc-client 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- exec-maven-plugin:1.5.0:java (default-cli) # simple-grpc-client ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.591s
[INFO] Finished at: Wed Mar 01 14:50:54 IST 2017
[INFO] Final Memory: 10M/212M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.5.0:java (default-cli) on project simple-grpc-client: Execution default-cli of goal org.codehaus.mojo:exec-maven-plugin:1.5.0:java failed: Invalid classpath scope: tuomas -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.5.0:java (default-cli) on project simple-grpc-client: Execution default-cli of goal org.codehaus.mojo:exec-maven-plugin:1.5.0:java failed: Invalid classpath scope: tuomas
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:225)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
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:497)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-cli of goal org.codehaus.mojo:exec-maven-plugin:1.5.0:java failed: Invalid classpath scope: tuomas
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:110)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
Caused by: java.lang.IllegalStateException: Invalid classpath scope: tuomas
at org.codehaus.mojo.exec.AbstractExecMojo.collectProjectArtifactsAndClasspath(AbstractExecMojo.java:118)
at org.codehaus.mojo.exec.ExecJavaMojo.addRelevantProjectDependenciesToClasspath(ExecJavaMojo.java:607)
at org.codehaus.mojo.exec.ExecJavaMojo.getClassLoader(ExecJavaMojo.java:528)
at org.codehaus.mojo.exec.ExecJavaMojo.execute(ExecJavaMojo.java:308)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
... 20 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecution
I am using maven here.I will be much appreciated if you can help me............
here is my pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2016 Google, Inc.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>grpc-demos</artifactId>
<groupId>com.example</groupId>
<version>1.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>simple-grpc-client</artifactId>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>simple-grpc-server</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.reactivex</groupId>
<artifactId>rxjava</artifactId>
<version>1.1.5</version>
</dependency>
</dependencies>
</project>
it is taking dependencies from server. i changed it as follows to get dependencies by its own.
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2016 Google, Inc.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>grpc-demos</artifactId>
<groupId>com.example</groupId>
<version>1.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>simple-grpc-client</artifactId>
<dependencies>
<dependency>
<groupId>io.reactivex</groupId>
<artifactId>rxjava</artifactId>
<version>1.1.5</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<type>maven-plugin</type>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-netty</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-protobuf</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-stub</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
<build>
<extensions>
<extension>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>1.4.1.Final</version>
</extension>
</extensions>
<plugins>
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
<version>0.5.0</version>
<configuration>
<!--
The version of protoc must match protobuf-java. If you don't depend on
protobuf-java directly, you will be transitively depending on the
protobuf-java version that grpc depends on.
-->
<protocArtifact>com.google.protobuf:protoc:3.0.0:exe:${os.detected.classifier}</protocArtifact>
<pluginId>grpc-java</pluginId>
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.0.0:exe:${os.detected.classifier}</pluginArtifact>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>compile-custom</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

well.i've just figured out the problem you have.
i select my maven version from nested one 3.05 to 3.39,and it work out properly.
pay attention,even if you got 3.39 in your terminal when you writemvn --version,it doesn't mean that you are using mvn 3.39,you should set it in your settings,and then you are really using maven of a version 3.39.

Related

Creating an executable fat jar with dependencies (gradle or maven)

I have a very simple program that just produces a JTable that is populated via a predetermined ResultSet, it works fine inside the ide, (intelliJ). It only has the one sqlite dependency.
I'm trying to get an standalone executable jar out of it that spits out the same table.
I did the project on gradle as that was the most common result when looking up fat jars.
The guides did not work at all but i did eventually end up on here.
Gradle fat jar does not contain libraries
running "gradle uberJar" on the terminal did produce a jar but it doesn't run when double clicked and running the jar on the cmd line produces:
no main manifest attribute, in dbtest-1.0-SNAPSHOT-uber.jar
here is the gradle build text:
plugins {
id "java"
}
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
}
dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
implementation 'org.xerial:sqlite-jdbc:3.34.0'
}
test {
useJUnitPlatform()
}
task uberJar(type: Jar) {
archiveClassifier = 'uber'
from sourceSets.main.output
dependsOn configurations.runtimeClasspath
from {
configurations.runtimeClasspath.findAll { it.name.endsWith('jar') }.collect { zipTree(it) }
}
}
I then tried the same project on maven but with less success
How to make jar file with all dependencies a.k.a. Fat jar with IntelliJ
Fat JAR not working. "No Main Manifest Attribute". Tried POM file, still failing
with with the answers from here (and other places), running mvn clean package on the command line yields
> [INFO] BUILD FAILURE [INFO]
> ------------------------------------------------------------------------ [INFO] Total time: 1.814 s [INFO] Finished at:
> 2021-06-12T14:35:07-06:00 [INFO]
> ------------------------------------------------------------------------ [ERROR] Failed to execute goal
> org.apache.maven.plugins:maven-compiler-plugin:3.1:compile
> (default-compile) on project mvDB: Fatal error compiling: error:
> invalid target release: 16 -> [Help 1] [ERROR] [ERROR] To see the full
> stack trace of the errors, re-run Maven with the -e switch. [ERROR]
> Re-run Maven using the -X switch to enable full debug logging. [ERROR]
> [ERROR] For more information about the errors and possible solutions,
> please read the following articles: [ERROR] [Help 1]
> http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
i can't run the command on the terminal in intelliJ either.
here is the pom
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>groupId</groupId>
<artifactId>mvDB</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>16</maven.compiler.source>
<maven.compiler.target>16</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.34.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>test.Main</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Admittedly, I don't really much of this works, I'm only trying to get from a code working on the idea to a program that i can run, however simple it may be. And hopefully I can apply it for creating a fat Jar with dependencies on a larger program.
You can add a manifest to your task since it is type Jar. Specifying an entrypoint with the Main-Class attribute should make your Jar executable.
task uberJar(type: Jar) {
manifest {
attributes 'Main-Class': 'your.main.class.goes.here'
}
archiveClassifier = 'uber'
from sourceSets.main.output
dependsOn configurations.runtimeClasspath
from {
configurations.runtimeClasspath.findAll { it.name.endsWith('jar') }.collect { zipTree(it) }
}
}

"No versions available for io.grpc:grpc-core:jar:[1.13.1] within specified range" error when I add firebase-admin maven dependency in Eclipse

I am trying to add firebase-admin dependency in my pom.xml :
<dependency>
<groupId>com.google.firebase</groupId>
<artifactId>firebase-admin</artifactId>
<version>6.6.0</version>
</dependency>
But when I try to build my project using "clean install" command, I get following error :
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Communication Manager 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] Downloading: http://192.168.1.4:8081/artifactory/libs-release/com/google/firebase/firebase-admin/6.6.0/firebase-admin-6.6.0.pom
[INFO] Downloaded: http://192.168.1.4:8081/artifactory/libs-release/com/google/firebase/firebase-admin/6.6.0/firebase-admin-6.6.0.pom (21 KB at 44.6 KB/sec)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.498 s
[INFO] Finished at: 2019-01-02T11:43:59+05:30
[INFO] Final Memory: 14M/308M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project communicationmgr: Could not resolve dependencies for project com.example.server:communicationmgr:jar:0.0.1-SNAPSHOT: Failed to collect dependencies at com.google.firebase:firebase-admin:jar:6.6.0 -> com.google.cloud:google-cloud-firestore:jar:0.61.0-beta -> com.google.cloud:google-cloud-core-grpc:jar:1.43.0 -> io.grpc:grpc-netty-shaded:jar:1.13.1 -> io.grpc:grpc-core:jar:[1.13.1]: No versions available for io.grpc:grpc-core:jar:[1.13.1] within specified range -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
I tried by explicitly adding the dependency for grpc-core :
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-core</artifactId>
<version>1.13.1</version>
</dependency>
This jar got downloaded to my local repository, but still the same error persists for firebase-admin.
How can I overcome this error?
I had the same issue. I was able to resolve it by deleting the maven-metadata out of the local repo directories (for the relevant dependencies).
i.e:
user_dir\.m2\repository\io\grpc\grpc-api
maven-metadata-central.xml
maven-metadata-central.xml.sha1
resolver-status.properties
I solved this by overriding grpc-core in dependency management:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-core</artifactId>
<version>1.13.1</version>
</dependency>
<dependency>
<groupId>com.google.firebase</groupId>
<artifactId>firebase-admin</artifactId>
<version>6.6.0</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.firebase</groupId>
<artifactId>firebase-admin</artifactId>
</dependency>
</dependencies>
The order is important. Hope this helps.

Karaf 4.0.4: Custom distribution - karaf-maven-plugin

I am trying to build a custom distribution by adding eventadmin and scr features to startup features.
I have tried the following based on the official documentation at http://karaf.apache.org/manual/latest/developers-guide/custom-distribution.html.
I have created a new project with the following pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.jemz.jf.karaf</groupId>
<artifactId>jf-framework-karaf</artifactId>
<packaging>karaf-assembly</packaging>
<name>${project.artifactId}</name>
<dependencies>
<dependency>
<groupId>org.apache.karaf.features</groupId>
<artifactId>framework</artifactId>
<version>4.0.4</version>
<type>kar</type>
</dependency>
<dependency>
<groupId>org.apache.karaf.features</groupId>
<artifactId>standard</artifactId>
<version>4.0.4</version>
<classifier>features</classifier>
<type>xml</type>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>karaf-maven-plugin</artifactId>
<version>4.0.4</version>
<extensions>true</extensions>
<configuration>
<!-- no startupFeatures -->
<startupFeatures>
<feature>eventadmin</feature>
<feature>scr</feature>
</startupFeatures>
<installedFeatures>
</installedFeatures>
<bootFeatures>
<feature>standard</feature>
</bootFeatures>
<excludedArtifactIds>
<artifactId>slf4j-api</artifactId>
</excludedArtifactIds>
</configuration>
</plugin>
</plugins>
</build>
Unfortunately when I run 'mvn install' it fails with:
[ERROR] Failed to execute goal org.apache.karaf.tooling:karaf-maven-plugin:4.0.4:assembly (default-assembly) on project jf-framework-karaf: Unable to build assembly: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=scr; type=karaf.feature; filter:="(&(osgi.identity=scr)(type=karaf.feature))" -> [Help 1]
If I move the 'eventadmin'and 'scr' features to 'bootFeatures', although that is not what I originally wanted, the custom karaf distribution is assembled ok, but when I started it returns some exceptions as shown below:
jmartinez#archlinux-dev-64 target]$ ./jf-framework-karaf-3.0.0-SNAPSHOT/bin/karaf
__ __ ____
/ //_/____ __________ _/ __/
/ ,< / __ `/ ___/ __ `/ /_
/ /| |/ /_/ / / / /_/ / __/
/_/ |_|\__,_/_/ \__,_/_/
Apache Karaf (4.0.4)
Hit '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown Karaf.
karaf#root()> org.apache.karaf.features.core[org.apache.karaf.features.internal.service.BootFeaturesInstaller] : Error installing boot features
org.apache.karaf.features.internal.util.MultiException: Error restarting bundles
at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:848)
at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1089)
at org.apache.karaf.features.internal.service.FeaturesServiceImpl$1.call(FeaturesServiceImpl.java:985)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Suppressed: org.osgi.framework.BundleException: Activator start error in bundle org.ops4j.pax.url.wrap [55].
at org.apache.felix.framework.Felix.activateBundle(Felix.java:2276)
at org.apache.felix.framework.Felix.startBundle(Felix.java:2144)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:984)
at org.apache.karaf.features.internal.service.FeaturesServiceImpl.startBundle(FeaturesServiceImpl.java:1199)
at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:840)
... 6 more
Caused by: java.lang.IllegalStateException: Unknown protocol: mvn
at org.apache.felix.framework.URLHandlersStreamHandlerProxy.toExternalForm(URLHandlersStreamHandlerProxy.java:482)
at org.apache.felix.framework.URLHandlersStreamHandlerProxy.toExternalForm(URLHandlersStreamHandlerProxy.java:474)
at java.net.URL.toExternalForm(URL.java:922)
at java.net.URL.toString(URL.java:908)
at java.lang.ClassLoader.defineClassSourceLocation(ClassLoader.java:675)
at java.lang.ClassLoader.defineClass(ClassLoader.java:759)
at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.defineClass(BundleWiringImpl.java:2370)
at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.findClass(BundleWiringImpl.java:2154)
at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1542)
at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:79)
at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2018)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.apache.felix.framework.BundleWiringImpl.getClassByDelegation(BundleWiringImpl.java:1415)
at org.apache.felix.framework.Felix.createBundleActivator(Felix.java:4468)
at org.apache.felix.framework.Felix.activateBundle(Felix.java:2221)
... 11 more
Suppressed: org.osgi.framework.BundleException: Activator start error in bundle org.apache.felix.metatype [21].
at org.apache.felix.framework.Felix.activateBundle(Felix.java:2276)
at org.apache.felix.framework.Felix.startBundle(Felix.java:2144)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:984)
at org.apache.karaf.features.internal.service.FeaturesServiceImpl.startBundle(FeaturesServiceImpl.java:1199)
at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:840)
... 6 more
Caused by: java.lang.IllegalStateException: Unknown protocol: mvn
at org.apache.felix.framework.URLHandlersStreamHandlerProxy.toExternalForm(URLHandlersStreamHandlerProxy.java:482)
at org.apache.felix.framework.URLHandlersStreamHandlerProxy.toExternalForm(URLHandlersStreamHandlerProxy.java:474)
at java.net.URL.toExternalForm(URL.java:922)
at java.net.URL.toString(URL.java:908)
at java.lang.ClassLoader.defineClassSourceLocation(ClassLoader.java:675)
at java.lang.ClassLoader.defineClass(ClassLoader.java:759)
at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.defineClass(BundleWiringImpl.java:2370)
at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.findClass(BundleWiringImpl.java:2154)
at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1542)
at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:79)
at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2018)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.apache.felix.framework.BundleWiringImpl.getClassByDelegation(BundleWiringImpl.java:1415)
at org.apache.felix.framework.Felix.createBundleActivator(Felix.java:4468)
at org.apache.felix.framework.Felix.activateBundle(Felix.java:2221)
... 11 more
Suppressed: org.osgi.framework.BundleException: Activator start error in bundle org.apache.karaf.services.eventadmin [45].
at org.apache.felix.framework.Felix.activateBundle(Felix.java:2276)
at org.apache.felix.framework.Felix.startBundle(Felix.java:2144)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:984)
at org.apache.karaf.features.internal.service.FeaturesServiceImpl.startBundle(FeaturesServiceImpl.java:1199)
at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:840)
... 6 more
Caused by: java.lang.IllegalStateException: Unknown protocol: mvn
at org.apache.felix.framework.URLHandlersStreamHandlerProxy.toExternalForm(URLHandlersStreamHandlerProxy.java:482)
at org.apache.felix.framework.URLHandlersStreamHandlerProxy.toExternalForm(URLHandlersStreamHandlerProxy.java:474)
at java.net.URL.toExternalForm(URL.java:922)
at java.net.URL.toString(URL.java:908)
at java.lang.ClassLoader.defineClassSourceLocation(ClassLoader.java:675)
at java.lang.ClassLoader.defineClass(ClassLoader.java:759)
at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.defineClass(BundleWiringImpl.java:2370)
at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.findClass(BundleWiringImpl.java:2154)
at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1542)
at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:79)
at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2018)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.apache.felix.framework.BundleWiringImpl.getClassByDelegation(BundleWiringImpl.java:1415)
at org.apache.felix.framework.Felix.createBundleActivator(Felix.java:4468)
at org.apache.felix.framework.Felix.activateBundle(Felix.java:2221)
... 11 more
The specified feature: 'standard' version '4.0.4' is already installed
The specified feature: 'scr' version '4.0.4' is already installed
The specified feature: 'eventadmin' version '4.0.4' is already installed
^C
karaf#root()> ^Dkaraf#root()>
Eventhough everything is installed and started ok. After a reboot all exceptions disappear and works fine.
My questions are:
How can I make a custom distribution where eventadmin and scr
features are started on boot (startup.properties)?
How can I get rid of those exceptions on the first boot when eventadmin/scr features are set on bootFeatures?
As a side note I have been able to set a stable custom distribution as I want using the deprecated old style of Maven assembly, but It seems by far more ease to use the new way with karaf-maven-plugin.
Remove the runtime scope from the Karaf standard feature :
<dependency>
<groupId>org.apache.karaf.features</groupId>
<artifactId>standard</artifactId>
<version>4.0.4</version>
<classifier>features</classifier>
<type>xml</type>
</dependency>
this scope prevent some bundle, needed by eventadmin/scr, to be added to the startup stage. tbh, i don't clearly understand all the facet of the resolver used here with the different stage and profile to generate an assembly, but removing this scope make it work

Getting error "org.apache.flex.compiler:mxmlc:jar" when trying to compile with FlexMojos 7.0.1 and Apache Flex 4.14

I'm migrating an application I had working with Adobe Flex 4.6 and FlexMojos 4 to Apache Flex 4.14 and FlexMojos 7. When I try to execute "mvn build" I'm getting this error:
[ERROR] Unresolveable build extension: Plugin net.flexmojos.oss:flexmojos-maven-plugin:7.0.1 or one of its dependencies could not be resolved:
The following artifacts could not be resolved:
org.apache.flex.compiler:mxmlc:jar:4.12.1.20140427,
org.apache.flex.compiler:digest:jar:4.12.1.20140427,
org.apache.flex.compiler:optimizer:jar:4.12.1.20140427,
org.apache.flex.compiler:asdoc:jar:4.12.1.20140427,
org.apache.flex.compiler:swcdepends:jar:4.12.1.20140427,
org.apache.flex:compiler:pom:4.12.1.20140427: Failure to find
org.apache.flex.compiler:mxmlc:jar:4.12.1.20140427 in
http://repository.sonatype.org/content/groups/flexgroup/ was cached in the local repository, resolution will not be reattempted until the update interval of flex-mojos-repository has elapsed or updates are forced -> [Help 2]
[ERROR] Unknown packaging: swf # line 5, column 13
This is my pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.cognifit.cognifitSocialFlex</groupId>
<artifactId>FlexCognifit</artifactId>
<packaging>swf</packaging>
<name>cognifitSocialFlex</name>
<version>11.0.2.10</version>
<properties>
<flex.version>4.14.1.20150325</flex.version>
<flashplayer.version>11.1</flashplayer.version>
</properties>
<build>
<sourceDirectory>src</sourceDirectory>
<directory>${project.basedir}/target/${project.version}</directory>
<plugins>
<plugin>
<groupId>net.flexmojos.oss</groupId>
<artifactId>flexmojos-maven-plugin</artifactId>
<version>7.0.1</version>
<extensions>true</extensions>
<configuration>
<sourceFile>CpcSocialFlex.mxml</sourceFile>
<swfVersion>13</swfVersion>
<targetPlayer>11.1.0</targetPlayer>
<localesCompiled>
<locale>ar_MA</locale>
<locale>de_AT</locale>
<locale>de_CH</locale>
<locale>de_DE</locale>
<locale>el_GR</locale>
<locale>en_US</locale>
<locale>en_ZA</locale>
<locale>es_ES</locale>
<locale>es_MX</locale>
<locale>fr_FR</locale>
<locale>he_IL</locale>
<locale>it_IT</locale>
<locale>ja_JP</locale>
<locale>ko_KR</locale>
<locale>nl_NL</locale>
<locale>pt_BR</locale>
<locale>pt_PT</locale>
<locale>ru_RU</locale>
<locale>sr_RS</locale>
<locale>tr_TR</locale>
<locale>zh_CN</locale>
<locale>zh_HK</locale>
</localesCompiled>
<dependencies>
<dependency>
<groupId>org.apache.flex</groupId>
<artifactId>compiler</artifactId>
<version>${flex.version}</version>
<type>pom</type>
</dependency>
</dependencies>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.flex</groupId>
<artifactId>framework</artifactId>
<version>${flex.version}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>com.adobe.flash.framework</groupId>
<artifactId>playerglobal</artifactId>
<version>${flashplayer.version}</version>
<type>swc</type>
</dependency>
<dependency>
<groupId>com.adobe.flex.framework.themes</groupId>
<artifactId>halo</artifactId>
<type>swc</type>
<scope>theme</scope>
<version>${flex.version}</version>
</dependency>
</dependencies>
</project>
I'm using Maven 3.2.5 and Java 1.6.0_14:
Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T12:29:23-05:00)
Maven home: /usr/local/maven
Java version: 1.6.0_14, vendor: Sun Microsystems Inc.
Java home: /usr/java/jdk1.6.0_14/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "2.6.21.7-2.fc8xen", arch: "i386", family: "unix"
These are the steps I have followed:
I downloaded the Apache Flex SDK with the Installer:
Apache Flex SDK 4.14.1
AIR 18.0
Flash Player 18
I have used the Mavenizer to create a Maven version of this SDK:
Then I have deployed the mavenized version in my /root/.m2/repository/ folder and executed mvn compile with the pom.xml.
By the way in the meanwhile the mavenizer has evolved quite a bit ... making usage of maven extensions by ".mvn/extensions.xml" files. This should automatically download, convert and install the Flex/Flash/Air resources you reference. So to upgrade to the next Flex/Flash/Air version, just reference a new version and the plugin will take care of the rest (As long as the version actually exists). See more details here: https://cwiki.apache.org/confluence/display/FLEX/Preparing+FDKs+for+Maven+builds (Pay some special attention to the chapter: Prepare the FDK resources using the flex-sdk-converter-maven-extension)

Flex & Maven : How to upgrade playerglobal version in pom.xml

I'm currently developping an flex application, and i've used native cursor support to dynamically change cursor in particular conditions.
My application runs with Flex Sdk 4.1.0.16076, which use flash player 10.0 by default.
I have upgrade this version to 10.2 in project preferences, in order to use MouseCursorData class.
It works fine in eclipse but i'm using maven for dependencies and I have compilation error when doing a maven build, saying MouseCursorData Class can't be found.
It's pretty normal since i'm using player 10 in my dependencies. So I tried to update my pom.xml file for upgrading player to 10.2 :
<plugin>
<groupId>org.sonatype.flexmojos</groupId>
<artifactId>flexmojos-maven-plugin</artifactId>
<configuration>
<targetPlayer>10.0</targetPlayer>
<compiledLocales>
<locale>en_US</locale>
<locale>fr_FR</locale>
</compiledLocales>
<warnings>
<noConstructor>false</noConstructor>
</warnings>
<sourceFile>Opale.mxml</sourceFile>
<generateHtmlWrapper>true</generateHtmlWrapper>
<contextRoot>opale-web</contextRoot>
<services>${basedir}/src/main/resources/services-config.xml</services>
<output>target/opale-ui.swf</output>
</configuration>
<version>${flexmojos.version}</version>
<extensions>true</extensions>
<dependencies>
<dependency>
<groupId>com.adobe.flex</groupId>
<artifactId>compiler</artifactId>
<version>${flex.sdk.version}</version>
<type>pom</type>
</dependency>
</dependencies>
</plugin>
First, I have changed the targetPlayer in flex mojo plugin from 10.0 to 10.2.
Then I obtain the compilation error :
[ERROR] Failed to execute goal org.sonatype.flexmojos:flexmojos-maven-plugin:3.9:compile-swf (default-compile-swf) on project opale-ui: TargetPlayer and playerglobal dependency version doesn't match! Target player: 10.2, player global: 10.0 -> [Help 1]
So, i had a dependency to force playerglobal version :
<dependency>
<groupId>com.adobe.flex.framework</groupId>
<artifactId>playerglobal</artifactId>
<version>${flex.sdk.version}</version>
<classifier>10.2.0</classifier>
<type>swc</type>
</dependency>
Then, i have the following error :
Downloading: http://repo.maven.apache.org/maven2/com/adobe/flex/framework/playerglobal/4.1.0.16076/playerglobal-4.1.0.16076-10.2.0.swc
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 19.698s
[INFO] Finished at: Wed Sep 12 12:29:57 CEST 2012
[INFO] Final Memory: 9M/124M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project opale-ui: Could not resolve dependencies for project com.igc.opale:opale-ui:swf:1.9-SNAPSHOT: Could not transfer artifact com.adobe.flex.framework:playerglobal:swc:10.2.0:4.1.0.16076 from/to jboss (http://repository.jboss.org/maven2/): Access denied to: http://repository.jboss.org/maven2/com/adobe/flex/framework/playerglobal/4.1.0.16076/playerglobal-4.1.0.16076-10.2.0.swc, ReasonPhrase:Forbidden. -> [Help 1]
I new to maven so maybe i'm doing this pretty badly.
You can configure this in plugins
<plugins>
<plugin>
<groupId>org.sonatype.flexmojos</groupId>
<artifactId>flexmojos-maven-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<headlessServer>true</headlessServer>
<verboseStacktraces>true</verboseStacktraces>
<swfVersion>11</swfVersion>
<targetPlayer>10.2</targetPlayer>
...
</configuration>
</plugin>
</plugins>
And dependency:
<dependency>
<groupId>com.adobe.flex.framework</groupId>
<artifactId>playerglobal</artifactId>
<version>4.5.1.21328</version>
<classifier>10.2</classifier>
<type>swc</type>
</dependency>
If you search the sonatype repo you will find that the actual dependency you are looking for is:
<dependency>
<groupId>com.adobe.flex.framework</groupId>
<artifactId>playerglobal</artifactId>
<version>4.1.0.16076</version>
<classifier>10</classifier>
<type>1.swc</type>
</dependency>
notice how the type is 1.swc, I believe this is to cater for a shortfall in earlier versions of the SDK.

Resources