Getting error by ValueBinding with java.util.Date

Hi.
1. my english is not so good.
I develop a JSF-application to learn more about JSF-technologie.
I use Eclipse 3.2
Plugins: Web Tools Platform (WTP), Web Standard Tools, Java Server Faces // Version 1.5.0
JRE: 1.5
java-impl.jar and java-api.jar (sun)
Look at this JSP-File Code
<h:inputText id="dbirth" value="#{dataBean.dbrith}"> </h:inputText>
this produce an error: EL expression does not evaluate to expected types for this attribute
dataBean is a ManagedBeain. So if I use any athor variable from this Bean like:
<h:inputText id="sname" value="#{dataBean.sname}"> </h:inputText>
is going well. But if I use any java.util.Date variable it produce the error.
I tried with other Bean and the error is still there.
I can compile and use this JSP, but this error is there.
Have any one an idea what is happen there??
I looked at Eclipse forums, but I didnt found description for an error like this..
thanks for any help...
naba
Message was edited by:
NamboTango

The problem is because you have bound the inputText to a java.util.Date object, instead of a String. You must use Strings with inputText. However, JSF has provided a way for you to convert objects into a String. It just needs to know how to do that. Luckily for you, there is a converter already available to convert a Date object into a String. Converters will also take input Strings and convert them into an object.
So, in your case, use the convertDateTime tag. Like this:
<h:inputText id="dbirth" value=#{dataBean.dbrith}">
     <f:convertDateTime type="date" pattern="MMM dd, yyyy" />
</h:outputText>Try it. You may change the pattern to whichever valid one you like.
CowKing

