Enable logging in Apache CXF generated client - apache

I followed directions on CXF web site to enable logging of SOAP requests, but cannot see any logging going on in my logs.
I have log4j, so I added -Dorg.apache.cxf.Logger=org.apache.cxf.common.logging.Log4jLogger to Tomcat jvm args, then I created cxf.xml and put into classpath. I also added logger into log4j config.
Nothing gets logged.
What can be a problem?
cxf.xml:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cxf="http://cxf.apache.org/core"
xsi:schemaLocation="
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<cxf:bus>
<cxf:features>
<cxf:logging/>
</cxf:features>
</cxf:bus>
</beans>

I use the LoggingInInterceptor/LoggingOutInterceptor and am not sure about your bus configuration but you should be sure to also added a correct logger (with the correct name) to your log4j configuration.
In the Apache CXF - 2.5 Migration Guido you will find the usefull information
The Logging interceptors now log using service specific
categories/loggers instead of just
LoggingInInterceptor/LoggingOutInterceptor. The names of the logger
that is used is
org.apache.cxf.services.ServiceName.PortName.PortTypeName. This allows
the user to configure specific per service filters and formatters in
their logging configuration.
I have written a blog post about logging with Apache CXF that provides all information I needed to enable request/response logging in my application.

Related

Closed : Logback xml not picked by weblogic

We have externalized the logback configuration in our spring app.
Used logback spring ext
compile 'org.logback-extensions:logback-ext-spring:0.1.4'
Added following lines in web.xml
<context-param>
<param-name>logbackConfigLocation</param-name>
<param-value>file:/${log-config-folder}/api/logback.xml</param-value>
</context-param>
Placed logback.xml in the folder mentioned in web.xml
/usr/me/my-app/log-config
/api
/logback.xml
Added JVM argument in start up script of tomcat.
JAVA_OPTS="$JAVA_OPTS -Dlog-config-folder=usr/me/my-app/log-config"
When the app is deployed in tomcat, it works perfectly fine. We are able to see the logs. When logback xml gets updated, I can see changes reflecting immediately in the app (changing LOG LEVELs)
Problem: When this same configuration is moved to weblogic, its not picking up the logback xml from external folder. JVM argument is added to weblogic start up script. I can see the JVM argument getting set.
Weblogic team came back and told they have made the weblogic setting to prioritize application classes and config.
<prefer-web-inf-classes>true</prefer-web-inf-classes>
Any pointers to triaging this would be really helpful.

How to make a deployable war file of a mule ESB application

can somebody please help me how to make a war of a simple mule application.
My mule application consists of a single mule-config.xml file.
I have made this mule project in ecplise and can run it as a mule server.
My requirement is to make a war and deploy it in a tomcat or tcat server.
Thanks and Regards,
Arijit
As explained in the user guide:
To embed Mule inside a webapp, you provide one or more configuration file locations as context params and include a context listener to initialize the Mule Server.
So just add this in your web.xml, with mule-config.xml at the root of your classpath (for ex. in src/main/resources):
<context-param>
<param-name>org.mule.config</param-name>
<param-value>mule-config.xml</param-value>
</context-param>
<listener>
<listener-class>org.mule.config.builders.MuleXmlBuilderContextListener</listener-class>
</listener>
EDIT I've open-sourced a running demo: https://github.com/ddossot/mule-webapp-example

ExtendedFormAuthenticator in JBoss 7

I'm porting a legacy application from JBoss 4.2.3 to JBoss 7 (the web profile version). They used a custom login module and used a valve to capture the login failure reason into j_exception. They did this by putting context.xml into the web-inf directory of the war, with the following contents:
<!-- Add the ExtendedFormAuthenticator to get access to the username/password/exception ->
<Context cookies="true" crossContext="true">
<Valve className="org.jboss.web.tomcat.security.ExtendedFormAuthenticator"
includePassword="true" ></Valve>
</Context>
The login is working for me, but not that valve. When there's a login exception, the j_exception is still empty and the logic that depends on analyzing why the login was rejected fails. According to this link: http://community.jboss.org/wiki/ExtendedFormAuthenticator, everything looks right. However that link is very old, and it's possible things have changed since then. What's the new way?
It seems that security valves are now defined directly in jboss-web.xml, like this:
<jboss-web>
<security-domain>mydomain</security-domain>
<valve>
<class-name>org.jboss.web.tomcat.security.ExtendedFormAuthenticator</class-name>
<param>
<param-name>includePassword</param-name>
<param-value>true</param-value>
</param>
</valve>
</jboss-web>
However, the ExtendedFormAuthenticator class wasn't ported to JBoss 7.0.1. A ticket has been opened for me, so it should be present in JBoss 7.1.0:
https://issues.jboss.org/browse/AS7-1963

