Start osgi bundle using jboss as maven plugin - jboss

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

Related

how to supply a common jar in jboss eap 6?

How could I make a common jar availabe in jboss 6.4 redhat ?
Is it possible to put it in JBOSS_HOME/standalone/lib ?
01:00:42,659 DEBUG [org.jboss.as.server.deployment] (MSC service thread 1-2) Adding dependency ModuleDependency [identifier=LogManager4JBoss-4.1.0rc2.jar:main, moduleLoader=local module loader #16f65612 (finder: local module finder #311d617d (roots: /opt/jboss6/modules,/opt/jboss6/modules/system/layers/base)), export=false, optional=false, importServices=false] to module deployment.tserver-5.0.0.jar:main
01:00:42,670 TRACE [org.jboss.modules] (MSC service thread 1-2) Locally loading module LogManager4JBoss-4.1.0rc2.jar:main from local module loader #16f65612 (finder: local module finder #311d617d (roots: /opt/jboss6/modules,/opt/jboss6/modules/system/layers/base))
01:00:42,671 TRACE [org.jboss.modules] (MSC service thread 1-2) Module LogManager4JBoss-4.1.0rc2.jar:main not found from local module loader #16f65612 (finder: local module finder #311d617d (roots: /opt/jboss6/modules,/opt/jboss6/modules/system/layers/base))
tserver-5.0.0.jar needs some common log stuff from LogManager4JBoss-4.1.0rc2.jar, all the documentation I read so far is confusing, I can't figure out where to put the common jar, this is working in a jboss 4.2.3, I need to use hibernate 3.5 for oracle db synonym support, from jboss 6

Jboss7.2 Unable to obtain CDI 1.1 utilities for Mojarra

Environment:
Jboss 7.2
Java 11
On loading JBoss 7.2 server I am getting an issue obtaining CDI 1.1 utilities. How could I to resolve this problem?
Server log SEVERE error on loading
...
08:24:15,561 SEVERE [javax.enterprise.resource.webcontainer.jsf.flow] (MSC service thread 1-7) Unable to obtain CDI 1.1 utilities for Mojarra
08:24:15,562 SEVERE [javax.enterprise.resource.webcontainer.jsf.application.view] (MSC service thread 1-7) Unable to obtain CDI 1.1 utilities for Mojarra
...

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

Error listenerStart - JaxWS - JBoss as 7

I'm trying to migrate a Jax-WS based web service to JBoss as 7 but the application (deployed as a war) failes to start the listener on start-up.
ERROR [org.apache.catalina.core.StandardContext] (MSC service thread 1-14) Error listenerStart
ERROR [org.apache.catalina.core.StandardContext] (MSC service thread 1-14) Context [/abc] startup failed due to previous errors
ERROR [org.jboss.msc.service.fail] (MSC service thread 1-14) MSC000001: Failed to start service jboss.web.deployment.default-host (...)
The error message references to failed due to previous errors however no errors are printed in the log. The application in question bundles jax-ws-rt like this:
<dependency>
<groupId>sun-jaxws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.1.7</version>
</dependency>
If I change the scope of the jax-ws-rt to be provided this causes a nice ClassNotFound as expected.
WARN [org.jboss.as.ee] (MSC service thread 1-13) JBAS011006: Not installing optional component com.sun.xml.ws.transport.http.servlet.WSServletContextListener due to exception: java.lang.ClassNotFoundException: com.sun.xml.ws.transport.http.servlet.WSServletContextListener (…)
The servlet is defined like this in the web.xml.
<listener>
<listener-class>com.sun.xml.ws.transport.http.servlet.WSServletContextListener</listener-class>
</listener>
<servlet>
<description>JAX-WS endpoint for data service</description>
<display-name>abc</display-name>
<servlet-name>abc</servlet-name>
<servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>abc</servlet-name>
<url-pattern>/services/abc</url-pattern>
</servlet-mapping>
I cant understand whats wrong. How do I solve this and get the application deployed?
Thoughts:
Am I missing a dependency?
Can I reconfigure the war to use Jboss internal JaxWS without major refactoring?
If I cant use a jboss internal JaxWS version can I force Jboss to use a version of Jaxws that I bundle in the war? (If so, what dependencies do I need for JaxWs?)
with JBoss AS7 (Java EE6) you actually shouldn't need to put the WSServlet in the web.xml as the servlet-class. But instead you would have there the class name of the class annotated with #Webservice
All you want to do is make sure that in you JBoss configuration (e.g. standalone.xml) you have extension for webservices enabled:
<extensions>
[...]
<extension module="org.jboss.as.webservices"/>
</extensions>

Can I make a WAR depend on a JNDI entry in JBoss 5.1?

As part of an upgrade from JBoss 4.0.4 to 5.1, I am trying to get a WAR to deploy after an EAR is successfully deployed. JBoss 5.x does not support PrefixDeploymentSorter like 4.x did, which means that I have to use <depends> in the WAR's jboss-web.xml.
It seems I cannot depend on the EAR itself, so I pick the last deployed EJB instead. This EJB provides a JNDI entry that the WAR needs.
Here's the EJB as it deploys when the WAR is absent from the deploy directory:
2010-03-25 10:47:30,348 INFO [org.jboss.ejb3.session.SessionSpecContainer] (main) Starting jboss.j2ee:ear=my-ear.ear,jar=mypackage-ejb.jar,name=MyFacadeBean,service=EJB3
2010-03-25 10:47:30,350 INFO [org.jboss.ejb3.EJBContainer] (main) STARTED EJB: my.package.MyFacadeBean ejbName: MyFacadeBean
2010-03-25 10:47:30,371 INFO [org.jboss.ejb3.proxy.impl.jndiregistrar.JndiSessionRegistrarBase] (main) Binding the following Entries in Global JNDI:
my/MyFacade/local - EJB3.x Default Local Business Interface
my-ear/MyFacadeBean/local-my.package.MyFacade - EJB3.x Local Business Interface
And here's the depends snippet from jboss-web.xml:
<depends>jboss.j2ee:ear=my-ear.ear,jar=mypackage-ejb.jar,name=MyFacadeBean,service=EJB3</depends>
My problem is: The WAR starts to deploy immediately after "STARTED EJB:", i.e. before MyFacadeBean is bound to JNDI, which causes bean deployments to fail:
2010-03-25 10:47:39,068 ERROR [my.facade.FacadeFactory] (main) MyFacade not bound
2010-03-25 10:47:39,069 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[my.host.no].[/]] (main) StandardWrapper.Throwable
java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at my.freemarker.servlet.FreemarkerController.setupPojoServiceFactory(FreemarkerController.java:621)
[...]
Caused by: java.lang.RuntimeException: javax.naming.NameNotFoundException: MyFacade not bound
at my.facade.FacadeFactory.getFacade(FacadeFactory.java:61)
After the WAR has finished its deployment, MyFacade happily (mockingly?) continues its deployment and binds the JNDI entries.
If I hot-deploy the WAR after the EAR has deployed, everything works as intended.
I even thought of depending on a dummy EJB in the EAR, and using <module-order>strict</module-order> in jboss-app.xml to force it to load as the last module. But alas, JBoss 5.x does not support that either. Doh!
Is there a way to depend on the JNDI entry itself? Are there other ways of solving this?
Here's how you can achieve this on JBoss 5.1.x.
First, add a file called aliases.txt into the META-INF directory of your EAR. This file should just contain a single line with an arbitrary name / identifier for your EAR. For example, if you have my-ear.ear, your META-INF/aliases.txt file could contain 'my-ear'. It just needs to be something that won't clash with any other aliases declared by other apps deployed on the same server.
Next, add a jboss-dependency.xml file to the META-INF directory of your WAR, containing the following (subsituting 'my-ear' for the alias you created above):
<dependency xmlns="urn:jboss:dependency:1.0">
<item whenRequired="Real" dependentState="Create">my-ear</item>
</dependency>
This will ensure the EAR is deployed before the WAR.
Also, if you try to deploy the WAR without the EAR being present, JBoss will log a clear deployment error message telling you about the missing dependency.