Installing and running Web Management Console in Apache Felix OSGI - apache-felix

I 'm trying to install and run Apache Felix Web Management Console ( 4.2.0 ) in Apache Felix 4.2.1 but it does not work.
I have installed Felix Http Jetty 2.2.1 bundle, Felic Configuration Admin Service 1.8.0 bundle, Log Service 1.0.1 bundle, EventAdmin 1.3.2 bundle and Felix Web Management Console 4.2.0
When I try to start the Web Management Console it says :
org.osgi.framework.BundleException: The bundle "org.apache.felix.webconsole_4.2.0 [29]" could not be resolved. Reason: Missing Constraint: Import-Package: org.apache.commons.fileupload; version="[1.2.0,2.0.0)"
I'm using Java 1.6.0.26, Ubuntu 12.10!
jonathan#JONATHAN:/datos/jonathan/Programas/apache-felix-framework-4.2.1$ java -jar bin/felix.jar
2013-10-22 16:38:37.389:INFO:oejs.Server:jetty-7.x.y-SNAPSHOT
2013-10-22 16:38:37.412:INFO:oejsh.ContextHandler:started o.e.j.s.ServletContextHandler{/,null}
____________________________
Welcome to Apache Felix Gogo
g! 2013-10-22 16:38:37.434:INFO:oejs.AbstractConnector:Started SelectChannelConnector#0.0.0.0:8888
lb
START LEVEL 1
ID|State |Level|Name
0|Active | 0|OSGi System Bundle (3.7.2.v20120110-1415)
1|Active | 1|Apache Felix Bundle Repository (1.6.6)
2|Active | 1|Apache Felix Gogo Command (0.12.0)
3|Active | 1|Apache Felix Gogo Runtime (0.10.0)
4|Active | 1|Apache Felix Gogo Shell (0.10.0)
23|Active | 1|Apache Felix Configuration Admin Service (1.8.0)
24|Active | 1|Apache Felix Log Service (1.0.1)
26|Active | 1|Apache Felix Http Jetty (2.2.1)
27|Active | 1|Apache Felix EventAdmin (1.3.2)
29|Installed | 1|Apache Felix Web Management Console (4.2.0)
g! start 29
org.osgi.framework.BundleException: The bundle "org.apache.felix.webconsole_4.2.0 [29]" >could not be resolved. Reason: Missing Constraint: Import-Package: org.apache.commons.fileupload; version="[1.2.0,2.0.0)"
g!
Regards

I had similar issues, I resolved them by clearing up the Felix installation, then I started the Felix from scratch, this means, I had something like this on the Apache Felix Gogo:
____________________________
Welcome to Apache Felix Gogo
g! lb
START LEVEL 1
ID|State |Level|Name
0|Active | 0|System Bundle (4.6.0)
1|Active | 1|Apache Felix Bundle Repository (2.0.2)
2|Active | 1|Apache Felix Gogo Command (0.14.0)
3|Active | 1|Apache Felix Gogo Runtime (0.12.1)
4|Active | 1|Apache Felix Gogo Shell (0.10.0)
g!
So, on the console, just add the following command
list -v
It will give you the list of available packages, so, just look for the Webconsole package name and run this (always on the Gogo console):
g! deploy org.apache.felix.webconsole
This will download the required libraries, and print the following on the Console:
Target resource(s):
-------------------
Apache Felix Web Management Console (3.1.2)
Required resource(s):
---------------------
Apache Felix Configuration Admin Service (1.2.4)
Apache Felix Http Bundle (2.0.4)
Apache Felix Log Service (1.0.0)
Apache Felix HTTP Service Jetty (1.0.0)
Optional resource(s):
---------------------
OSGi R4 Compendium Bundle (4.0.0)
Apache Felix Declarative Services (1.6.0)
Apache Felix iPOJO (1.8.0)
Apache Felix iPOJO WebConsole Plugins (1.6.0)
Apache Felix Shell Service (1.4.2)
Deploying...
done.
g!
So, now, if you run lb (list bundles command)
g! lb
START LEVEL 1
ID|State |Level|Name
0|Active | 0|System Bundle (4.6.0)
1|Active | 1|Apache Felix Bundle Repository (2.0.2)
2|Active | 1|Apache Felix Gogo Command (0.14.0)
3|Active | 1|Apache Felix Gogo Runtime (0.12.1)
4|Active | 1|Apache Felix Gogo Shell (0.10.0)
5|Installed | 1|Apache Felix Configuration Admin Service (1.2.4)
6|Installed | 1|Apache Felix Http Bundle (2.0.4)
7|Installed | 1|Apache Felix Log Service (1.0.0)
8|Installed | 1|OSGi R4 Compendium Bundle (4.0.0)
9|Installed | 1|Apache Felix Declarative Services (1.6.0)
10|Installed | 1|HTTP Service (1.0.0)
11|Installed | 1|Apache Felix iPOJO (1.8.0)
12|Installed | 1|Apache Felix Web Management Console (3.1.2)
13|Installed | 1|Apache Felix iPOJO WebConsole Plugins (1.6.0)
14|Installed | 1|Apache Felix Shell Service (1.4.2)
g!
So, now, just look for the bundles "HTTP Service" and "Apache Felix Web Management Console" and start them:
g! start 10
g! start 12
And finally, just go the the path (default port is 8080):
http://localhost:28372/system/console/bundles
By the way, you can change the port on the config.properties (in Felix) by just adding the following parameter:
org.osgi.service.http.port=28372
Hope this may help somebody else...