How to build a simple web proxy in Mule 3?

I ran this Mule 3 file expecting that when I browse to http://localhost:9000, I would be redirected to http://localhost/path (source - behind a login prompt):
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:pattern="http://www.mulesoft.org/schema/mule/pattern"
xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/pattern http://www.mulesoft.org/schema/mule/pattern/3.1/mule-pattern.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.1/mule.xsd">
<pattern:web-service-proxy
name="WSProxyService"
inboundAddress="http://localhost:9000"
outboundAddress="http://localhost/sugarcrm"/>
</mule>
Instead, I get this unfriendly message from the web browser:
‹mO=OÃ0Ýó+ŽL0KÂÈX‚&ˆJ-DÂŒ×øÀ•ì8rÜJý÷8)bb9éî}Ü{â¢y[©Ï®…µÝ#÷ñ´Y¯ ¿F\·ê±QÍ©‹±}Íe&LtV äÓ÷Ѳ¼)+Øú#kè88xˆö$ðf²Øy}šõ•ü‡›®™¥2Ú÷—Î`h·P üõ›Ç{Dë{²ÆO§Ã7…>8Ì¥áÀIÇùOHƒ´
The web-service-proxy pattern is designed to work with SOAP-style web services. Pointing your browser to it won't do you any good.
For pure HTTP proxying either:
use the new pattern:http-proxy coming in Mule 3.2 and already usable in snapshot builds (examples),
use a pattern:bridge with HTTP in and out endpoints (examples).
The former is a much better option, if you're not snapshot averse, as it has extended support for HTTP requests semantics and an upcoming caching module.
I've had a similar problem, although I used soapUI to perform the test. The solution after some days getting lost is simple, configure soapUI not to use/don't allow compression. What you see is actually compressed answer that server did not mark as compressed.

JMS Destination creation at deployment with Glassfish 3.0.1

I'm currently trying to 'port' my Java EE 5 Application from Jboss 6 M2 to Glassfish 3.0.1
Jboss used to create my JMS Destination Queues a deployment-time thanks to the -service.xml files. I really liked this feature and I would like to find a way to do the same thing on Glassfish. Is this even possible ?
I'm not sure of the exact status with GlassFish 3.0.1 but according to these threads:
http://markmail.org/thread/cqj56ehulg7qdenp
http://markmail.org/thread/zs4naxy534ijbpic
creating JMS destinations at deploy time was not supported. But these threads are pretty old and things might have changed (see below).
You can however declare them in a sun-resources.xml file and pass it to the asadmin add-resources command.
That being said, several documents (like this one or this one) mention the deployment of application-scoped-resources defined in a sun-resources.xml bundled in the application (that will become glassfish-resources.xml in GlassFish 3.1) as part of the deploy/undeploy of the app but:
I don't know if this is relevant for 3.0.1.
I don't know the exact status, especially for JMS resources.
This would require testing.
With glassfish v4x, Connection factory and destinations(ie queue and topics) can be configured in domain.xml file under glassfish/domains/your-domain-name
Eg :
<resources>
<connector-connection-pool resource-adapter-name="jmsra" max-pool-size="250" steady-pool-size="1" name="jms/DurableConnectionFactory-Connection-Pool" description="connection factory for durable subscriptions" connection-definition-name="javax.jms.ConnectionFactory">
<property name="ClientId" description="MyID" value="MyID"></property>
</connector-connection-pool>
<connector-resource pool-name="jms/DurableConnectionFactory-Connection-Pool" description="connection factory for durable subscriptions" jndi-name="jms/DurableConnectionFactory"></connector-resource>
<admin-object-resource res-adapter="jmsra" description="PhysicalQueue" res-type="javax.jms.Queue" jndi-name="jms/MyQueue">
<property name="Name" value="PhysicalQueue">
</property>
</admin-object-resource>
</resources>