WSO2 Carbon 4.x JNDI Tomcat - jndi

WSO2 Registry 4.5.x based on Carbon 4.x plattform allows to deploy WARs. For configuration of resources I want to use JNDI.
As described here, I try to configure JNDI resources:
http://kishanthan.wordpress.com/2012/05/31/how-to-register-jndi-resources-for-webapps-in-wso2-application-server/
1) WEB-INF/web.xml
<resource-ref>
<res-ref-name>url/ZoneConfiguration</res-ref-name>
<res-type>java.net.URL</res-type>
<res-auth>Container</res-auth>
</resource-ref>
2) META-INF/context.xml
<Context debug="5" reloadable="true" crossContext="true">
<ResourceLink name="url/ZoneConfiguration" global="url/ZoneConfiguration" type="java.net.URL"/>
</Context>
3) $CARBON_HOME/repository/conf/tomcat/catalina-server.xml:
<GlobalNamingResources>
<Resource name="url/ZoneConfiguration" factory="org.jee.jndi.URLResourceFactory"
type="java.net.URL" url="file:///temp/local.zone.properties"/>
</GlobalNamingResources>
(about factory: see here http://tomcat.apache.org/tomcat-7.0-doc/jndi-resources-howto.html#Adding_Custom_Resource_Factories)
The library with URLResourceFactory is deployed in $CARBON_HOME/lib/endorsed
This configuration works in a Tomcat 7.x but not in the WSO2 Tomcat. I am inclined to file an issue.
Or am I lacking anything WSO2 specific?

WSO2 Registry 4.5.X does not support hosting webapps out of the box, unless you have installed the webapp management feature on top of WSO2 Registry.
You can find more info related to JNDI Resources configurations from this post [1]. A sample is also included in that post which demonstrates the configurations and accessing resources defined as global naming resources with custom resource factory implementation.
[1] http://kishanthan.wordpress.com/2012/05/31/how-to-register-jndi-resources-for-webapps-in-wso2-application-server/

Related

How to let JBoss not to affect my own log4j2 settings?

I'm using Log4j2(2.17.1) with two type of configs(log4j.prop & log4j2.xml) on multiple projects. My APP's log4j2 works properly on Tomcat 9 while reading external log4j config. But somehow it stops working or only logging into server.log when I deploy my APP onto JBoss EAP 7. So I think the problem is coming from JBoss, and I need a way to tell it don't mess with my own Log4j2. Does anyone know how to do it?
With JBoss EAP 7.4 there is a new module which delegates the log4j-api logs to the jboss-logmanager. If you want to use the log4j log manager (log4j-core) then you need to exclude some modules from your deployment.
Option 1 below I would say is preferred since it only affects a single deployment. Option 2 will affect all deployments.
Option 1
Add a jboss-deployment-structure.xml to your deployment:
<jboss-deployment-structure>
<deployment>
<exclusions>
<module name="org.apache.logging.log4j.api" />
</exclusions>
</deployment>
</jboss-deployment-structure>
Option 2
Change the add-logging-api-dependencies attribute in the logging subsystem to false.
CLI example:
/subsystem=logging:write-attribute(name=add-logging-api-dependencies, value=false)
The root cause for this issue is related to the "ClassLoader" which is searched by JBoss EAP Logging in order to find the appropriate logging provider implementation. This search is made in the following order:
JBoss EAP LogManager
Log4j
Slf4j
JDK logging
Since both JBoss EAP LogManager and Log4j2 are available in the classpath, the JBoss EAP LogManager will be utilized due to the "higher precedence". For this reason, you must set the use-deployment-logging-config=false in the logging subsystem.
Furthermore, the JBoss EAP LogManager also uses classes from Log4j2 in its own implementation. That's why the modules, org.apache.log4j and org.apache.commons.logging have to be excluded from the deployment in order for Log4J2 to work correctly.

Grails 3 Container Managed Authentication

I am trying to upgrade my existing grails application from version 2.5.6 to 3.3.11.
So far, container managed application was configured in the application via web.xml, with <login-config>. Here is the configuration:
<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/login/login</form-login-page>
<form-error-page>/login/login_error</form-error-page>
</form-login-config>
</login-config>
As grails 3 has stopped supporting web.xml file, I am wondering how to maintain Container Managed Authentication. The reason for using Container Managed Authentication (CMA) is that our application doesn't want to handle the authentication process, as different customers have different authentication mechanisms at their end. So we prefer CMA.
Have read many online forums, they all end up with Spring Security plugin. But didn't find a configuration with Spring Security which gives control of authentication to the container.
So, how to configure CMA with Grails 3?

How to setup WebSphere Liberty as a very simple HTTP Serve to serve files in a directory

I need to setup IBM Maximo attachments feature to work with WebSphere Liberty. IBM confirms that WebSphere Liberty is compatible wit Maximo, but does not provide official support.
Bottom line, all I need is to serve files inside a directory through HTTP using WebSphere Liberty. I was wondering how I can do that.
This is a guide that I need to adapt it from http://www-01.ibm.com/support/docview.wss?uid=swg21312993 with WebSphere Liberty instead.
Can anyone guide me through?
IBM HTTP Server (IHS) already installed with Maximo. IHS is a flavor of Apache, so any Apache related doc will work. I configured Maximo doclinks to fall under htdocs so the attachments are available as a web resource. Bottom line, its not clear to me you need to configure WebSphere Liberty for this purpose.

How to access AWS SQS from websphere liberty using JNDI

In our project we have websphere liberty server and IBM MQ as message server. We are moving in cloud. We want to replace IBM MQ with AWS SQS. In server.xml we have following entries to get IBM MQ connection factory using jndi.
<jmsQueueConnectionFactory connectionManagerRef="ABCConnMgr" jndiName="jms/ABC_QCF">
<properties.wmqJms channel="CH.ABC.SVRCONN" hostName="abc-mq1-st4.ebiz.abc.com" port="21414" queueManager="ABC401" transportType="CLIENT"/>
</jmsQueueConnectionFactory>
<connectionManager agedTimeout="-1s" connectionTimeout="180s" id="ABCConnMgr" maxIdleTime="1800s" maxPoolSize="50" minPoolSize="0" purgePolicy="EntirePool" purgeagedTimeout="-1s" reapTime="180s"/>
<jmsQueue id="ABC.ORDERMGT.INPUT.QA" jndiName="jms/ABC_ORDERMGT_INPUT">
<properties.wmqJms baseQueueName="ABC.ORDERMGT.INPUT.QA"/>
</jmsQueue>
Similarly I am looking jndi configuration for Amazon SQS connection factory and sqs queue. I think IBM need to develop resource adapter for SQS and provide this configuration.
You are correct, you will need a resource adapter for Amazon SQS. It could be provided by any third-party vendor, does not need to be IBM for it to work because JCA is a standard.
Once you have a resource adapter, here are some helpful Knowledge Center links to get it configured in Liberty,
Overview of JCA/JMS config
Configuring Resource Adapters
Configuring JMS Connection Factories
Configuring JMS Destinations

Deploying EJB on openEJB

Can someone help me with the process of deploying EJB application on TOMEE server (OpenEJB standalone server)? Is it simply dropping EJB application jar in the common library folder (apps folder) of the server?
How does TOMEE bind EJBs to JNDI names?
TomEE follows JavaEE6 naming for JNDI names.
To deploy a war put it like for tomcat in webapps/ folder and for ejbmodules or ears create a apps/ folder to put them there and uncomment the Deployments line in conf/tomee.xml.

Resources