Finally I get it.
In a blank Felix installation:
g! bundlelevel -i 1
g! mvnrepo = http://repo2.maven.org/maven2
g! start $mvnrepo/commons-io/commons-io/1.4/commons-io-1.4.jar
g! start $mvnrepo/commons-fileupload/commons-fileupload/1.2.1/commons-fileupload-1.2.1.jar
g! start http://maven.ow2.org/maven2/org/json/org.ow2.chameleon.commons.json/20090911-0002/org.ow2.chameleon.commons.json-20090911-0002.jar
g! bundlelevel -i 5
g! start $mvnrepo/org/apache/felix/org.apache.felix.webconsole/4.2.0/org.apache.felix.webconsole-4.2.0.jar

Related

JBoss: get know the listening port

Sorry for a silly question. I am starting JBoss for a first time. I need to know what is happening.
I started server on my linux machine with command:
./standalone.sh -Djboss.bind.address=127.0.0.1 -Djboss.bind.address.management=127.0.0.1&
This is what I see in terminal right now:
=========================================================================
JBoss Bootstrap Environment
JBOSS_HOME: /usr/local/share/jboss
JAVA: /usr/lib/jvm/java-8-oracle/bin/java
JAVA_OPTS: -server -XX:+UseCompressedOops -Xms1303m -Xmx1303m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true
=========================================================================
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
13:46:46,874 INFO [org.jboss.modules] (main) JBoss Modules version 1.2.2.Final-redhat-1
13:46:47,032 INFO [org.jboss.msc] (main) JBoss MSC version 1.0.4.GA-redhat-1
13:46:47,090 INFO [org.jboss.as] (MSC service thread 1-7) JBAS015899: JBoss EAP 6.1.1.GA (AS 7.2.1.Final-redhat-10) starting
The silly question is: which port I should try to find JBoss there?
Default port is 8080 for web applications. Admin web console is on 9990

Jboss 7.X application server on mac?

I am currently trying to set up the jboss server and every time I use the command ./standalone.sh to start it....I end up with the following results.
jamess-iMac:bin jameslockhart$ ls
add-user.bat domain.conf jconsole.sh standalone.sh
add-user.sh domain.conf.bat jdr.bat vault.bat
appclient.bat domain.sh jdr.sh vault.sh
appclient.conf init.d run.bat wsconsume.bat
appclient.conf.bat jboss-cli.bat run.sh wsconsume.sh
appclient.sh jboss-cli.sh standalone.bat wsprovide.bat
client jboss-cli.xml standalone.conf wsprovide.sh
domain.bat jconsole.bat standalone.conf.bat
jamess-iMac:bin jameslockhart$ ./standalone.sh
=========================================================================
JBoss Bootstrap Environment
JBOSS_HOME: /Users/jameslockhart/desktop/apps/jboss
JAVA:/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/bin/java
JAVA_OPTS: -server -XX:+UseCompressedOops -XX:+TieredCompilation -Xms64m-Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Djboss.server.default.config=standalone.xml
=========================================================================
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
19:08:17,223 INFO [org.jboss.modules] JBoss Modules version 1.1.1.GA
19:08:17,362 INFO [org.jboss.msc] JBoss MSC version 1.0.2.GA
19:08:17,400 INFO [org.jboss.as] JBAS015899: JBoss AS 7.1.1.Final "Brontes" starting
All the tutorials I have watched have it going beyond the "Brontes" starting. Mine just sits there. Does anyone know what is wrong?
Any help would be appreciated!!
There was a bug in JBoss 7.1.1 that prevented it from starting on JDK8. JBoss AS7 is extremely outdated, you need to either use JDK7, or ideally upgrade to a recent version of Wildfly or JBoss EAP.
I was able to download wildfly and the system works flawlessly. Thanks for the help everyone.

