[Installation, Configuration & DEPLOYMENT] - Wrong redirects for HTTP/1.0 clients when running through AJ
by normann
Summary: When running JBoss 4.2 through an AJP/1.3 connector, JBoss 4.2 sends meaningless redirects to HTTP/1.0 clients if they didn't include Host header.
Detailed explanation:
I'm running Debian Linux "etch" with Sun's JDK 1.6u11, Apache2.2 + mod_jk, JBoss 4.2.3 (JDK 6 version). I've created a simple webapp directory in the deploy folder named ROOT.war, and it includes a single file named index.jsp with this contents:
<% response.sendRedirect("/test"); %>
After starting up JBoss, I make an HTTP/1.0 request for the URL /:
jbosstest:~# telnet localhost 80
| Trying 127.0.0.1...
| Connected to localhost.
| Escape character is '^]'.
| GET / HTTP/1.0
|
| HTTP/1.1 302 Moved Temporarily
| Date: Thu, 22 Jan 2009 17:04:53 GMT
| Server: Apache/2.2.3 (Debian) mod_jk/1.2.18
| X-Powered-By: Servlet 2.4; JBoss-4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181439)/JBossWeb-2.0
| Set-Cookie: JSESSIONID=F4EF264027A06BC0A34849F7E2683BFE; Path=/
| Location: http://localhost:8009/test
| Content-Length: 0
| Connection: close
| Content-Type: text/html;charset=ISO-8859-1
|
| Connection closed by foreign host.
The response is (as expected) a redirect to /test, but the hostname (localhost) and port (8009) are meaningless.
If I include the Host header in the request (this is not required for HTTP/1.0 requests) or make any HTTP/1.1 request (which will includes the Host header), the server has the expected behavior and sends a redirect to the server itself (in my case jbosstest.mydomain) on the correct port (80). Also, this is only an issue when running through the AJP/1.3 connector, the HTTP/1.1 connector works fine.
I've checked with other JBoss versions, and all versions from the 4.2 and 5 series has this behavior. The latest 4.0 version (4.0.5.GA) sends the correct redirect in all cases, so this issue seems to have been introduced in the JBoss 4.2 series (which switched from Tomcat 5.5 to JBossWeb 2.0).
Does anyone know how to fix this? It seems this new behaviour is useless to some or all HTTP/1.0 clients.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4204242#4204242
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4204242
17 years, 3 months
[Installation, Configuration & DEPLOYMENT] - Re: TCLFilter in JBoss 4.2.3
by alz_ORDIX
Hello Peter,
Yes, I have changed the name of the Log4J configuration file from 'log4j.xml' to ' jboss-log4j.xml' and the logging works fine, except the TCLFilter. But I didn't do any changes to the file content. Is there anything elso to do?
Here the complete file content of my 'jboss-log4j.xml:'
| <?xml version="1.0" encoding="UTF-8"?>
| <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
|
| <!-- ===================================================================== -->
| <!-- -->
| <!-- Log4j Configuration -->
| <!-- -->
| <!-- ===================================================================== -->
|
| <!--
| | For more configuration infromation and examples see the Jakarta Log4j
| | owebsite: http://jakarta.apache.org/log4j
| -->
|
| <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
|
| <!-- ================================= -->
| <!-- server.log - File Appender -->
| <!-- ================================= -->
| <appender name="FILE" class="org.jboss.logging.appender.DailyRollingFileAppender">
| <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
| <param name="File" value="${jboss.server.log.dir}/server.log"/>
| <param name="Append" value="true"/>
|
| <!-- Rollover at midnight each day -->
| <param name="DatePattern" value="'.'yyyy-MM-dd"/>
|
| <layout class="org.apache.log4j.PatternLayout">
| <!-- The default pattern: Date Priority [Category] Message\n -->
| <param name="ConversionPattern" value="%d [%x] [%-5p] [...%-30.30c:%-5.5L] >> %m%n"/>
| </layout>
|
| </appender>
|
| <!-- ================================= -->
| <!-- ReMaiD - File Appender -->
| <!-- ================================= -->
| <appender name="REMAID_FILE" class="org.jboss.logging.appender.DailyRollingFileAppender">
| <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
| <param name="File" value="${jboss.server.log.dir}/remaid.log"/>
| <param name="Append" value="true"/>
|
| <!-- Rollover at midnight each day -->
| <param name="DatePattern" value="'.'yyyy-MM-dd"/>
|
| <layout class="org.apache.log4j.PatternLayout">
| <!-- The default pattern: Date Priority [Category] Message\n -->
| <param name="ConversionPattern" value="%d [%x] [%-5p] [...%-30.30c:%-5.5L] >> %m%n"/>
| </layout>
| <filter class="org.jboss.logging.filter.TCLFilter">
| <param name="AcceptOnMatch" value="true"/>
| <param name="DeployURL" value="remaid.ear"/>
| </filter>
|
| </appender>
|
| <!-- ================================= -->
| <!-- TMPC - File Appender -->
| <!-- ================================= -->
| <appender name="DEPROMOS_FILE" class="org.jboss.logging.appender.DailyRollingFileAppender">
| <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
| <param name="File" value="${jboss.server.log.dir}/depromos.log"/>
| <param name="Append" value="true"/>
|
| <!-- Rollover at midnight each day -->
| <param name="DatePattern" value="'.'yyyy-MM-dd"/>
|
| <layout class="org.apache.log4j.PatternLayout">
| <!-- The default pattern: Date Priority [Category] Message\n -->
| <param name="ConversionPattern" value="%d [%x] [%-5p] [...%-30.30c:%-5.5L] >> %m%n"/>
| </layout>
|
| <filter class="org.jboss.logging.filter.TCLFilter">
| <param name="AcceptOnMatch" value="true"/>
| <!-- IMPORTANT: In this case the DeployURL has to be project-centre and NOT project-centre.war -->
| <param name="DeployURL" value="project-centre"/>
| </filter>
| </appender>
|
| <!-- ================================= -->
| <!-- Transfer Pricing - File Appender -->
| <!-- ================================= -->
| <appender name="TRP_FILE" class="org.jboss.logging.appender.DailyRollingFileAppender">
| <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
| <param name="File" value="${jboss.server.log.dir}/trp.log"/>
| <param name="Append" value="true"/>
|
| <!-- Rollover at midnight each day -->
| <param name="DatePattern" value="'.'yyyy-MM-dd"/>
|
| <layout class="org.apache.log4j.PatternLayout">
| <!-- The default pattern: Date Priority [Category] Message\n -->
| <param name="ConversionPattern" value="%d [%x] [%-5p] [...%-30.30c:%-5.5L] >> %m%n"/>
| </layout>
| <filter class="org.jboss.logging.filter.TCLFilter">
| <param name="AcceptOnMatch" value="true"/>
| <param name="DeployURL" value="TransferPricing.ear"/>
| </filter>
|
| </appender>
|
| <!-- ============================== -->
| <!-- Append messages to the console -->
| <!-- ============================== -->
|
| <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
| <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
| <param name="Target" value="System.out"/>
|
| <layout class="org.apache.log4j.PatternLayout">
| <!-- The default pattern: Date Priority [Category] Message\n -->
| <param name="ConversionPattern" value="%d{ABSOLUTE} [%x] [%-5p] [...%-30.30c:%-5.5L] >> %m%n"/>
| </layout>
| </appender>
|
|
| <!-- ========================= -->
| <!-- Limit categories -->
| <!-- ========================= -->
|
| <!-- Limit the org.apache category to INFO as its DEBUG is verbose -->
| <category name="org.apache">
| <priority value="INFO"/>
| <appender-ref ref="FILE"/>
| </category>
|
| <!-- Limit the org.jboss.serial (jboss-serialization) to INFO as its DEBUG is verbose -->
| <category name="org.jboss.serial">
| <priority value="INFO"/>
| <appender-ref ref="FILE"/>
| </category>
|
| <!-- Limit the org.jgroups category to WARN as its INFO is verbose -->
| <category name="org.jgroups">
| <priority value="WARN"/>
| <appender-ref ref="FILE"/>
| </category>
|
| <!-- Limit the jacorb category to WARN as its INFO is verbose -->
| <category name="jacorb">
| <priority value="WARN"/>
| <appender-ref ref="FILE"/>
| </category>
|
| <!-- Limit JBoss categories -->
| <category name="org.jboss">
| <priority value="INFO"/>
| <appender-ref ref="FILE"/>
| </category>
|
|
| <!-- ========================= -->
| <!-- TRP_LOGGING -->
| <!-- ========================= -->
| <category name="net.tmobile.trp">
| <priority value="INFO" />
| <appender-ref ref="TRP_FILE"/>
| </category>
|
| <!-- ========================= -->
| <!-- REMAID_LOGGING -->
| <!-- ========================= -->
|
| <category name="net.tmobile.remaid">
| <priority value="INFO" />
| <appender-ref ref="REMAID_FILE"/>
| </category>
|
|
|
| <category name="net.tmobile.remaid.action.UserAdminAction">
| <priority value="DEBUG" />
| </category>
|
| <category name="net.tmobile.remaid.action.LoginAction">
| <priority value="DEBUG" />
| </category>
|
| <category name="net.tmobile.remaid.usermngmnt.User">
| <priority value="DEBUG" />
| </category>
|
| <category name="net.tmobile.remaid.service.PeopleLDAPServiceBean">
| <priority value="DEBUG" />
| </category>
|
| <category name="net.tmobile.remaid.action.TimeRecordingAction">
| <priority value="DEBUG" />
| </category>
|
| <category name="test.tmpc.TmpcTest">
| <priority value="DEBUG" />
| </category>
|
| <category name="net.tmobile.remaid.util.TmpcProjectImporterBean">
| <priority value="DEBUG" />
| </category>
|
| <category name="net.tmobile.remaid.action.ResetPasswordAction">
| <priority value="DEBUG" />
| </category>
|
| <category name="net.tmobile.remaid.action.UserDetailsAction">
| <priority value="DEBUG" />
| </category>
|
| <category name="net.tmobile.remaid.action.ImportProjectsAction">
| <priority value="DEBUG" />
| </category>
|
| <category name="net.tmobile.remaid.action.RegisterAction">
| <priority value="DEBUG" />
| </category>
|
| <!-- ========================= -->
| <!-- NON-REMAID PRIORITIES -->
| <!-- ========================= -->
|
| <category name="org.hibernate">
| <priority value="INFO" />
| <appender-ref ref="REMAID_FILE"/>
| </category>
|
|
|
| <!-- ========================= -->
| <!-- Depromos Logging -->
| <!-- ========================= -->
|
| <category name="net.tmobile.depromos">
| <priority value="INFO" />
| <appender-ref ref="DEPROMOS_FILE"/>
| </category>
|
| <category name="net.tmobile.depromos.business.service.impl.Updater">
| <priority value="DEBUG" />
| </category>
|
| <category name="net.tmobile.depromos.present.menu.condition">
| <priority value="WARN" />
| </category>
|
| <category name="net.tmobile.depromos.present.struts.actions.common">
| <priority value="WARN" />
| </category>
|
| <!-- ========================= -->
| <!-- NON-DEPROMOS PRIORITIES -->
| <!-- ========================= -->
|
| <category name="org.apache.commons">
| <priority value="ERROR" />
| <appender-ref ref="DEPROMOS_FILE"/>
| </category>
|
| <category name="org.apache.struts">
| <priority value="ERROR" />
| <appender-ref ref="DEPROMOS_FILE"/>
| </category>
|
| <category name="org.apache.struts.action">
| <priority value="ERROR" />
| <appender-ref ref="DEPROMOS_FILE"/>
| </category>
|
| <category name="org.apache.cactus">
| <priority value="WARN" />
| <appender-ref ref="DEPROMOS_FILE"/>
| </category>
|
| <category name="org.apache.commons.httpclient">
| <priority value="ERROR" />
| <appender-ref ref="DEPROMOS_FILE"/>
| </category>
|
| <category name="org.apache.jsp">
| <priority value="DEBUG" />
| <appender-ref ref="DEPROMOS_FILE"/>
| </category>
|
| <category name="org.displaytag">
| <priority value="ERROR" />
| <appender-ref ref="DEPROMOS_FILE"/>
| </category>
|
| <category name="com.opensymphony">
| <priority value="ERROR" />
| <appender-ref ref="DEPROMOS_FILE"/>
| </category>
|
| <category name="com.canoo.webtest">
| <priority value="WARN" />
| <appender-ref ref="DEPROMOS_FILE"/>
| </category>
|
| <category name="httpclient">
| <priority value="WARN" />
| <appender-ref ref="DEPROMOS_FILE"/>
| </category>
|
| <category name="net.sf.navigator">
| <priority value="WARN" />
| <appender-ref ref="DEPROMOS_FILE"/>
| </category>
|
| <category name="net.sf.hibernate">
| <priority value="INFO" />
| <appender-ref ref="DEPROMOS_FILE"/>
| </category>
|
| <category name="net.sf.hibernate.cfg">
| <priority value="WARN" />
| <appender-ref ref="DEPROMOS_FILE"/>
| </category>
|
|
| <!-- ======================= -->
| <!-- Setup the Root category -->
| <!-- ======================= -->
|
| <root>
| <!-- Fuer Rechner in Bonn auskommentieren, da dort i.d.R keine Konsole zur Verfuegung steht -->
| <appender-ref ref="CONSOLE"/>
|
| </root>
|
|
| </log4j:configuration>
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4204241#4204241
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4204241
17 years, 3 months
[JBossWS] - Re: file transfer via SOAP and RPC
by mendret
after managing the server side, which works without problems, i still get problems with the client side, i tried different approaches but got errors i wasn't able to resolve, maybe someone has an idea what i'm doing wrong.
first try was with the files that wsconsume generated:
| public class Client
| {
| protected FileTransferMTOMEndpoint mtomEndpoint;
|
| public Client(URL url) {
| FileTransferMTOMService mtomService = new FileTransferMTOMService(url,
| new QName("http://127.0.0.1:8080/news_test?wsdl",
| "FileTransferMTOMService"));
| mtomEndpoint = (FileTransferMTOMEndpoint)mtomService.getFileTransferMTOMPort();
| }
|
| public void run() throws IOException {
| ((SOAPBinding)(((BindingProvider)mtomEndpoint).getBinding())).setMTOMEnabled(true);
|
| System.out.println("Uploading test2.dat and downloading test.dat");
| EditionMTOM edition2 = new EditionMTOM();
| edition2.setId("test.dat");
| edition2.setContent(new DataHandler(new FileDataSource("/tmp/test2.dat")));
|
| EditionMTOM edition = mtomEndpoint.doSomething(edition2);
| System.out.println("Content: " + edition.getContent());
| InputStream is = edition.getContent().getInputStream();
| InputStreamReader isr = new InputStreamReader(is, "UTF-8");
|
| char[] buff = new char[20];
| isr.read(buff);
| isr.close();
| is.close();
| for (char b : buff) {
| System.out.print(b);
| }
| }
|
| public static void main(String[] args) {
| try {
| Client client = new Client(new URL("http://127.0.0.1:8080/news_test?wsdl"));
| client.run();
| }
| catch (Exception e) {
| e.printStackTrace();
| }
| }
| }
|
here i get the following error:
| Exception in thread "main" java.lang.NoSuchMethodError: method org.jboss.ws.core.utils.JBossWSEntityResolver.getEntityMap with signature ()Ljava.util.Map; was not found.
| at org.jboss.ws.tools.JavaToXSD.resolveNamespaceURI(JavaToXSD.java:224)
| at org.jboss.ws.tools.JavaToXSD.parseSchema(JavaToXSD.java:171)
| at org.jboss.ws.tools.wsdl.WSDL11Reader.processTypes(WSDL11Reader.java:402)
| at org.jboss.ws.tools.wsdl.WSDL11Reader.processDefinition(WSDL11Reader.java:179)
| at org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory.parse(WSDLDefinitionsFactory.java:126)
| at org.jboss.ws.metadata.umdm.ServiceMetaData.getWsdlDefinitions(ServiceMetaData.java:293)
| at org.jboss.ws.metadata.builder.jaxws.JAXWSClientMetaDataBuilder.buildMetaData(JAXWSClientMetaDataBuilder.java:84)
| at org.jboss.ws.core.jaxws.spi.ServiceDelegateImpl.<init>(ServiceDelegateImpl.java:136)
| at org.jboss.ws.core.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:62)
| at javax.xml.ws.Service.<init>(Service.java:79)
| at client.FileTransferMTOMService.<init>(FileTransferMTOMService.java:36)
| at client.Client.<init>(Client.java:19)
| at client.Client.main(Client.java:49)
|
the next try was a DII client, which looks like this:
| public class DII2Client {
|
| public static void main(String[] args) {
| try {
| QName serviceName = new QName(
| "http://127.0.0.1:8080/news_test?wsdl",
| "FileTransferMTOMService");
| ServiceFactory factory = ServiceFactory.newInstance();
| Service service = factory.createService(serviceName);
| QName operationName = new QName("http://127.0.0.1:8080/news_test?wsdl", "doSomething");
| QName operationPort = new QName("http://127.0.0.1:8080/news_test?wsdl", "FileTransferMTOMPort");
|
| Call call = service.createCall(operationPort);
| call.setOperationName(operationName);
| call.setProperty("BindingType", "http://schemas.xmlsoap.org/wsdl/soap/http?mtom=true");
| call.setTargetEndpointAddress("http://127.0.0.1:8080/news_test?wsdl");
|
| call.addParameter("arg0", new QName("http://127.0.0.1:8080/news_test?wsdl", "arg0"), EditionMTOM.class, ParameterMode.IN);
|
| EditionMTOM edition2 = new EditionMTOM();
| edition2.setId("test.dat");
| edition2.setContent(new DataHandler(new FileDataSource("/opt/cats/test.dat")));
|
| Object[] params = {edition2};
|
| SimpleDateFormat formatter = new SimpleDateFormat ("yyyy.MM.dd 'at' HH:mm:ss ");
|
| System.out.println("before call:" + formatter.format(new Date()));
| EditionMTOM result = (EditionMTOM)call.invoke(params);
| System.out.println("after call:" + formatter.format(new Date()));
| System.out.println(result);
| } catch (Exception ex) {
| ex.printStackTrace();
| }
| }
| }
|
as long as i call: factory.createService(serviceName);
I get the following error:
| java.rmi.RemoteException: Call invocation failed; nested exception is:
| java.lang.UnsupportedOperationException: setProperty must be overridden by all subclasses of SOAPMessage
| at org.jboss.ws.core.jaxrpc.client.CallImpl.invokeInternal(CallImpl.java:533)
| at org.jboss.ws.core.jaxrpc.client.CallImpl.invoke(CallImpl.java:274)
| at client.DII2Client.main(DII2Client.java:43)
| Caused by: java.lang.UnsupportedOperationException: setProperty must be overridden by all subclasses of SOAPMessage
| at javax.xml.soap.SOAPMessage.setProperty(SOAPMessage.java:441)
| at org.jboss.ws.core.soap.SOAPMessageImpl.<init>(SOAPMessageImpl.java:82)
| at org.jboss.ws.core.soap.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:169)
| at org.jboss.ws.core.CommonSOAP11Binding.createMessage(CommonSOAP11Binding.java:57)
| at org.jboss.ws.core.CommonSOAPBinding.bindRequestMessage(CommonSOAPBinding.java:156)
| at org.jboss.ws.core.CommonClient.invoke(CommonClient.java:290)
| at org.jboss.ws.core.jaxrpc.client.CallImpl.invokeInternal(CallImpl.java:514)
| ... 2 more
|
if i try to run it with: Service service = factory.createService(new URL("http://127.0.0.1:8080/news_test?wsdl"),serviceName);
i get this error:
| Exception in thread "main" java.lang.NoSuchMethodError: org.jboss.ws.core.utils.JBossWSEntityResolver.getEntityMap()Ljava/util/Map;
| at org.jboss.ws.tools.JavaToXSD.resolveNamespaceURI(JavaToXSD.java:224)
| at org.jboss.ws.tools.JavaToXSD.parseSchema(JavaToXSD.java:171)
| at org.jboss.ws.tools.wsdl.WSDL11Reader.processTypes(WSDL11Reader.java:402)
| at org.jboss.ws.tools.wsdl.WSDL11Reader.processDefinition(WSDL11Reader.java:179)
| at org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory.parse(WSDLDefinitionsFactory.java:126)
| at org.jboss.ws.metadata.umdm.ServiceMetaData.getWsdlDefinitions(ServiceMetaData.java:293)
| at org.jboss.ws.metadata.builder.jaxrpc.JAXRPCClientMetaDataBuilder.buildMetaData(JAXRPCClientMetaDataBuilder.java:114)
| at org.jboss.ws.metadata.builder.jaxrpc.JAXRPCClientMetaDataBuilder.buildMetaData(JAXRPCClientMetaDataBuilder.java:85)
| at org.jboss.ws.core.jaxrpc.client.ServiceImpl.<init>(ServiceImpl.java:109)
| at org.jboss.ws.core.jaxrpc.client.ServiceFactoryImpl.createService(ServiceFactoryImpl.java:155)
| at org.jboss.ws.core.jaxrpc.client.ServiceFactoryImpl.createService(ServiceFactoryImpl.java:126)
| at client.DII2Client.main(DII2Client.java:23)
|
i found a post regarding the last error but it was never resolved:
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4063940#4063940
so it would be nice if someone has an idea what is causing these problems and how to resolve them
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4204239#4204239
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4204239
17 years, 3 months