JBoss 7.1.1 and JBoss Web Native - jboss

I'm trying to enable the JBoss Web Native libraries in JBoss 7.1.1. I have read this question and the answers and have tried the following steps to enable the native libraries in JBoss, but it didn't work so far. I'm on OS X:
Downloaded the macosx archive from http://www.jboss.org/jbossweb/downloads/jboss-native-2-0-10
Unzipped it into the JBoss directory, so the contents of the archive are available in bin/native.
Updated bin/standalone.conf to include the library path: JAVA_OPTS="$JAVA_OPTS -Djava.library.path=/path/to/jboss-as-7.1.1.Final-native/bin/native:$PATH"
Starting JBoss, I can still see the following in the log file:
[org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-1) Starting Coyote HTTP/1.1 on http-localhost-127.0.0.1-8080
instead of the expected Http11AprProtocol.
What am I missing?

Turns out the above steps are no longer necessary for JBoss 7.1.1, as the native libraries are now bundled under modules/org/jboss/as/web/main/lib.
To enable their usage, I had to set the native attribute to true in the web subsystem in standalone.xml. For some reason it was set to false in the default configuration:
<subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host"
native="true">
<connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
<virtual-server name="default-host" enable-welcome-root="true">
<alias name="localhost"/>
<alias name="example.com"/>
</virtual-server>
</subsystem>

JBOSS EAP 6.0
Check if you have modules/org/jboss/as/web/main/lib in JBOSS_HOME.
If not as it is in my version of JBoss EAP 6.0.
first: yum install tomcat-native.x86_64
Now your system has got tomcat native library under /usr/lib64 that is generally in the java.library.path
then set native=true in subsystem web as nwinkler's suggested:
<subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host"
native="true">
<connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
<virtual-server name="default-host" enable-welcome-root="true">
<alias name="localhost"/>
<alias name="example.com"/>
</virtual-server>
and now restart JBOSS.
Without tomcat native libraries installed you have in log:
10:12:31,700 INFO [org.apache.catalina.core.AprLifecycleListener] (MSC service thread 1-1) The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/jdk1.6.0_37/jre/lib/amd64/server:/usr/java/jdk1.6.0_37/jre/lib/amd64:/usr/java/jdk1.6.0_37/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
10:12:32,203 INFO [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-8) Starting Coyote HTTP/1.1 on http-/127.0.0.1:8080
With tomcat native libraries installed your log writes:
10:22:56,147 INFO [org.apache.coyote.http11.Http11AprProtocol] (MSC service thread 1-5) Starting Coyote HTTP/1.1 on http-/127.0.0.1:8080
ALTERNATIVE
1) Download native library from JBoss web sites:
wget http://downloads.jboss.org/jbossnative/2.0.10.GA/jboss-native-2.0.10-linux2-x64-ssl.tar.gz
2) untar
tar xvzf jboss-native-2.0.10-linux2-x64-ssl.tar.gz
3) Create a folder for your native-libraries:
mkdir -p tomcat-native
4) Move bin/native in your new folder
mv bin/native tomcat-native
5) Make your folder visible by java. Add this in standalone.conf or domain.conf
JAVA_OPTS="$JAVA_OPTS -Djava.library.path=[the tomcat-native's folder path]

Related

Where to put Logback JNDI for Jboss webapp?

For a jboss .war application I received instructions to configure its SLF4j/Logback, setting a folder path string with java:/comp/env/xyz JNDI variable.
I'm using Jboss EAP 7, do I need to set it somewhere in the standalone.xml file? What syntax should be used? The official Logback docs don't help me with Jboss.
EDIT:
More info, the actual code looks for the resource in this way:
basepath = (String) initialContext.lookup("java:/comp/env/" + MyBasePath);
I answer myself, the variable can be set in standalone.xml here:
<subsystem xmlns="urn:jboss:domain:naming:2.0">
<bindings>
<simple name="java:/comp/env/xyz" value="<PATH>" type="java.lang.String"/>
</bindings>
<remote-naming/>
</subsystem>

standalone.xml doesn't delete deployment after stop jboss application server wildfly

I have a project which uses Wildfly to deploy. But when I stop the server, the development tags in standalone.xml aren't deleted. So the next time I run the server, it will catch error.
Here is standalone.xml deployment tags
<deployments>
<deployment name="sqljdbc42.jar" runtime-name="sqljdbc42.jar">
<content sha1="ff439c53190a987d327165dec8b148f670cb7ca8"/>
</deployment>
<deployment name="nts.uk.com.js.web.war" runtime-name="nts.uk.com.js.web.war">
<fs-exploded path="/home/local/3SI/ha.dhv/3SProjects/UniversalK/nts.uk/uk.base/base.web/nts.uk.com.js.web/build/libs/exploded/nts.uk.com.js.web.war"/>
</deployment>
</deployments>

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.

Create a global filter in JBoss 7

I want to create a global custom filter, that catches(for checking/modification etc) http-headers for all web-applications on server.
I tryied to apply my filter as a global-module in standalone.xml, but it doesn't work
<subsystem xmlns="urn:jboss:domain:ee:1.1">
<spec-descriptor-property-replacement>false</spec-descriptor-property-replacement>
<jboss-descriptor-property-replacement>true</jboss-descriptor-property-replacement>
<global-modules>
<module name="com.myfilter.filter" slot="main"/>
</global-modules>
</subsystem>
Help me please!
Global module will only add something to global class path, it will not use it for requests.
What you request is outside Java EE specification. Some servers support such a functionality as an extension to the spec. Tomcat and JBoss have such extended support using Valves. You should be able to do what you're after by implementing a Tomcat Valve, installing it as a module and then configuring it to JBoss like instructed here:
<subsystem xmlns="urn:jboss:domain:web:1.4" default-virtual-server="default-host" native="false">
<valve name="myvalve" module="org.jboss.web-valves" class-name="org.apache.catalina.valves.AccessLogValve">
<param param-name="prefix" param-value="catalina_access_log."/>
<param param-name="suffix" param-value=".txt"/>
</valve>
. . . .
</subsystem>