How to reference apache cxf library from apache web server - apache

When I deploy my apache cxf web service using eclipse I have to include the apache cxf library in the Web Deployment Assembly in order for it to work when I deploy it on my production apache web server. This is a problem because it makes the war file very large because the cxf library is included. If I exclude the library the war file is much smaller but the web service does not work when it is deployed on the live server even though the apache cxf library is on the live server.
My assumption is I need some kind of classpath reference so the live server can see the apache cxf installation but I am not familiar with how to do this as I am new to apache.
Thanks, Jesse

Put the cxf jars on folder tomcat/lib.

Ok, this workaround worked for me:
We can set the CXF lib path on the common.loader variable which is in $CATALINA_HOME/conf/catalina.properties file. You can add (after the comma) something like this:
common.loader=....,/path/to/cxf/home/lib/*.jar
I couldn't find a way to set an enviroment variable on tomcat in order to have something like: ${cxf.home}/lib/*.jar. I tried to put -Dcxf.home=$CXF_HOME in several places in catalina.sh but it never picked it up :( - hope someone can help on this later.
Restart tomcat and it will take cxf jars

Related

Glassfish workaround to work with OpenAM

The IT dept. in the company where I work uses OpenAM to manage web access over the intranet (SSO solution).
As I'm using Glassfish 4.1, which is a container not supported by OpenAM, is there some workaround that I could use OpenAM, without replacing Glassfish? If so, how can I do it?
Thanks in advance.
When using OpenAM 13.5.0 for example, it is possible to deploy OpenAM to Payara 4.1.2.172 for example with a bit of a compromise.
DISCLAIMER: the following steps allows one to deploy OpenAM to GlassFish/Payara, but this does not mean that this kind of deployment is actually supported by anyone.
So the steps are:
in the WAR file within the WEB-INF/lib/openam-radius-server-13.5.0.jar you'll need to remove the META-INF/INDEX.LIST file
you'll need to edit the WEB-INF/web.xml file and remove both the ws and federationrest servlets and their mappings
to deploy the WAR you'll need to execute this command:
bin/asadmin deploy --name openam --contextroot /openam --property implicitCdiEnabled=false OpenAM-13.5.0.war
It seems that OpenAM cannot be deployed on Payara (Glassfish). Please refer to the blog and the last comment of this issue.
So you may have to use another container, for example, Tomcat.

grails.app.context being ignored deploying to Tomcat

I have an Apache server proxying all traffic from mainhost.com/subdirectory to someec2instance/subdirectory. When I start Apache and hit someec2instance.com, I get the ROOT war page. That works fine. If I deploy my app as ROOT.war, everything works fine form someec2instance.com.
However, when I access mainhost.com/subdirectory, all the asset urls and link_to urls are wrong and point to mainhost.com instead of mainhost.com/subdirectory.
I've set grails.app.context and confirmed via application.properties that the correct grails.env is being set.
Why isn't grails.app.context being respected when I deploy as ROOT.war? I would expect the site to be accessible on someec2instance.com/context, but it's like it ignore grails.app.context entirely.
The reason is doesn't work is that those settings are for running locally, not when deployed as a WAR file. When you use the tomcat or jetty plugin in run-app we configure the container to make it look like it's running an "exploded" war (similar to when a WAR gets unpacked to the file system by various servers). Since the container is running in embedded mode, it's easy to configure it programmatically as needed.
But when you deploy a WAR file there's nowhere near as much configurability. In run-app the build logic of Grails starts the server, configures it, and deploys the app, but a WAR file deployed to a "real" server is managed by the server and not the other way around.

Deploying Saiku UI on Glassfish

When I try to deploy saiku-ui-2.4.war to Glassfish I get
"There is no installed container capable of handling this application
ROOT. Please see server.log for more details."
The server.log shows:
[#|2013-08-16T17:50:36.595-0400|SEVERE|oracle-glassfish3.1.2|javax.enterprise.system.core.com.sun.enterprise.v3.server|_ThreadID=24;_ThreadName=Thread-2;|There
is no installed container capable of handling this application ROOT|#]
[#|2013-08-16T17:50:36.610-0400|INFO|oracle-glassfish3.1.2|org.glassfish.admingui|_ThreadID=23;_ThreadName=Thread-2;|Exception Occurred :Error occurred during deployment: There is no installed container capable of handling this application ROOT. Please see server.log for more details.|#]
Any idea how to get around this? I searched Saiku's own forum with no luck. I even have a post on there.
Saiku has a prepared package that comes with Tomcat. Saiku UI is deployed as Tomcat ROOT application. This package works fine but I want to try to deploy it on Glassfish.
What's interesting is Saiku has a download saiku-ui-master. This is a separate UI package that needs node.js installed. I've gotten this to work but I want to run it on Glassfish.
Solved it! Added WEB-INF and web.xml then it deployed with no issue!
Actually you need to unpack content of the saiku-ui.war in docroot of your domain as there is static content only.

Netbeans project 404 + apache localhost XAMPP

I've created a web project in Netbeans. When I run it, it starts a glassfish server, and everything works fine (I don't understand why or how, but it works).
I also have XAMPP installed on my mac. I copied my netbeans project folder to my user sites folder, and ran my apache server with XAMPP.
I can access the sites index, but whenever I try to use a servlet, I get a 404, object not found.
Does this have something to do with glassfish web xml file? Servlet Mapping? Is there a new apache web xml file that I must create for it to work on apache server?
I can paste code if you need it.
Thanks!!!
Apache Server is for php based application and for running java based web project you have to install apache tomcat or glassfish as you have done previously where the servlet container is available.

Implementing a JAAS page to a WAR file on JBOSS AS 7.1.1

I'm very new to web applications. I've been told that JBOSS 7.1.1 has an in-built JAAS system which can be enabled on my JBOSS configuration quite simply. However I'm having trouble trying to get this running, namely most internet searching I went through has just ended up with older versions of JBoss.
Does anyone have a step-by-step guide on how to implement a simple JAAS authentication screen on my WAR file in JBoss 7.1.1? Prefarbly using its h2 database. Thanks :)
Also - my machine has trouble with Eclipse, so I can't use any of Eclipse EE's nifty server running mechanisms.
Finally got it. For those of you in the future:
You need your own standard login/logout pages in jsp/html/whatever. You put that in your web.xml constraints. Then you add an xml file called "Jboss-web" and type in your security domain (the default AS 7 is called 'other'). Then lastly add users and roles using adduser.bat in config folder.