What is the use of org.apache.struts.chain.ComposableRequestProcessor in struts and java.nio.charset.IllegalCharsetNameException - jboss

We ran into a migration issue where in we are migrating an application from JBoss 4.2.1.GA to JBoss EAP 7.0.0.GA. The exception encountered is as below.
java.lang.RuntimeException: java.nio.charset.IllegalCharsetNameException:
at io.undertow.servlet.spec.RequestDispatcherImpl.forwardImpl(RequestDispatcherImpl.java:226)
So we have a fix for the same which involves
Adding the below in the struts config.xml file.
this line in config
<controller processorClass="org.apache.struts.chain.ComposableRequestProcessor"
locale="true" nocache="false" contentType="text/html; charset= UTF8">
<set-property property="maxFileSize" value="7M"/>
</controller>
has been changes to
tag from charset= UTF8 to charset= ISO-8859-1"
and an additional property
This has resolved the issue but wants to know what is the proper use of class ComposableRequestProcessor. And why it is helping our solution here.
We don't see a proper document or blog on the net explaining why and when we need to add this configration. What is the advantage of doing so?
Also, we want to know JBoss 4.2.1.GA the page-context encoding was not enforced but in JBoss EAP 7.0.0.GA we need to define it as ISO else it won't work in windows server environment.
We know it has to do with some Undertow implementation over the earlier Apache Tomcat HTTPs implementation framework used by JBoss.
Any help by pointing to right document or information is widely appreciated.

Related

Jboss load system properties from file

Can I make jboss load system properties from a file without writing any explicit code for it?
Yes you can.
In JbossAS versions prior to 7.x there is PropertiesService. It's dead simple to use. I am using it with JBoss 5.1.0.GA, and it works like a charm.
Unfortunatelly PropertiesService mbean is absent in JBossAS 7.x, but there are other ways as described in official admin guide.
Here is another solution. Post author claims it's possible to list your properties files in command line while starting server instance:
./standalone.sh --properties=1.properties --properties=2.properties
and their contents should be added to System Properties.

Getting error Named query not found: UnescalatedDeadlines

I'm trying to create a jbpm human task web application and deployed it in jboss as 7.
Adhering to the deployment structure i have placed the orm.xml in resources META-INF folder along with persistent.xml and it's having the required unescalateddealines named query. But still im getting the exception
Caused by: java.lang.IllegalArgumentException: Named query not found: UnescalatedDeadlines
at org.hibernate.ejb.AbstractEntityManagerImpl.createNamedQuery(AbstractEntityManagerImpl.java:108) [hibernate-entitymanager-3.4.0.GA.jar:]
at org.jbpm.task.service.TaskService.<init>(TaskService.java:109) [jbpm-human-task-5.1.0.Final.jar:]
at org.jbpm.task.service.TaskService.<init>(TaskService.java:92) [jbpm-human-task-5.1.0.Final.jar:]
at com.sample.taskserver.HumanTaskStartupServlet.init(HumanTaskStartupServlet.java:52) [classes:]
In nutshell, the orm.xml file is not being identified by hibernate.
what's the configuration that im missing or what could be the problem.
kindly help me in this regard.
It's probably best to add direct references to the orm files you're using, to make sure they are being picked up. For example, in your persistence.xml you could add the following:
<mapping-file>META-INF/Taskorm.xml</mapping-file>
Do you have multiple orm.xml files inside your application? Probably JBoss AS is just picking one. Usually if you merge those files it will work.
Cheers
I had the same problem, but I solved it.
My jbpm version is 5.3.
I deployed and set it up according to the guide.
I used two persistent-unit, one for jbpm/process and one for task.
I have this taskorm.xml, but in some situation jbpm will only search jbpm persistent-unit.
but taskorm.xml is defined in task unit.
You need to combine it into one.
For me I am using jbpm 5.4.0.FINAL but referred to the example with bundled presistence.xml having only orm.xml
Added Taskorm.xml resovled the problem

Glassfish encoding

