JSF Converter Error
Hi, I have the following:
JSF 1.2 RI
Sun App Server 9 Update 1 Patch 1
Models:
public interface Model {
int getId();
String getName();
public class Model1 implements Model {
public int getId() {
return 1;
public String getName() {
return "One";
public class Model2 implements Model {
public int getId() {
return 2;
public String getName() {
return "Two";
Controller:
public class TestController {
private Model model;
private List<Model> models;
public TestController() {
models = new ArrayList<Model>();
models.add(model = new Model1());
models.add(new Model2());
public Model getModel() {
return model;
public void setModel(Model model) {
this.model = model;
public List<SelectItem> getModels() {
List<SelectItem> list = new ArrayList<SelectItem>();
for (Model model : models)
list.add(new SelectItem(model, model.getName()));
return list;
public Model findModel(int id) {
for (Model model : models) {
if (model.getId() == id)
return model;
return null;
Converter:
public class ModelConverter implements Converter {
public Object getAsObject(FacesContext facesContext, UIComponent uiComponent, String string) {
TestController controller = (TestController) facesContext.getExternalContext().getSessionMap().get("testController");
return controller.findModel(Integer.parseInt(string));
public String getAsString(FacesContext facesContext, UIComponent uiComponent, Object object) {
return String.valueOf(((Model) object).getId());
View:
<%@ page contentType="text/html" %>
<%@ page pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Test JSF</title>
</head>
<body>
<f:view>
<h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
<h1>Test JSF</h1>
<h:form>
<h:panelGrid columns="2">
<h:outputText value="Model:"/>
<h:selectOneMenu value="#{testController.model}">
<f:selectItems value="#{testController.models}"/>
</h:selectOneMenu>
</h:panelGrid>
</h:form>
</f:view>
</body>
</html>
faces-config.xml:
<?xml version='1.0' encoding='UTF-8'?>
<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
version="1.2">
<converter>
<converter-for-class>com.test.model.Model</converter-for-class>
<converter-class>com.test.converter.ModelConverter</converter-class>
</converter>
<managed-bean>
<managed-bean-name>testController</managed-bean-name>
<managed-bean-class>com.test.controller.TestController</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
</faces-config>
The problem:
When I run the app, JSF throws the following error:
javax.servlet.ServletException: Cannot convert com.test.model.Model2@ba30aa of type class com.test.model.Model2 to class com.test.model.Model1
root cause
java.lang.IllegalArgumentException: Cannot convert com.test.model.Model2@ba30aa of type class com.test.model.Model2 to class com.test.model.Model1Is there any limitation on converters to prevent using a single Converter for a base class (or interface like Model) and subclasses (like Model1 and Model2)?
I've tried this using JSF 1.1 RI, Apache MyFaces 1.1 and the error is still there.
Thanks!
This sounds like Issue 442, which was resolved in 1.2_03. If I recall right, V1 P1 is 1.2_02. Please upgrade JSF to 1.2_04 [2]. The download section has an updater for GlassFish.
[1] https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=442
[2] https://javaserverfaces.dev.java.net/servlets/ProjectDocumentList?folderID=7089&expandFolder=7089&folderID=0
Similar Messages
-
CONVERTING ERROR MESSAGE TO WARNING MESSAGE
HI GURUS,
CAN ANY ONE GIVE ME IDEA HOW TO CONVERT ERROR MESSAGE TO WARNING MESSAGE IN QM MODULE.WHEN I AM POSTING STOCK FROM QUALITY TO UNRESTRICTED. BECAUSE IAM GETTING ERROR WHEN IAM POSTING STOCK GIVING ERROR TRANSFER POSTING THROUGH QUALITY ONLY. MY ERROR MESSAGE NO IS QA495. I TRIED ALL POSIBILITES. BECAUSE I AM NOT GETTING INSPECTION LOT BUT STOCK IN QUALITY. GIVE ME IDEA.
BHAKTADear BHAKTA,
it's not possible to customize every message in SAP System to warning or error.
It depends on the coding. I have found message QA495 twice in coding, both times it's hard coded in Inlcude MM07MQSS. So it's not possible in standard to change this.
How to find this information:
SE91
-> enter the message
-> button 'display'
-> select the line
-> button 'where-used list' (CRTLSHIFTF3)
-> now you get a list of all programms where the message is used
Now you can check if message type is hard coded or read in customizing.
If you really want this you have to modifiy the coding. But I would not recommed this, as hard coded errors are necessary to make sure that the standard scenarios work correctly.
Regards,
Sabine -
Converting error message to warning in ME22n
Hello guys,
In ME22n i am not able to delete one material line item,as its displays" Invoices pending for delivery costs (function not possible)",
This is error message,if its possible to convert error message to warning then i wil be able to delete,have made error message to waring message in settings by giving "W" stil i am not able to delete. Please do suggest me. Message number is "06119"Dear BHAKTA,
it's not possible to customize every message in SAP System to warning or error.
It depends on the coding. I have found message QA495 twice in coding, both times it's hard coded in Inlcude MM07MQSS. So it's not possible in standard to change this.
How to find this information:
SE91
-> enter the message
-> button 'display'
-> select the line
-> button 'where-used list' (CRTLSHIFTF3)
-> now you get a list of all programms where the message is used
Now you can check if message type is hard coded or read in customizing.
If you really want this you have to modifiy the coding. But I would not recommed this, as hard coded errors are necessary to make sure that the standard scenarios work correctly.
Regards,
Sabine -
Date format convert error in XML interface based Adobe interactive forms
Hi experts,
I am using XML interface based Adobe interactive form in Web Dynpro ABAP. The form just contains some date fields and numeric fields.
When I test the WD Application, the date fields appear like 0000-00-00 at the first time. And then I set the form input disable, and get the XML from the form, at the same time I get the warning message, 'date format convert error'. By the way, I have set the edit pattern, display pattern and data pattern of the date field to YYYYMMDD, but there seems no effect.
Could you tell me how to set the default date format in date field Or clear the 0000-00-00?
And another question, all of the numeric fields in the form appear like 0.0, how can I set it to empty when the form initialize?
Best Regards,
Guo Guo QingHi Chintan,
Thank you for your reply.
I have tried every possible changes on the Date field, locale, pattern. But still no effect. When the PDF come up in the WDA program, the date field is still '0000-00-00', and then I export the XML date of the form, there is also '0000-00-00' in the interface field.
I can't clear the '0000-00-00' in initializiation event using javascript because if I need to open the form again, if I do this, the value user input could be cleared.
I also try using Javascrip like this
if this.rawValue == "0000-00-00"
{ this.rawValue = ""; }
The code above can't clear the initializiation zeros too.
Have you used the XML interface based online Adobe Forms? I have used XML PDF forms for output before, that's perfect. But the input forms seems so strange.
Best Regards,
Guo Guo Qing -
i18 converter error shown when trying to connect where data base password has numeric and special characters.
The error is oracle.i18n.text.converter.CharacterConverterOGS.getInstance(1).....
Is there any path or classpath environment variable setting to be done to get rid of this error...
Thanks in advance.BalusC wrote:
Amod wrote:
<t:selectOneMenu id="exterroDirectory" forceId="true" value="#{dropDownHandler.dropDownBean.exterroDirectory.ExterroId}" required="true" >The property 'ExterroId' should be written as 'exterroId'.The property 'ExterroId' should be written as 'exterroId'.
Yes that is correct, but I by mistake have declared the variable also as ExterroId. I will correct that. -
Converter Error in Seeburger Mapping Designer
Hi,
I try to convert an ANSIX12 document from EDI to XML with the Seeburger Mapping Designer, but I have an error:
Converter Error or Warning:
[Error:ID=2023;LEVEL=1] InhouseDocReader readNextSegment(): offset[1211(read Segment :
)]: caught ReadingException: Length limit exceeded - no SEG. delim. found!!!
DESCRIPTION: InhouseDocReader causes an ReadingException while trying to read the next segment of current file, abort.
If I check the "setIgnoreCRLF" in the "Source Options", the mapping works, but when I deploy the mapping to XI, I have the same error, on the deploy, the map not recognize the "setIgnoreCRLF" within XI.
How can I deploy this check to XI or how I do to mapping ignore the CRLF without the "Source Options"??
Greetings,
HerveyHi,
I am also facing same problem.
How did you corrected your file.
Do I need to redeploy my mapping on PI
Regards,
Akshay. -
Problem overriding default JSF conversion error messages
Hello !
I have a problem to override default JSF conversation error message. I have an inputText which is binded to BigDecimal attribute, so when I enter a character in that field I get this error message: "- Conversion failed."
I think I need to register the message bundle in my faces config, and put the key of this error message to my properties file.. am I right ?
Can somebody help me with this ? Which key I need to put into the properties file ?
MiljanGet [Sun's Java EE tutorial |https://www.sun.com/offers/details/JavaEETutorial.xml?cid=20090723ZA_TACO_JVEE_0004] and read the relevant section so you don't have to guess what you need to do.
-
Convert error from 2003 word and excel to pdf.
Have Acrobat 8 Pro with vista business. Can no longer convert 2003 word or excel files to pdf format. Get a convert error, please corect problem. Other file formats work file. Am current on updates. Any ideas?
So what you are saying
On the server we have to install LiveCycle and MS Office. LiveCycle will have some API exposed that will take Word or Excel as inut parameter. Then LiveCycle will use MS Office internally to convert the office document into PDF.
Do you happen to know the memory footprints this procees will have?
Also how much does LiveCycle cost? -
Photoshop convert error: Retrieving the COM class factory for component with CLSID
Hi Guys,
I am new to this forum and have already tried looking for the resolution for this error but unsucessful til now. Actually we have photoshop cs4 installed in our server and we use it to create thumbnails whenever a PSD file is uploaded to the application.
It was working fine but since few days, i am seeing the error (Photoshop convert error: Retrieving the COM class factory for component with CLSID {6568E194-96D8-4035-9087-99E4F75E9ABC} failed due to the following error: 80080005. ) in logs and also the server is not able to generate proxies.
Please help me get this sort out since it is in production.
Thanks,
YogeshHi,
Do you think that Crystal Report dont work with BO on Vista?
Because Really I did not find the solution.
Thanks in Advance -
Signed in. Was offered a different email address at signin, ignored. Signed into account fine. Tried to convert PDF to Word as I have numerous times before. This time I keep getting the error message "Invalid email address or password. Click "sign up" if you don't have an account". I've checked my ID page and everything is correct. Need my documents NOW. Can you help me?
I was unable to view this response. I checked the blog but this post appeared at the bottom of the page and only indicated there was a post but no text appeared. Does it make a difference that I've been viewing the blog on my iPad which does not support Adobe products?
Thank you so much for responding to my post. I'm glad I'm not the only one facing frustration.
Re: PDF converter error
created by Atimoth in Adobe ExportPDF - View the full discussion
The problem does not seem to be with the version of Adobe Reader that I have. It seems to be a problem when connecting to your server. There are other forum posts where others are experiencing the same difficulty.
Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/6070278#6070278
Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/6070278#6070278
To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/6070278#6070278. In the Actions box on the right, click the Stop Email Notifications link.
Start a new discussion in Adobe ExportPDF at Adobe Community
For more information about maintaining your forum email notifications please go to http://forums.adobe.com/thread/416458?tstart=0. -
Injecting EJB to JSF Converter
Is it possible to inject EJB (or at least EntityManager) to JSF Converter or Validator?
I don't know if i'm missing something or is it just impossible - it works when injecting EJB into Managed Bean.
Thanks.
Sławek S.Slawek_Sobotka wrote:
Thanks.
So I'll redefine my question to be problem oriented:
I have SelectItem that contains Address object.
I have implemented AddressConverter so that it converts Adress to String simply by using it's id.
How to convert back: from string (address's id) do Address object?Map it. Two general ways are mentioned here: [http://balusc.blogspot.com/2007/09/objects-in-hselectonemenu.html].
I would like to load it form DB...That's a bit too expensive for less or more static data.
Another solutions are:
- SelectItem should contain address.id instead of address. Than no converter is need. My ManagedBean is reposnsible for translating ids do entities. Works but primitive.JSF can't help that HTTP/HTML only understands Strings (by the way, primitives are also already implicitly converted by EL, you only don't know that).
- Converter is created by factory method of Managed Bean. MB sets address list to the converter while creating it. List shouldn't be huge if it is used in GUI.
drawback: loading list in BB twice because converter is used while rendering and while decoding.
- In converter try to possess MB that has EJB and call method that reutrns entities, sth like this: facesContext.getApplication().getELResolver()...Reloading static data on every request makes als no sense.
Retoric question: what for are useful JSF Converters?To convert between Object and String, so that it can be passed through HTTP request/response and displayed/taken in HTML. -
Arithmatic or convertion error
HI Experts!
iam running deltas daily,toady i got a error arithmatic or convertion error found in routine_0006 for record 12568.i tried to debug but i could not get solution.
I compared this record with other records.still i dint find any errors.In this datapacket all the records having same billing document.One of the field(billing quantity in) is zero.can it have the value zero.how to find the error in that record.can any expert help me out.
diyathere could be chars in a numeric field. there could be some invisible chars. did u look the record in the hex editor. check if there are any alpha conversion infobjects then you need to receive the values in that format.
you can try:
note down the values
remove the request from the datatarget
psa > maintain > record > enter all the values manually.
reload the delta from the psa..
let us know what u find out.
Regards,
BWer
assign points if helfpul. -
hi
IDE: Netbeans7.1
Server:Weblogic 10.0
JSF:2.1
JPA:toplink essential JPA 1.0
When i`m inserting JPA in my JSF project following error Shown, Any one have Idea abt it?
init:
deps-module-jar:
deps-ear-jar:
deps-jar:
library-inclusion-in-archive:
library-inclusion-in-manifest:
compile:
compile-jsps:
C:\Users\IS678\Documents\NetBeansProjects\GApp\nbproject\build-impl.xml:730:
Deployment error:
null
See the server log for details.
at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:232)
at org.netbeans.modules.j2ee.ant.Deploy.execute(Deploy.java:106)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor117.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:284)
at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:539)
at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
Caused by: java.lang.IllegalThreadStateException
at java.lang.ThreadGroup.addUnstarted(ThreadGroup.java:843)
at java.lang.Thread.init(Thread.java:348)
at java.lang.Thread.<init>(Thread.java:608)
at java.util.concurrent.Executors$DefaultThreadFactory.newThread(Executors.java:542)
at java.util.concurrent.ThreadPoolExecutor.addThread(ThreadPoolExecutor.java:672)
at java.util.concurrent.ThreadPoolExecutor.addIfUnderMaximumPoolSize(ThreadPoolExecutor.java:721)
at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:657)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:78)
at org.netbeans.modules.j2ee.weblogic9.optional.WLStartServer.startDeploymentManager(WLStartServer.java:195)
at org.netbeans.modules.j2ee.deployment.impl.ServerInstance._start(ServerInstance.java:1454)
at org.netbeans.modules.j2ee.deployment.impl.ServerInstance.startTarget(ServerInstance.java:1405)
at org.netbeans.modules.j2ee.deployment.impl.ServerInstance.startTarget(ServerInstance.java:1210)
at org.netbeans.modules.j2ee.deployment.impl.ServerInstance.start(ServerInstance.java:1087)
at org.netbeans.modules.j2ee.deployment.impl.ServerInstance.start(ServerInstance.java:1248)
at org.netbeans.modules.j2ee.deployment.impl.ServerInstance.getTargetMap(ServerInstance.java:548)
at org.netbeans.modules.j2ee.deployment.impl.ServerInstance.getTargets(ServerInstance.java:516)
at org.netbeans.modules.j2ee.deployment.impl.DeploymentHelper.deployJdbcDrivers(DeploymentHelper.java:93)
at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:180)
... 16 more
BUILD FAILED (total time: 10 seconds)Are you using MS's XP OS?
I had this exact same problem with XP home edition when I had it using FAT instead of NTFS. I converted to NTFS and all has been well ever since. -
JSF Conversion error for h:selectManyListbox
There's an exception (*Conversion error occurred*) from JSF on <h:selectManyListbox> component for id availableUsers which is bound to myBean*.*roleId
Now myBean*.*roleId is of Long datatype and so is the usersList*.*SelectItem*.*value. So, would not be any datatype mismatch. Tried using a converter too with no luck.
If you have come across any such issue, please do let me know, thanks!
Exception
javax.faces.model.SelectItem@1b115c1b]
[8/14/08 1:59:44:645 IST] 00000061 jsf E com.sun.faces.context.FacesContextImpl addMessage Adding Message[sourceId=emailmessage:*availableUsers* ,summary=*Conversion error occurred*.)
[8/14/08 1:59:44:661 IST] 00000061 jsf E com.sun.faces.context.FacesContextImpl addMessage Adding Message[sourceId=emailmessage:selectedUsers,summary=Conversion error occurred.)
JSF
<h:selectManyListbox id="*availableUsers* " value="#{myBean.roleId}" converter="javax.faces.Long"
binding="#{myBean.usersListBox}" size="5" style="width: 138px; height: 102px">
<f:selectItems id="usersItems" value="#{myBean.usersList}"
binding="#{myBean.usersListBoxSelectItems}" />
</h:selectManyListbox></td>
CLASS
*{code}*
*class MyBean*
*private Long roleId;*
*private List usersList;*
*{code}*
usersList is an arraylist of SelectItem where each SelectItem is composed of a Long value and a String label as per the convention.I tried using a List<Long>, but getting another error now, any help would be greatly appreciated, thanks!
Error:
[8/15/08 0:11:32:692 IST] 0000007e jsf E com.sun.faces.context.FacesContextImpl addMessage Adding Message[sourceId=emailmessage:selectedUsers,summary=Validation Error: Value is not valid)
JSF Code:
h:selectManyListbox id="selectedUsers" binding="#{myBean.selectedUsersListBox}" value="#{myBean.recipientIdList}" size="5"
converter="#{myBean.recipientIdListConverter}" style="width: 138px; height: 102px">
<f:selectItems id="selectedUsersItem" value="#{myBean.recipientList}" binding="#{myBean.selectedUsersListBoxSelectItems}" />
</h:selectManyListbox>
backing Bean Code for class myBean:
{code}public List recipientList;
private ArrayList recipientIdList;
private HtmlSelectManyListbox selectedUsersListBox;
private UISelectItems selectedUsersListBoxSelectItems;
public Converter getRecipientIdListConverter() {
return new Converter() {
public Object getAsObject(FacesContext facesContext,
UIComponent component, String value)
throws ConverterException {
if (value == null)
return null;
for (Iterator i = recipientIdList.iterator(); i.hasNext();) {
Long item = (Long) i.next();
String val = String.valueOf(item);
if (val.equals(value)) {
return item;
return null;
public String getAsString(FacesContext facesContext,
UIComponent component, Object object)
throws ConverterException {
if (object instanceof SelectItem) {
return ((SelectItem) object).getValue().toString();
} else if (object instanceof Long) {
return String.valueOf(object);
} else {
return object.toString();
}{code} -
Hi,
Did anyone succeded in converting BC4J+UIX project into BC4J+JSF? Available converter fails to convert even small project with one page with one table on UIX page...
Any success stories?
LeszekHi,
When I try to run generated jspx page through struts, I get following error in browser:
500 Internal Server Error
java.lang.IncompatibleClassChangeError
at oracle.cabo.share.xml.ParseErrorUtils.getErrorMessage(Unknown Source)
at oracle.cabo.share.xml.ParseErrorUtils.log(Unknown Source)
at oracle.cabo.ui.xml.parse.UINodeParser._parseBinding(Unknown Source)
etc.
I run it through struts because converter puts on struts my simple page. It doesn't put it on faces-config. However even when I try to run it through faces (I change url in browser by adding 'faces/' and changing extension from '.do' to '.jspx' I still get an error:
500 Internal Server Error
javax.faces.el.EvaluationException: com.sun.faces.el.impl.ElException: No function is mapped to the name "ctrl:createSortableHeaderModel"
at com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:188)
at com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:154)
at oracle.adf.view.faces.bean.FacesBeanImpl.getProperty(FacesBeanImpl.java:55)
I think that converted page shouldn't contain el expressions that are used to create sortable table headers.
Anyway, converter is unable to convert so simple project into working JSF project... so it's not helping us in our work.
Leszek
P.S. I've sent simple UIX testcase to you. It's ounconverted so you may do it by yourself to be sure that the problem so not related to wrong conversion method...
Maybe you are looking for
-
In this Episode of The Complete Picture Julieanne demonstrates how to create a single vector logo out of multiple type and shape layers, specify a consistent size, apply a style and save the entire creation as a Tool Preset! In addition, Julieanne sh
-
E902: package could not be installed. Error in installing application
Hi All, we try to deploy our first application(IPPhoneServicesTutorial) we do it using designer 2.4.2.009 on application server cuae 2.4.2.009, and we get the following error: E902: package could not be installed. Error in installing application we c
-
Strange export result in FCP 7- audio and video output not in sync anymore
I have a problem exporting edited videomaterial. After export audio and video they are not in sync anymore. There's a difference of 8 sec when exporting audio and video separatly. Movie is total 61 min long. Video and sequence settings are HDV1080i50
-
Table delete button doesn't work with Virtual Forms
I applied all of Winston Prakash's tips to my project table (http://blogs.sun.com/winston/category/Creator), but my table is not the only component in the page, so I had to use Virtual forms. When I add the "Delete" button, i have to put it on a Virt
-
Error Code 0 in Web Service to File
Hi all, I am trying to do an webservice to file scenario. When I am trying to send the WSDL file, SOAP - send request to server, I am getting the following error. " http: could not post file' and return code is '0' and no text is displayed in text