how to supply a common jar in jboss eap 6? - jboss

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

Related

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
...

Using log4j with JBoss 7.2 (EAP 6.1-Alpha, not JBoss 6) with SAR

I have tried the followings but none works - My SAR deploys fine but I do not see any log4j message, as if log4j initialization never happens.
A) Put exclusion of org.apache.log4j in my jboss-deployment-descriptor.xml
B) Included a copy of log4j.xml in my $JBOSS_HOME/standalone/configuration sub-directory
C) Set the -Dlog4j.configuration option in my standalone.sh.
I also tried to include the log4j.xml directly under the META-INF of my 'SAR', along with the log4j-1.2.15.jar that I use with my apps. In addition, I also tried to zip up my log4j.xml into a jar file and place it in my SAR along with other jars. (I have added the name of these jars in my deployment descriptor) All efforts failed.
Thanks in advance for your help!
Matthew
Update: I have added the follow flag to standalone.sh
-Dorg.jboss.as.logging.per-deployment=false
and now I see the following error:
18:44:31,989 ERROR [stderr] (MSC service thread 1-6) log4j:WARN No appenders could be found for logger (com.abc.mbean.listenerImpl).
18:44:31,990 ERROR [stderr] (MSC service thread 1-6) log4j:WARN Please initialize the log4j system properly.
Since I have placed the log4j.xml under my standalone/configuration + pack the log4j.xml with my log4j.jar in my SAR already, now can I let JBoss know my log4j configuration?
Many Thanks!
Matthew
The $JBOSS_HOME/standalone/configuration directory is not on your class path so log4j will not see a configuration file there. You'll need to package your log4j.xml in the SAR. Probably in the META-INF directory of the SAR.
Tried both the ways mentioned in the thread below. Worked fine for me.
https://community.jboss.org/thread/219871

JBOSS AS 7 : ClassNotFoundException: javax.crypto.SecretKeyFactorySpi

I am running jboss-as-7.1 on java 1.6. The custom login module encrypts using bouncycastle provider. However jboss throws this error on startup. (Only at trace log level, mind you). Here is my configuration:
Added bouncycastle as provider in java.security file.
Download unlimited strength policy files and put in lib/security
I know that javax.crypto.SecretKeyFactorySpi is already defined in the jce.jar file. But it's not being picked up. Not sure what else to try.
Caused by: java.lang.ClassNotFoundException: javax.crypto.SecretKeyFactorySpi from [Module "abc.crypto:main" from local module loader #210a6ae2 (roots: /home/ptest/jboss-as-7.1.0.Final/modules)]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)
Are you defining your own JBoss module for BouncyCastle? It looks as though you are, based on the "abc.crypto:main" line you posted. I typically see the error you described when I am incorrectly referencing a module in my assembly descriptor, or if the module itself is not configured properly. I'd start there.

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

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.