I'm using the code in this example example and in the runUpdate() function which i put in a javabean in a web application in Netbeans 6.8 with Glassfish v3.
It seems i have an encoding problem because question marks appear in the table.
I have tried so far:
In nbproject->private->private.properties add runtime.encoding=UTF-8>
In project->properties->sources->encoding utf-8
In program files->netbeans->etc->netbeans_conf in netbeans_default_options i add -J-DFile.encoding=UTF-8
In project->properties->build->compiling->additional compiler options -encoding utf-8
In sun-web.xml i added <locale-charset-info default-locale="UTF-8">
<locale-charset-map locale="" charset=""/>
<parameter-encoding default-charset="UTF-8"/>
</locale-charset-info>
Also when i use system.out.print() in the glassfish output panel i get gibberish.
I'm in the last level of madness please take a look.
Thank you.
EDIT
Also when i do listing .5 i get a glassfish error:
WARNING: WEB0500: default-locale attribute of locale-charset-info element is being ignored
Have you tried using glassfish-web.xml instead of sun-web.xml ?
To change default Glassfish POST fields encoding, I put this to WEB-INF/glassfish-web.xml, and it worked (I use glassfish 3.1.2):
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD
GlassFish Application Server 3.1 Servlet 3.0//EN"
"http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app>
<parameter-encoding default-charset="UTF-8" />
</glassfish-web-app>
I'm not sure if it will help you, but may help other people having the same problem as me.
Glassfish uses ISO-8859-1 encoding by default. See http://download.oracle.com/docs/cd/E19798-01/821-1752/beafu/index.html for more information.
Are you sure your browser is set to UTF-8. By default most browsers do not display in UTF.
Start with the browser and work backwards. Is your datasource storing the data in UTF-8? By default Java is in UTF-8 so I am not sure that GF is your real issue.

Declaring a JNDI variable in JBoss 4.0.5

I want to declare a new JNDI variable in the JBoss 4.0.5 server. Can someone please explain how this can be done?
waiting for your replies.
Thanks.
Found these two links that can help...
create a file called filename-service.xml under $CATALINA_BASE$/deploy directory with contents as indicated in these links
http://www.redhat.com/docs/manuals/jboss/jboss-eap-4.2/doc/Server_Configuration_Guide/Additional_Naming_MBeans-JNDI_Binding_Manager.html
check a jboss jira, JBPAPP-2809 for correction in xmlns:jndi
Have a look here and specifically here. You need to add an entry in the ejb-jar.xml file of your application.
I am facing this probelm too today. Looks like to add a simple jndi entry on the app server, in JBoss one will have to create a new file $CATALINA_BASE/conf/context.xml and invoke a MBean to add the variable and its value.
In server like websphere you can pass new values in jndi.properties, which jboss 5.0.0 upwards does not like.
Very Bad that there is absolutely NO DOCUMENTATION in jboss/docs that indicate anything on this topic.

JBoss: What does the warning EJBTHREE-1246 from the InterceptorRegistry mean?

I am currently developing an EJB 3.0 based application on the JBoss AS 5.0.0.GA and just recently the following warning showed up in the server log:
09:50:19,735 WARN [InterceptorsFactory] EJBTHREE-1246: Do not use InterceptorsFactory with a ManagedObjectAdvisor, InterceptorRegistry should be used via the bean container
09:50:19,735 WARN [InterceptorsFactory] EJBTHREE-1246: Do not use InterceptorsFactory with a ManagedObjectAdvisor, InterceptorRegistry should be used via the bean container
09:50:19,735 WARN [InterceptorRegistry] applicable interceptors is non-existent for ...
...
The warnings are generated as soon as an EJB (a stateless session bean) is injected into a backing bean of my JSF web-application. The beans do work without problems though, but I still would like to know where that warning comes from and what I can do to avoid it.
I have already searched a bit around, but haven't found a good answer (some say, bean developers do not have to worry, but its a warning, so I'd like to have a better solution):
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=147292
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4180366
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4140136
JBoss JIRA Issue about the warning (Not that helpful in my opinion)
So has anyone an explanation what causes the warning (in terms of a bean developer, not application server developer) and what to do to avoid it?
Update: I've just upgraded JBoss to 5.0.1.GA (Download, Release-Notes) but unfortunatly the warning still appears.
As far as I understand all the available sources on this warning, it is nothing a user of JBoss 5 can do anything about and is essentially just a reminder for the developers of JBoss that they use their own classes wrong.
Following the advice from the developers, I am now ignoring it by changing my logging configuration in conf/jboss-log4j.xml. I've just added:
<category name="org.jboss.ejb3.interceptors">
<priority value="ERROR" />
</category>
Even the JBoss EJB3 tutorial/documentation says you can safely ignore these warnings. Well if everyone can ignore these don't log them! It's frustrating to see this issue isn't being fixed.
I had the same problem, modify the ejb3-interceptors-aop.xml, and now works ok.
I've tried this modification in ejb3-interceptors-aop.xml
I've comment these lines :
<aspect name="InterceptorsFactory" factory="org.jboss.ejb3.interceptors.aop.InterceptorsFactory" scope="PER_INSTANCE"/>
<advice name="invoke" aspect="InterceptorsFactory"/>
and it Works
The warnings no longer appear in JBoss 5.1.0, but adding the category as Simon posted eliminates the logging of the warnings in 5.0.x
Just follow the steps
Stop JBoss and right click on the server instance and select clean
right click on the project and select run -> run configurations
select classpath -> add jars
Add Jars from JBoss ASHOME/client - jbossall-client.jar,JBoss ASHome/common/lib - all jars.
Apply and run.