Deploying an EAR with EJBs and dependencies on JBoss

I'm trying to deploy a maven generated ear in a fresh installed Jboss EAP 6.1. The ear deploys well on Glassfish 2.x. The ear structure is this:
Ear_name-deploy-X.X.X.ear
|- META-INF
| |- maven
| | |
| | \-Ear_name -> Ear_name-deploy -> pom.properties
| | -> pom.xml
| |- application.xml
| |- MANIFEST.MF
| \- sun-application.xml
\- some jars (around 100)
Some of those jars are EJBs wich have dependencies on other jars in the same bundle and those dependencies are failing. I know I have to include a jboss-deployment-structure.xml file in META-INF folder. But I don't find how to define those dependencies without having to establish the jars as modules, what I don't want to do. Isn't there another way to stablish those dependencies? Thank you all for your time.

Accessing ejb deployed in JBoss 7.0.1 from another client

Having deployed an EJB module in JBoss 7.0.1, I am trying to access it from a client executing on another JVM. However, I am unable to figure out the client side jars needed to add to my client's classpath.
I tried out with the following:-
jboss-ejb-api_3.1_spec-1.0.1.Final.jar
jboss-ejb-client-1.0.0.Beta11.jar
3.jboss-logging-3.1.0.CR2.jar
jboss-marshalling-1.3.4.GA.jar
5.jboss-marshalling-river-1.3.4.GA.jar
jboss-remoting-3.2.0.CR8.jar
7.jboss-sasl-1.0.0.Beta9.jar
jboss-transaction-api_1.1_spec-1.0.0.Final.jar
xnio-api-3.0.0.CR7.jar
There seems to be some inconsistency in this setup and I get this exception:-
INFO: JBoss EJB Client version 1.0.0.Beta11 Nov 9, 2012 12:01:04 AM
org.xnio.Xnio INFO: XNIO Version 3.0.0.CR7 Nov 9, 2012
12:01:04 AM org.jboss.ejb.client.ConfigBasedEJBClientContextSelector
createConnections ERROR: Could not create connection for connection
named default java.lang.IllegalArgumentException: No matching XNIO
provider found at org.xnio.Xnio.doGetInstance(Xnio.java:192) at
org.xnio.Xnio.getInstance(Xnio.java:146) at
org.jboss.remoting3.Remoting.createEndpoint(Remoting.java:73)
...
I didn't have any issues while having a client access an ejb deployed in JBoss 7.1.0 Final, JBoss 6.1.0 Final or Glassfish servers. The jars required at the client side war available.
I am a newbie in Java EE and Application Servers by the way and I am trying to learn in the process.
Thanks.
please add xnio-nio-3.0.3.GA.jar in your classpath
In addition to Ramkumar's answer, I am adding the maven dependency for this jar. Following the maven dependency for the jar:
<dependency>
<groupId>org.jboss.xnio</groupId>
<artifactId>xnio-nio</artifactId>
<version>3.0.3.GA</version>
</dependency>

Start osgi bundle using jboss as maven plugin

I am deploying a OSGI bundle in Jboss 7.1.1 by using Jboss as maven plugin and I am successfully deployed it into my jboss, my console shows following massege after deployment.
00:54:51,080 INFO [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015876: Starting deployment of "services-1.0-SNAPSHOT.jar"
00:54:51,110 INFO [org.jboss.osgi.framework] (MSC service thread 1-2) JBOSGI011001: Bundle installed: testAapi:1.0.0.SNAPSHOT
00:54:51,190 INFO [org.jboss.as.server] (management-handler-thread - 7) JBAS018562: Redeployed "services-1.0-SNAPSHOT.jar"
But now I dont understand how can I start my osgi bundle automatically using the same maven plugin means jboss as maven plugin
Means I am deploying bundle using mvn jboss-as:deploy and it is deployed but it is not started.
See here: http://community.jboss.org/message/759637#759637