Similar Messages

  • What's wrong with java.util.Date type?

    Hi!
    When I try to persist object having field of type java.util.Date I get the
    following SQL logged by Kodo with subsequent transaction rollback:
    2002-11-14 15:03:35,099 INFO
    [com.solarmetric.kodo.impl.jdbc.ee.ManagedConnecti
    onFactoryImpl.supportcrm/kodo] INSERT INTO BILLY.TT_COMMENTS(COMMENT_TYPE,
    TEXT,
    CREATED_BY, ID, SUBJECT, CREATE_DATE, TT_MAIN_ID) VALUES (1, '1', 10, 279,
    '1',
    {ts '2002-11-14 15:03:35.059'}, 147)
    When I change "{ts '2002-11-14 15:03:35.059'}" with "TO_DATE('2002-11-14
    15:03', 'YYYY-DD-MM HH24:MI')" in SQL editor
    and execute it everything works fine.
    What does "{ts '..'}" mean? Is it a SQL generation error?
    Thank you in advance.
    Best regards,
    Alexey Maslov

    I've created my own dictionary with dateToSQL() method overridden.
    Now it works fine. But it's a kind of strange. Oracle is used often and my
    JDBC drivers
    are the most recent (at least, from the oracle.com).
    Anyway, thank you again.
    "Alexey Maslov" <[email protected]> wrote in message
    news:[email protected]...
    Patric,
    Thank you for response.
    We're using Oracle 8.1.7 via OCI driver from Oracle 9.2.
    I've already tried 2.4.0 and it works fine there but I've found another
    problem there
    preventing me from using it. See my post in solarmetric.kodo.betanewsgroup.
    >
    "Patrick Linskey" <[email protected]> wrote in message
    news:[email protected]...
    That's odd -- what version of Oracle are you using?
    Moving to Kodo JDO 2.4.0
    (http://www.solarmetric.com/Software/beta/2.4.0) will almost certainly
    get rid of this problem, as we use exclusively prepared statements in
    it, and therefore pass dates etc. to JDBC as parameters.
    But, to get things working with your Oracle database and Kodo JDO 2.3,
    you could create your own extension of OracleDictionary and override the
    dateToSQL() method to generate the appropriate TO_DATE() syntax. See our
    documentation for more details on creating custom database dictionaries.
    -Patrick
    Alexey Maslov wrote:
    I've added TRACE level logging for transactions in JBoss and got
    original
    exception:
    NestedThrowables:
    com.solarmetric.kodo.impl.jdbc.sql.SQLExceptionWrapper: [SQL=INSERT
    INTO
    BILLY.T
    T_MAIN(TT_SOLUTION_ID, DELAY_REASON, TT_STATE_ID, ID, CONTACT_PHONE,
    CANCEL_REAS
    ON, OPER_DESCR, TT_TYPE_ID, CREATED_BY, EXP_CLOSE_DATE,SERV_OPEN_DATE,
    OPEN_DAT
    E, FLAGS, TAKEN_BY, TT_CAT_ID, SUBJECT_ID, SUBJECT, SERV_CLOSE_DATE)
    VALUES
    (NUL
    L, NULL, 1, 439, NULL, NULL, '____________ ________________ ________________', 7, 5, {ts
    '2002-11-14 1
    8:38:16.075'}, NULL, {ts '2002-11-14 18:18:16.075'}, 0, NULL, 11,24099,
    '1', NU
    LL)] ORA-00904: invalid column name
    at
    com.solarmetric.kodo.impl.jdbc.runtime.SQLExceptions.throwFatal(SQLEx
    ceptions.java:17)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.insert(JDBCSt
    oreManager.java:421)
    at
    com.solarmetric.kodo.runtime.datacache.DataCacheStoreManager.insert(D
    ataCacheStoreManager.java:265)
    at
    com.solarmetric.kodo.runtime.StateManagerImpl.insert(StateManagerImpl
    ..java:1783)
    atcom.solarmetric.kodo.runtime.PNewState.flush(PNewState.java:31)
    at
    com.solarmetric.kodo.runtime.StateManagerImpl.flush(StateManagerImpl.
    java:372)
    at
    com.solarmetric.kodo.runtime.PersistenceManagerImpl.flush(Persistence
    ManagerImpl.java:426)
    at
    com.solarmetric.kodo.ee.EEPersistenceManager.beforeCompletion(EEPersi
    But when I try to execute the statement above against the database
    manually
    everything works fine.
    I'm absolutely desperate!
    P.S. On 2.4.0 RC the operation invoking this database insert completes
    fine.
    "Alexey Maslov" wrote in message
    news:[email protected]...
    Hi!
    When I try to persist object having field of type java.util.Date I
    get
    the
    following SQL logged by Kodo with subsequent transaction rollback:
    2002-11-14 15:03:35,099 INFO
    [com.solarmetric.kodo.impl.jdbc.ee.ManagedConnecti
    onFactoryImpl.supportcrm/kodo] INSERT INTOBILLY.TT_COMMENTS(COMMENT_TYPE,
    TEXT,
    CREATED_BY, ID, SUBJECT, CREATE_DATE, TT_MAIN_ID) VALUES (1, '1',
    10,
    >>>
    279,
    '1',
    {ts '2002-11-14 15:03:35.059'}, 147)
    When I change "{ts '2002-11-14 15:03:35.059'}" with
    "TO_DATE('2002-11-14
    15:03', 'YYYY-DD-MM HH24:MI')" in SQL editor
    and execute it everything works fine.
    What does "{ts '..'}" mean? Is it a SQL generation error?
    Thank you in advance.
    Best regards,
    Alexey Maslov
    Patrick Linskey [email protected]
    SolarMetric Inc. http://www.solarmetric.com
    Best regards,
    Alexey Maslov

  • What's wrong with java.util.Date??

    Hi all,
    I was just practicing a bit of java.util ,when i was compiling my code-
    import java.util.Date;
    import java.text.SimpleDateFormat;
    class DateStamp{
    public static void Main(String args[]){
    doDate1;
    String D;
    int D1,D2,D3;
    Date dt=new Date();
    SimpleDateFormat sdf=new SimpleDateFormat("dd-mm-yyyy");
    /*When using method .setDate(x) ,is x an integer or String?can x=2/5/2002 or 2-5-2002?*/
    public void doDate1{
    dt.setDay(12);
    dt.setMonth(12);
    dt.setYear(102);
    D=dt.getTime();
    D.parseInt(D1);D=""
    D=sdf.getTime();
    D.parseInt(D2);
    int D3=D2-D1;
    int D3=D3/86400000;/*How do you convert milisec-to-days?*/
    D=D3.toString().
    System.out.println(D+"days have elapsed since then");
    the compiler said this-
    File Compiled...
    --------------------------- Javac Output ---------------------------
    DateStamp.java:7: Invalid expression statement.doDate1;^DateStamp.java:14: Instance variables can't be void: doDate1public void doDate1; ^2 errors
    this problem is persistant, and i'm a java newbie ,Does anyone know what's wrong here?
    Thanks!
    Regards,
    aesh83

    How do you get System date onto a Date variable?Calendar.getInstance().getTime() returns a java.util.Date for the current time. You can also use System.currentTimeMillis() and turn it into a Date.
    Will date.after(Date when) method work when Date
    variables are in milisecs?Date.after(Date when) compares two date objects. As the JavaDoc says "Returns:
    true if and only if the instant represented by this Date object is strictly later than the instant represented by when" To me that says that milliseconds are taken into account, I.E. comparing dates actually compares the date plus the time portion.
    >
    What methods-
    *Convert a date(dd/mm/yy) to milisec?If you look in the javaDoc you'll see "long getTime() Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this Date object." Calendar also has the getTimeInMillis() method.
    *Convert a milisec value to a date(dd/mm/yy)?Calendar.setTimeInMillis(long);
    I'm have this little problem.
    When using GregorianCalander-
    *need to initialize?
    *need set today's date?Calendar.getInstance() will return an appropriate Calendar object for the current locale initialized to the current date/time.
    *how do you check if a date exceeds 3 weeks?I'm not sure what you mean. There are a couple of roll(...) methods that will allow you to add a unit of time to a date. I.E. you could add three weeks to a date.
    To ignore the time portion of a date just set the time to "00:00"
    Col

  • How to use  JtextFild with java.util.Date;

    hi
    My problem is that i have a date data type field inaccess in table.
    Otherside i use JTextField.
    First when this window show i initialize this field with current date.
    The code for this is
    lbdate = new JLabel("User Date",JLabel.RIGHT);
              lbdate.setBorder(new EtchedBorder());     
              txtdate = new JTextField();
              txtdate.setBorder(BorderFactory.createLineBorder(Color.red));
              //month convert into string
              int m = cal.get(Calendar.MONTH);
              m++;
              String mon = Integer.toString(m);
              //day convert into string
              int d = cal.get(Calendar.DATE);
              String date = Integer.toString(d);
              //year convert into string
              int y = cal.get(Calendar.YEAR);
              String year = Integer.toString(y);
              txtdate.setText(mon+" / "+date+" / "+year);
    i am not satisfied by this. How can initialize the JtextField by some other method.
    The secound part of question is that how to reterive the date data type of field and see in the textfield.I see butt it returns like this year/month/date(this date is coming from database which already input) 00:00:00
    How can i discard 00:00:00(this time)
    I code for this is
    Date date = rs.Date();
    txtfld.setText(date); //Here error is occured of TypeCasting
    and tell me that how date type object can convert into String for set the text of field
    because JTextField only accept the String data.
    (if u illestrate with code).
    thanks

    Use a JFormattedTextField with a SimpleDateFormat in parameter.
    Denis

  • Get days from the java.util.date class

    Does anyone know how to get the days from the java.util.date
    class. I'm trying to subtract two dates to get the total days between
    the two dates. Any help would be appriciated
    Rob

    If you use the getTime() method, you get the date as a number of milliseconds since a predefined time. You can do arithmetic on that number, such as subtracting two of them to get the number of milliseconds between two Dates, and so on.

  • How can i compare:  java.util.Date oracle.jbo.domain.Date?

    I have made a ViewObject wich contains a date column.
    I want to check if this date is smaller/greater than sysdate:
    i get following error:
    Error(45,24): method <(java.util.Date, oracle.jbo.domain.Date) not found in class Class4
    code:
    SimpleTimeZone pdt = new SimpleTimeZone(-8 * 60 * 60 * 1000, ids[0]);
    // set up rules for daylight savings time
    pdt.setStartRule(Calendar.APRIL, 1, Calendar.SUNDAY, 2 * 60 * 60 * 1000);
    pdt.setEndRule(Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * 60 * 60 * 1000);
    // create a GregorianCalendar with the Pacific Daylight time zone
    // and the current date and time
    Calendar calendar = new GregorianCalendar(pdt);
    Date trialTime = new Date();
    calendar.setTime(trialTime);
    (VO_ULNRow)singleRow = null;
    while(vo.hasNext()){                                             // ViewObject vo;
    singleRow = (VO_ULNRow)vo.next();
    if(calendar.getTime() < singleRow.getEO_ULN_BORROWFROM()); //singleRow returns oracle.jbo.domain.Date
    etcetera
    how can i compare those 2?

    Hi,
    oracle.jbo.domain.Date has two methods which suit your needs
    longValue() which returns a long (though I'm not sure if returns a long comparable to the long returned by java.util.Date)
    and dateValue() which returns a java.util.Date
    I hope it helps,
    Giovanni

  • Java.util.Date oracle.jbo.domain.Date how can i compare?

    I have made a ViewObject wich contains a date column.
    I want to check if this date is smaller/greater than sysdate:
    i get following error:
    Error(45,24): method <(java.util.Date, oracle.jbo.domain.Date) not found in class Class4
    code:
    SimpleTimeZone pdt = new SimpleTimeZone(-8 * 60 * 60 * 1000, ids[0]);
    // set up rules for daylight savings time
    pdt.setStartRule(Calendar.APRIL, 1, Calendar.SUNDAY, 2 * 60 * 60 * 1000);
    pdt.setEndRule(Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * 60 * 60 * 1000);
    // create a GregorianCalendar with the Pacific Daylight time zone
    // and the current date and time
    Calendar calendar = new GregorianCalendar(pdt);
    Date trialTime = new Date();
    calendar.setTime(trialTime);
    (VO_ULNRow)singleRow = null;
    while(vo.hasNext()){ // ViewObject vo;
    singleRow = (VO_ULNRow)vo.next();
    if(calendar.getTime() < singleRow.getEO_ULN_BORROWFROM()); //singleRow returns oracle.jbo.domain.Date
    etcetera
    how can i compare those 2?

    i get following error:
    Error(45,24): method <(java.util.Date,
    oracle.jbo.domain.Date) not found in class Class4
    if(calendar.getTime() <
    singleRow.getEO_ULN_BORROWFROM()); //singleRow returns
    oracle.jbo.domain.Date
    how can i compare those 2? You cannot compare these two values directly. You must convert the oracle.jbo.domain.Date object to a GregorianCalendar object. Something like:
      oracle.jbo.domain.Date dt = singleRow.getEO_ULN_BORROWFROM();
      GregorianCalendar gc = new GregorianCalendar(dt.getYear(), dt.getMonth(), dt.getDay());
      if (calendar.getTime() < gc.getTime())
      }

  • Java.util.Date badly serialized to java.sql.Timestamp Coherence 3.5.2

    Hi all,
    I'm running into this odd behaviour.
    I serialize java.util.Date objects to cache and when I read them back from cache, they appear to be java.sql.Timestamp types.
    I've isolated a junit test for that.
    Do you know why Coherence changes the type in the middle?
    Regards
    Harry.
    import java.util.Date;
    import org.junit.Assert;
    import org.junit.Test;
    import com.tangosol.io.Serializer;
    import com.tangosol.io.pof.ConfigurablePofContext;
    import com.tangosol.util.ExternalizableHelper;
    public class DatePofSerialTest {
         @Test
         public void testCobdate() throws Exception {
              Date date=new Date();
              Serializer serial = new ConfigurablePofContext();//"coherence-pof-config.xml");
              Date date2=(Date)ExternalizableHelper.fromBinary(ExternalizableHelper.toBinary(date, serial), serial);
              System.out.println(serial +" -- Date to serailize ["+ date.getClass() + "]");
              System.out.println(serial +" -- Date from deserialize ["+ date2.getClass() + "]");
              Assert.assertEquals(date, date2);/* Of course this passes, as both refer to the same time (long)*/
    {code}
    This gives as output
    {code:title=output |borderStyle=solid}
    log4j:WARN No appenders could be found for logger (Coherence).
    log4j:WARN Please initialize the log4j system properly.
    com.tangosol.io.pof.ConfigurablePofContext {location=coherence-pof-config.xml} -- Date to serailize [class java.util.Date]
    com.tangosol.io.pof.ConfigurablePofContext {location=coherence-pof-config.xml} -- Date from deserialize [class java.sql.Timestamp]
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Hi Harry,
    It looks like the same issue as ...
    PofExtractor with java.util.Date results in ClassCastException
    It was fixed in version 3.5.4.
    Thanks

  • Java.util.Date and java.sql.Date

    when i am trying to displaying date in my jsp page errors occurs saying that java.util.date and java.sql.date are matching..
    i have some sql statements which i need to execute in the page.so i cant delete that import sql statement.
    so what is the solution for this.
    i want to display the date as 19th april 2003....in the jsp page.
    thank u

    You should use full names.
    java.util.Date date;
    java.sql.Date sdate;
    ..And it may be a good idea to delete one of the two "import" declaration of packages.

  • Error while deploying a web service whose return type is java.util.Date

    Hi
    I have written a simple web service which takes in a date input (java.util.Date) and returns the same date back to the client.
    public interface Ping extends Remote
    * A simple method that pings the server to test the webservice.
    * It sends a datetime to the server which returns the datetime.
    * @param pingDateRequest A datetime sent to the server
    * @returns The original datetime
    public Date ping(Date pingDateRequest) throws RemoteException;
    The generation of the Web service related files goes smoothly in JDeveloper 10g. The problem arises when I try to deploy this web service on the Oracle 10g (10.0.3) OC4J standalone. it gives me the following error on the OC4J console :
    E:\Oracle\oc4j1003\j2ee\home\application-deployments\Sachin-TradingEngineWS-WS\
    WebServices\com\sachin\tradeengine\ws\Ping_Tie.java:57: ping(java.util.Date) in com.sachin.tradeengine.ws.Ping cannot be applied to (java.util.Calendar) _result  = ((com.sachin.tradeengine.ws.Ping) getTarget()).ping
    (myPing_Type.getDate_1());
    ^
    1 error
    04/03/23 17:17:35 Notification ==&gt; Application Deployer for Sachin-TradingEngineWS-WS FAILED: java.lang.InstantiationException: Error compiling :E:\Oracle\oc4j1003\j2ee\home\applications\Sachin-TradingEngineWS-WS\WebServices: Syntax error in source [ 2004-03-23T17:17:35.937GMT+05:30 ]
    I read somewhere that the conversion between java to xml datatype and vice versa fails for java.util.Date, so it is better to use java.util.Calendar. When I change the code to return a java.util.Calendar then the JDeveloper prompts me the following failure:
    Method Ping: the following parameter types do not have an XML Schema mapping and/or serializer specified : java.util.Calendar.
    This forces me to return a String data.
    I would appreciate if someone can help me out.
    Thanks
    Sachin Mathias
    Datamatics Ltd.

    Hi
    I got the web service working with some work around. But I am not sure it this approach would be right and good.
    I started altogether afresh. I did the following step :
    1. Created an Interface (Ping.java) for use in web Service as follows :
    public interface Ping extends Remote{
    public java.util.Date ping(java.util.Date pingDateRequest)
    throws RemoteException;
    2. Implemented the above interface in PingImpl.java as follows :
    public class PingImpl implements Ping
    public java.util.Date ping(java.util.Date pingDateRequest) throws RemoteException {
    System.out.println("PingImpl: ping() return datetime = " + pingDateRequest.toString());
    return pingDateRequest;
    3. Compiled the above 2 java files.
    4. Generated a Stateless Java Web Service with the help of JDeveloper. This time the generation was sucessful.(If I had "java.util.Calendar" in place of "java.util.Date" in the java code of the above mentioned files the web service generation would prompt me for error)
    5. After the generation of Web Service, I made modification to the Ping interface and its implementing class. In both the files I replaced "java.util.Date" with "java.util.Calendar". The modified java will look as follows :
    Ping.Java
    =========
    public interface Ping extends Remote{
    public java.util.Calendar ping(java.util.Calendar pingDateRequest)
    throws RemoteException;
    PingImpl.Java
    ================
    public class PingImpl implements Ping
    public java.util.Calendar ping(java.util.Calendar pingDateRequest) throws RemoteException {
    System.out.println("PingImpl: ping() return datetime = " + pingDateRequest.toString());
    return pingDateRequest;
    6. Now I recompile both the java files.
    7. Withour regenerating the Web Service I deploy the Web Service on OC4j 10.0.3 from JDeveloper. This time the deployment was sucessful.(The Deployment fails if I don't follow the step 5.)
    8. Now I generated a Stub from JDeveloper and accessed the stub from a client. It works fine. Here if you see the Stub code it takes java.util.Date as a parameter and returns a java.util.Date. (Mind you I am accepting a java.util.Calendar and returning the same in my Web Service interface. Step 5)
    The confusing thing is the Serialization and Deserialization of Data from Client java data to Soap message and Soap message to Server java data.
    From Client to SOAP :
    java.util.Date to datetime
    From SOAP to Server :
    datetime to java.util.Calendar
    From Server to SOAP :
    java.util.Calendar to datetime
    From SOAP to Client :
    datetime to java.util.Date (I am not able to understand this part of the conversion)
    Any help or inputs would be appreciated.
    Thanks
    Sachin Mathias

  • Error:Class java.util.date not found

    i have installed 9iAS on my computer.And i want to develop program on JSP.i tried the url below
    http://eyuksel/servlet/IsItWorking
    and i got "it is working" message.when i try to execute my first jsp file i get the error:
    Errors compiling:d:\ias\apache\apache\htdocs\_pages\\_first.java
    d:\ias\apache\apache\htdocs\_pages\_first.java:55: Class java.util.date not found.
    out.print( new java.util.date() );
    ^
    1 error
    what must i do or how can i install the java classes.
    kind regards...
    null

    Thank you very much.It worked:)
    Java is case-sensitive.
    try
    java.util.Date
    instead of
    java.util.date
    null

  • Java.util.Date

    I have a session bean which is published as a web service. The methods in this bean have a return type of java.util.Date.
    I am unable to invoke any of these web services method in Studio creator. These work fine with a .NET client. The exception is as follows:
    InvocationTargetException com.sun.rave.websvc.ui.ReflectionHelper.callMethodWithParams(ReflectionHelper.java:451) com.sun.rave.websvc.ui.TestWebServiceMethodDlg.invokeMethod(TestWebServiceMethodDlg.java:361) com.sun.rave.websvc.ui.TestWebServiceMethodDlg.access$500(TestWebServiceMethodDlg.java:55) com.sun.rave.websvc.ui.TestWebServiceMethodDlg$4.run(TestWebServiceMethodDlg.java:301) java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178) java.awt.EventQueue.dispatchEvent(EventQueue.java:454) java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201) java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151) java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145) java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137) java.awt.EventDispatchThread.run(EventDispatchThread.java:100) null sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:324) com.sun.rave.websvc.ui.ReflectionHelper.callMethodWithParams(ReflectionHelper.java:445) com.sun.rave.websvc.ui.TestWebServiceMethodDlg.invokeMethod(TestWebServiceMethodDlg.java:361) com.sun.rave.websvc.ui.TestWebServiceMethodDlg.access$500(TestWebServiceMethodDlg.java:55) com.sun.rave.websvc.ui.TestWebServiceMethodDlg$4.run(TestWebServiceMethodDlg.java:301) java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178) java.awt.EventQueue.dispatchEvent(EventQueue.java:454) java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201) java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151) java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145) java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137) java.awt.EventDispatchThread.run(EventDispatchThread.java:100) Runtime exception; nested exception is: deserialization error: java.lang.NumberFormatException: For input string: "" com.sun.xml.rpc.client.StreamingSender._handleRuntimeExceptionInSend(StreamingSender.java:248) com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:230) webservice.AddDates_Stub.addToDay(AddDates_Stub.java:68) webservice.AddDatesServiceClient.adddatesserviceAddToDay(AddDatesServiceClient.java:19) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:324) com.sun.rave.websvc.ui.ReflectionHelper.callMethodWithParams(ReflectionHelper.java:445) com.sun.rave.websvc.ui.TestWebServiceMethodDlg.invokeMethod(TestWebServiceMethodDlg.java:361) com.sun.rave.websvc.ui.TestWebServiceMethodDlg.access$500(TestWebServiceMethodDlg.java:55) com.sun.rave.websvc.ui.TestWebServiceMethodDlg$4.run(TestWebServiceMethodDlg.java:301) java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178) java.awt.EventQueue.dispatchEvent(EventQueue.java:454) java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201) java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151) java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145) java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137) java.awt.EventDispatchThread.run(EventDispatchThread.java:100) deserialization error: java.lang.NumberFormatException: For input string: "" com.sun.xml.rpc.encoding.SimpleTypeSerializer.deserialize(SimpleTypeSerializer.java:142) webservice.Date_SOAPSerializer.doDeserialize(Date_SOAPSerializer.java:60) com.sun.xml.rpc.encoding.ObjectSerializerBase.deserialize(ObjectSerializerBase.java:167) com.sun.xml.rpc.encoding.ReferenceableSerializerImpl.deserialize(ReferenceableSerializerImpl.java:134) webservice.AddDates_AddToDay_ResponseStruct2_SOAPSerializer.doDeserialize(AddDates_AddToDay_ResponseStruct2_SOAPSerializer.java:40) com.sun.xml.rpc.encoding.ObjectSerializerBase.deserialize(ObjectSerializerBase.java:167) com.sun.xml.rpc.encoding.ReferenceableSerializerImpl.deserialize(ReferenceableSerializerImpl.java:134) webservice.AddDates_Stub._deserialize_AddToDay(AddDates_Stub.java:489) webservice.AddDates_Stub._readFirstBodyElement(AddDates_Stub.java:458) com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:158) webservice.AddDates_Stub.addToDay(AddDates_Stub.java:68) webservice.AddDatesServiceClient.adddatesserviceAddToDay(AddDatesServiceClient.java:19) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:324) com.sun.rave.websvc.ui.ReflectionHelper.callMethodWithParams(ReflectionHelper.java:445) com.sun.rave.websvc.ui.TestWebServiceMethodDlg.invokeMethod(TestWebServiceMethodDlg.java:361) com.sun.rave.websvc.ui.TestWebServiceMethodDlg.access$500(TestWebServiceMethodDlg.java:55) com.sun.rave.websvc.ui.TestWebServiceMethodDlg$4.run(TestWebServiceMethodDlg.java:301) java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178) java.awt.EventQueue.dispatchEvent(EventQueue.java:454) java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201) java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151) java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145) java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137) java.awt.EventDispatchThread.run(EventDispatchThread.java:100)

    Hi Meera
    This works fine in creator. I tested with a webservice having a method which returns java.util.date. I used the same code in that method to return java.util.Date. But the same method was returning a Calendar object instead of Date. So I added getTime() method to get the Date.
    Can you post few lines of your code that you are writing in Creator.
    Thanks
    Creator Support

  • Wsimport, mapping of xs:date to java.util.Date via ext file, and -B option

    Summary:
    JDK 1.7.0_09 and wsimport and xjc that comes with it.
    Global JAXB binding to map xs:date to java.util.Date
    I have the following external bindings file:
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
         xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
         elementFormDefault="qualified" attributeFormDefault="unqualified"
         jaxb:extensionBindingPrefixes="xjc" jaxb:version="2.1">
         <xs:annotation>
              <xs:appinfo>
                   <jaxb:globalBindings>
                        <xjc:serializable />
                        <jaxb:javaType name="java.util.Date" xmlType="xs:date" parseMethod="au.com.xxx.jaxb.DateAdapter.parseDate" printMethod="au.com.xxx.jaxb.DateAdapter.printDate" />
                   </jaxb:globalBindings>
              </xs:appinfo>
         </xs:annotation>
    </xs:schema>The au.com.xxx.jaxb.DateAdapter code is as follows:
    package au.com.xxx.jaxb;
    import java.util.Calendar;
    import java.util.Date;
    import java.util.GregorianCalendar;
    import javax.xml.bind.DatatypeConverter;
    public class DateAdapter {
         public static Date parseDate(String s) {
              return DatatypeConverter.parseDate(s).getTime();
         public static String printDate(Date dt) {
              Calendar cal = new GregorianCalendar();
              cal.setTime(dt);
              return DatatypeConverter.printDate(cal);
    }When I run the following wsimport from the command line, I get:
    salvojo@AUD20901BL /cygdrive/c/workspace/JSF/insurance
    $ /cygdrive/c/java/jdk1.7.0_09/x64/bin/wsimport -keep -s gen-src -b external/wsdl/jaxb-bindings.xml -wsdllocation /wsdl/Member.wsdl -d WebContent/WEB-INF/classes external/wsdl/Member.wsdl
    parsing WSDL...
    Generating code...
    Compiling code...
    C:\workspace\JSF\insurance\gen-src\org\w3\_2001\xmlschema\Adapter1.java:13: error: package au.com.xxx.jaxb does not exist
            return (au.com.xxx.jaxb.DateAdapter.parseDate(value));
                                   ^
    C:\workspace\JSF\insurance\gen-src\org\w3\_2001\xmlschema\Adapter1.java:17: error: package au.com.xxx.jaxb does not exist
            return (au.com.xxx.jaxb.DateAdapter.printDate(value));
                                   ^
    2 errors
    compilation failed, errors should have been reportedWhich means that wsimport or xjc needs to know the classpath to find au.com.xxx.jaxb.DateAdapter.
    But how do I pass the classpath from wsimport to the JAXB compiler ?
    There is the -B option in wsimport, but I could not get it to work.
    If I read it correctly, I should be able to pass the -classpath option to the JAXB compiler from wsimport via -B.
    I tried:
    salvojo@AUD20901BL /cygdrive/c/workspace/JSF/insurance
    $ /cygdrive/c/java/jdk1.7.0_09/x64/bin/wsimport -keep -s gen-src -B"-classpath WebContent/WEB-INF/classes" -b external/wsdl/jaxb-bindings.xml -wsdllocation /wsdl/Member.wsdl -d WebContent/WEB-INF/classes external/wsdl/Member.wsdl
    no such JAXB option: -classpath WebContent/WEB-INF/classes
    Usage: wsimport [options] <WSDL_URI>
    where [options] include:
      -b <path>                 specify jaxws/jaxb binding files or additional schemas
                                (Each <path> must have its own -b)
      -B<jaxbOption>            Pass this option to JAXB schema compiler
      -catalog <file>           specify catalog file to resolve external entity references
                                supports TR9401, XCatalog, and OASIS XML Catalog format.
      -d <directory>            specify where to place generated output files
    <...snipped...>... where WebContent/WEB-INF/classes is the classpath where au.com.xxx.jaxb.DateAdapter.class could be found. Obviously it did not like it.
    Also, why is wsimport generate org.w3._2001.xmlschema.Adapter1.java ? All it is doing is wrapping up the exact same call that I have specified in my DateAdapter. How can I tell wsimport or xjc to NOT create that extra Adapter1.java and simply directly use my DateAdapter ??

    create additional column of type LONG to represent date.
    dateFormat is of type java.util.Date:
    long newLongDate = dateFormat.getTime();
    select object(b) from MyEntity b where b.MYLONGDATE > ?1 and b.MYLOGDATE <= ?2

  • MS Sql + java.util.Date type

    Hi,
    In MySql everything is ok, but in MS Sql I get this error and bouth with timedate type in the database:
    22/11/2006 16:34:59 org.jdesktop.dataset.provider.sql.SQLCommand getUpdateStatement
    WARNING: Problem with update SQL statement null
    22/11/2006 16:34:59 org.jdesktop.dataset.provider.sql.SQLCommand getUpdateStatement
    WARNING: The Java type java.util.Date is not a supported type.
    com.microsoft.sqlserver.jdbc.SQLServerException: The Java type java.util.Date is not a supported type.
    ===========
    My code:
    ===========
    Date newDate = dateReminder.getDate();
    miliSecDate = newDate2.getTime();
    s = spinner.getTime();
    timeStr = s.split(":");
    miliSecTimeS = Long.parseLong(timeStr[1].trim());
    miliSecTime = ((miliSecTimeH * 60 * 60) + (miliSecTimeS * 60)) * 1000;
    newDate2.setTime(miliSecTime + miliSecDate);

    Even if I set myJDatepicker.getDate()
    I get the same error.
    my code:
    GlobalTablesProperties.getInstance().getProvider()
    .getCommand().setParameter("date", myJDatepicker.getDate());
    GlobalTablesProperties.getInstance().getProvider()
    .save(
    GlobalTablesProperties.getInstance().getTaskData());
    JDBCDataConnection jdbcConn = (JDBCDataConnection) (GlobalTablesProperties.getInstance().getProvider().getConnection());
    jdbcConn.commit();
    GlobalTablesProperties.getInstance().getSelectedDataModel()
    .setValue("date", myJDatepicker.getDate());

  • Java.sql.Date vs java.util.Date vs. java.util.Calendar

    All I want to do is create a java.sql.Date subclass which has the Date(String) constructor, some checks for values and a few other additional methods and that avoids deprecation warnings/errors.
    I am trying to write a wrapper for the java.sql.Date class that would allow a user to create a Date object using the methods:
    Date date1 = new Date(2003, 10, 7);ORDate date2 = new Date("2003-10-07");I am creating classes that mimic MySQL (and eventually other databases) column types in order to allow for data checking since MySQL does not force checks or throw errors as, say, Oracle can be set up to do. All the types EXCEPT the Date, Datetime, Timestamp and Time types for MySQL map nicely to and from java.sql.* objects through wrappers of one sort or another.
    Unfortunately, java.sql.Date, java.sql.Timestamp, java.sql.Time are not so friendly and very confusing.
    One of my problems is that new java.sql.Date(int,int,int); and new java.util.Date(int,int,int); are both deprecated, so if I use them, I get deprecation warnings (errors) on compile.
    Example:
    public class Date extends java.sql.Date implements RangedColumn {
      public static final String RANGE = "FROM '1000-01-01' to '8099-12-31'";
      public static final String TYPE = "DATE";
       * Minimum date allowed by <strong>MySQL</strong>. NOTE: This is a MySQL
       * limitation. Java allows dates from '0000-01-01' while MySQL only supports
       * dates from '1000-01-01'.
      public static final Date MIN_DATE = new Date(1000 + 1900,1,1);
       * Maximum date allowed by <strong>Java</strong>. NOTE: This is a Java limitation, not a MySQL
       * limitation. MySQL allows dates up to '9999-12-31' while Java only supports
       * dates to '8099-12-31'.
      public static final Date MAX_DATE = new Date(8099 + 1900,12,31);
      protected int _precision = 0;
      private java.sql.Date _date = null;
      public Date(int year, int month, int date) {
        // Deprecated, so I get deprecation warnings from the next line:
        super(year,month,date);
        if(! isWithinRange(this))
          throw new ValueOutOfRangeException((RangedColumn)this, "" + this);
      public Date(String s) {
        super(0l);
        // Start Cut-and-paste from java.sql.Date.valueOf(String s)
        int year;
        int month;
        int day;
        int firstDash;
        int secondDash;
        if (s == null) throw new java.lang.IllegalArgumentException();
        firstDash = s.indexOf('-');
        secondDash = s.indexOf('-', firstDash+1);
        if ((firstDash > 0) & (secondDash > 0) & (secondDash < s.length()-1)) {
          year = Integer.parseInt(s.substring(0, firstDash)) - 1900;
          month = Integer.parseInt(s.substring(firstDash+1, secondDash)) - 1;
          day = Integer.parseInt(s.substring(secondDash+1));
        } else {
          throw new java.lang.IllegalArgumentException();
        // End Cut-and-paste from java.sql.Date.valueOf(String s)
        // Next three lines are deprecated, causing warnings.
        this.setYear(year);
        this.setMonth(month);
        this.setDate(day);
        if(! isWithinRange(this))
          throw new ValueOutOfRangeException((RangedColumn)this, "" + this);
      public static boolean isWithinRange(Date date) {
        if(date.before(MIN_DATE))
          return false;
        if(date.after(MAX_DATE))
          return false;
        return true;
      public String getRange() { return RANGE; }
      public int getPrecision() { return _precision; }
      public String getType() { return TYPE; }
    }This works well, but it's deprecated. I don't see how I can use a java.util.Calendar object in stead without either essentially re-writing java.sql.Date almost entirely or losing the ability to be able to use java.sql.PreparedStatement.get[set]Date(int pos, java.sql.Date date);
    So at this point, I am at a loss.
    The deprecation documentation for constructor new Date(int,int,int)says "instead use the constructor Date(long date)", which I can't do unless I do a bunch of expensive String -> [Calendar/Date] -> Milliseconds conversions, and then I can't use "super()", so I'm back to re-writing the class again.
    I can't use setters like java.sql.Date.setYear(int) or java.util.setMonth(int) because they are deprecated too: "replaced by Calendar.set(Calendar.DAY_OF_MONTH, int date)". Well GREAT, I can't go from a Date object to a Calendar object, so how am I supposed to use the "Calendar.set(...)" method!?!? From where I'm sitting, this whole Date deprecation thing seems like a step backward not forward, especially in the java.sql.* realm.
    To prove my point, the non-deprecated method java.sql.Date.valueOf(String) USES the DEPRECATED constructor java.util.Date(int,int,int).
    So, how do I create a java.sql.Date subclass which has the Date(String) constructor that avoids deprecation warnings/errors?
    That's all I really want.
    HELP!

    I appreciate your help, but what I was hoping to accomplish was to have two constructors for my java.sql.Date subclass, one that took (int,int,int) and one that took ("yyyy-MM-dd"). From what I gather from your answers, you don't think it's possible. I would have to have a static instantiator method like:public static java.sql.Date createDate (int year, int month, int date) { ... } OR public static java.sql.Date createDate (String dateString) { ... }Is that correct?
    If it is, I have to go back to the drawing board since it breaks my constructor paradigm for all of my 20 or so other MySQL column objects and, well, that's not acceptable, so I might just keep my deprecations for now.
    -G

Maybe you are looking for

  • Forms and validations - here's some of my ideas, what are yours?

    One of the big things still missing from the JFX space (especially where JEE is concerned) is forms and form validations. Maybe you guys have been luckier but at least 80% of the screens I've had to build in my career have been boring old forms - ent

  • Authentication Provider in WebLogic 7.0

    Hi I am trying to understand the Security Frame-work in WLS 7.0. I found out that WLS 7.0 uses embedded LDAP server to store users information. It also supports external LDAP. But for our application, I want to keep users info in a database. Is there

  • Spark Skin - Trouble finding selected itemimage

    Hey All, I've applied this solution to my project http://www.flex4fun.com/Ex/ComboBoxNew3/ComboBoxNew3.html except what I want to do is display the image and not the text. In the skin for the solution above I replaced this <s:TextInput id="textInput"

  • Trailing space in char field

    Hello there, I am a BW developer and I am currently having an issue with trailing spaces in an ABAP routine. This is the situation (example... In real life I use larger char fields): - From a source I get a text line that is let's say max. 60 charact

  • Wire Bound Books

    I want to produce a wire bound book from a book created in Aperture - is this possible. Aperture does not seem to offer wire bound books (why is that?) and i cannot find a way to import my aperture book into iphoto - i can import the photos but not t