Wrong ELF data format

Hi,
Platform : Solaris x86
Weblogic: 8.1 SP3
I'm installing Weblogic server and after configuring a single domain I get the following exception at startup:
The WebLogic Server did not start up properly.
java.lang.UnsatisfiedLinkError: /usr/local/weblogic/weblogic81/server/lib/solaris/libweblogicunix1.so: ld.so.1: /usr/j2se/bin/java: fatal: /usr/local/weblogic/weblogic81/server/lib/solaris/libweblogicunix1.so: wrong ELF data format: ELFDATA2MSB
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1560)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1485)
at java.lang.Runtime.loadLibrary0(Runtime.java:788)
at java.lang.System.loadLibrary(System.java:834)
at weblogic.platform.Unix.<init>(Unix.java:14)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at java.lang.Class.newInstance0(Class.java:308)
at java.lang.Class.newInstance(Class.java:261)
at weblogic.platform.OperatingSystem.getOS(OperatingSystem.java:116)
at weblogic.t3.srvr.SetUIDManager.init(SetUIDManager.java:51)
at weblogic.t3.srvr.T3Srvr.initializeHere(T3Srvr.java:777)
at weblogic.t3.srvr.T3Srvr.initialize(T3Srvr.java:670)
at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:344)
at weblogic.Server.main(Server.java:32)
Reason: /usr/local/weblogic/weblogic81/server/lib/solaris/libweblogicunix1.so: ld.so.1: /usr/j2se/bin/java: fatal: /usr/local/weblogic/weblogic81/server/lib/solaris/libweblogicunix1.so: wrong ELF data format: ELFDATA2MSB
I did a quick search on here and the closest explanation I can find as an unsupported version. However I took my installer from here.
http://e-docs.bea.com/platform/suppconfigs/configs81/solaris9_x86/81sp3.html

At the risk of being an AOLer, me too.
Exception in thread "main" java.lang.UnsatisfiedLinkError: /export/home/ematrix/
rmi/bin/solaris4/libeMatrix.so: ld.so.1: /usr/jdk/instances/jdk1.5.0/bin/java: f
atal: /export/home/ematrix/rmi/bin/solaris4/libeMatrix.so: wrong ELF data format
: ELFDATA2MSB
        at java.lang.ClassLoader$NativeLibrary.load(Native Method)
        at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1751)
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1676)
        at java.lang.Runtime.loadLibrary0(Runtime.java:822)
        at java.lang.System.loadLibrary(System.java:992)
        at com.matrixone.jni.MatrixKernel.getKernel(MatrixKernel.java:42)
        at matrix.util.ComputedClassPath.main(ComputedClassPath.java:77)

Similar Messages

  • Ld.so.1: sudo: fatal: /usr/local/lib/libintl.so.8: wrong ELF data format

    I have installed sudo version 1.6.9p5.
    after the configuration, when i'm trying to sudo, i get the below error:
    ld.so.1: sudo: fatal: /usr/local/lib/libintl.so.8: wrong ELF data format: ELFDATA2LSB
    ================================
    background of the server is as :
    # uname -a
    SunOS buildman 5.10 Generic_147440-01 sun4u sparc SUNW,Sun-Fire-V440
    # ldd /usr/local/bin/sudo
    libpam.so.1 => /usr/lib/libpam.so.1
    libdl.so.1 => /usr/lib/libdl.so.1
    libintl.so.8 => /usr/local/lib/libintl.so.8 - wrong ELF data format: ELFDATA2LSB
    libsocket.so.1 => /usr/lib/libsocket.so.1
    libnsl.so.1 => /usr/lib/libnsl.so.1
    libc.so.1 => /usr/lib/libc.so.1
    libcmd.so.1 => /lib/libcmd.so.1
    libmp.so.2 => /lib/libmp.so.2
    libmd.so.1 => /lib/libmd.so.1
    libscf.so.1 => /lib/libscf.so.1
    libdoor.so.1 => /lib/libdoor.so.1
    libuutil.so.1 => /lib/libuutil.so.1
    libgen.so.1 => /lib/libgen.so.1
    libm.so.2 => /lib/libm.so.2
    /platform/SUNW,Sun-Fire-V440/lib/libc_psr.so.1
    /platform/SUNW,Sun-Fire-V440/lib/libmd_psr.so.1
    Please help.

    installed the libintl for sparc mc and it worked fine.. thanks for the help..

  • Wrong ELF data format: ELFDATA2LSB

    Dear,
    I get the following error when executing a java program.
    Does somebody know what does mean "wrong ELF data format"?
    thanks for you help
    Internal exception:
    java.lang.UnsatisfiedLinkError: /export/home/mComm/lib/libtibrvj.so: ld.so.1: /bin/../java/bin/../bin/sparc/native_threads/java: fatal: /export/home/mComm/lib/libtibrvj.so: wrong ELF data format: ELFDATA2LSB
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1414)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1338)
    at java.lang.Runtime.loadLibrary0(Runtime.java:744)
    at java.lang.System.loadLibrary(System.java:815)
    at com.tibco.tibrv.Tibrv.loadLib(Tibrv.java:435)
    at com.tibco.tibrv.Tibrv.open(Tibrv.java:252)
    at cmsender.<init>(cmsender.java:89)
    at cmsender.main(cmsender.java:320)

    At the risk of being an AOLer, me too.
    Exception in thread "main" java.lang.UnsatisfiedLinkError: /export/home/ematrix/
    rmi/bin/solaris4/libeMatrix.so: ld.so.1: /usr/jdk/instances/jdk1.5.0/bin/java: f
    atal: /export/home/ematrix/rmi/bin/solaris4/libeMatrix.so: wrong ELF data format
    : ELFDATA2MSB
            at java.lang.ClassLoader$NativeLibrary.load(Native Method)
            at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1751)
            at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1676)
            at java.lang.Runtime.loadLibrary0(Runtime.java:822)
            at java.lang.System.loadLibrary(System.java:992)
            at com.matrixone.jni.MatrixKernel.getKernel(MatrixKernel.java:42)
            at matrix.util.ComputedClassPath.main(ComputedClassPath.java:77)

  • Date Format For Importing Invoices

    Hi All,
    I am using the DTW and importing invoices however I am having a problem with the date.  In the docdate, and docduedate field I have entered my dates however once I import them the date for the invoices I have imported are todays date.  Have I missed a field where I should enter other dates or is my date format perhaps wrong?
    Date formats that I have tried are ddmmyyyy, mmddyyyy, yyyyddmm, yyyymmdd.
    Any help will be greatly appreciated.

    Hi there,
    The right format is YYYYMMDD. The dates you are trying to import, are they future or past dates? Under Administration -> Document Settings are the 'Block documents with earlier posting date' and 'Allow future posting date' tickboxes checked?
    Regards,
    Nat

  • Wrong query results: due to date format?

    hello,
    I have oracle 11 and when I execute this query:
    select MYDATE from mytable order by MYDATE DESC;
    it get me a bad order:
    MYDATE
    25-MAR-09
    13-MAR-09
    10-MAR-10
    10-MAR-10
    31-JAN-10
    29-JAN-10
    28-JAN-10
    08-DEC-09
    07-DEC-09
    06-DEC-09
    05-DEC-09
    is it may due to a wrong date format?
    where have I to look out? init.ora?

    But, there is no problem at my end (Using Oracle 10.2.0.1 on win xp):
    SQL> create table t(mydate date);
    Table created.
    SQL> insert into t values(to_date('25-MAR-09','DD-MON-YY'));
    1 row created.
    SQL> insert into t values(to_date('13-MAR-09','DD-MON-YY'));
    1 row created.
    SQL> insert into t values(to_date('31-JAN-10','DD-MON-YY'));
    1 row created.
    SQL> insert into t values(to_date('07-DEC-09','DD-MON-YY'));
    1 row created.
    SQL> insert into t values(to_date('05-DEC-09','DD-MON-YY'));
    1 row created.
    SQL> insert into t values(to_date('06-DEC-09','DD-MON-YY'));
    1 row created.
    SQL> insert into t values(to_date('08-DEC-09','DD-MON-YY'));
    1 row created.
    SQL> insert into t values(to_date('10-MAR-09','DD-MON-YY'));
    1 row created.
    SQL> insert into t values(to_date('29-JAN-10','DD-MON-YY'));
    1 row created.
    SQL> insert into t values(to_date('10-MAR-10','DD-MON-YY'));
    1 row created.
    SQL> insert into t values(to_date('28-JAN-10','DD-MON-YY'));
    1 row created.
    SQL> select * from t;
    MYDATE
    25-MAR-09
    13-MAR-09
    31-JAN-10
    07-DEC-09
    05-DEC-09
    06-DEC-09
    08-DEC-09
    10-MAR-09
    29-JAN-10
    10-MAR-10
    28-JAN-10
    11 rows selected.
    SQL> SELECT MYDATE FROM T ORDER BY MYDATE DESC;
    MYDATE
    10-MAR-10
    31-JAN-10
    29-JAN-10
    28-JAN-10
    08-DEC-09
    07-DEC-09
    06-DEC-09
    05-DEC-09
    25-MAR-09
    13-MAR-09
    10-MAR-09
    11 rows selected.
    SQL> SHOW PARAMETER NLS_DATE;
    NAME                                 TYPE        VALUE
    nls_date_format                      string
    nls_date_language                    stringCan you show us the output of
    show parameter nls_date;
    Regards
    Girish Sharma

  • Error executing SQL (Wrong date format)

    Hello,
    I'm trying do this SQL statment.. and i'm getting the error....
    I hear this error is about wrong format picture date.... Can anyone help me ?
    Thanks
    Fernando.
    1 update cargo a
    2 set dat_validade_fim =
    3 ((nvl((select min(b.dat_validade_ini)
    4 from cargo b
    5 where b.cod_cargo = a.cod_cargo and
    6 b.dat_validade_ini > a.dat_validade_ini
    7 group by b.cod_empresa, b.cod_cargo),'18/08/2205 14:41:47')) - 0.00001)
    8* where a.cod_cargo = 25
    9 /
    group by b.cod_empresa, b.cod_cargo),'18/08/2205 14:41:47')) - 0.00001)
    ERRO na linha 7:
    ORA-01830: date format picture ends before converting entire input string

    It may be due to the value you are using for Null Replacement. Try using To_Date in that e.g.
    update cargo a
    set dat_validade_fim =
    ((nvl((select min(b.dat_validade_ini)
    from cargo b
    where b.cod_cargo = a.cod_cargo and
    b.dat_validade_ini > a.dat_validade_ini
    group by b.cod_empresa, b.cod_cargo),TO_DATE('18/08/2205 14:41:47','DD/MM/RRRR HH24:MI:SS')) - 0.00001)
    where a.cod_cargo = 25
    /

  • PJC Calendar setDate Wrong date format. Date change failed?

    Forms 10.1.2 using forms demos pjc code.
    The calendar pjc I added to my form works except I can't initialize it with a date. If I try to initialize a date it always produces 'Wrong date format. Date change failed.' error.
    In a post-query trigger, I initialize the calendar's date using:
    SET_CUSTOM_PROPERTY('PJC.CALENDAR',1,'setDate',to_char(:lead.date_received,'DD.MM.YYYY'));
    In the java console, this yields:
    Warning: Wrong date format. Date change failed.
    Warning: Wrong date format. Date change failed.
    I get the same result when using a hardcoded date like:
    SET_CUSTOM_PROPERTY('PJC.CALENDAR',1,'setDate','01.12.2006');
    What is the flaw in my incantation?

    Hello,
    This is the syntax used in the calendarpjc Forms demo:
        call the setDate method on the calendar PJC via the PL/SQL built in
        set_custom_item_property
        convert Oracle date to String recognised by Java
      procedure setDate(d in date) is
      begin
        set_custom_property(lGlobals.hCalendar,1,'setDate',to_char(d,'Mon DD, YYYY'));
      end;     Francois

  • Wrong Date format in SQL Server

    Hello All,
    I have an asp page with a hidden field that holds
    <%=Date()%>. Because the
    Session.LCID is set to UK this value today would be
    12/03/2007 (UK format).
    When this hidden field is fed into an INSERT Stored Procedure
    in SQL Server
    in my testing environment, the date format that is inserted
    into the
    database is the same as the value in the hidden field eg
    12/03/2007, which
    is what I want.
    Now though, the site has moved to a production web server
    with SQL Server.
    When I perform this exact insert using the same webpages and
    (from what I
    can see) the same SQL Server configuration, the date inserts
    as 03/12/2007,
    US format. This is causing me big problems as the website is
    complete but
    the wrong dateformat is producing some undesirable results.
    The whole site
    is set up to expect the original format and I cannot see why
    this is
    happening.
    Does anyone have any suggestions and more importantly how I
    can change this
    please.

    There is a real issue here and it has nothing to do with the
    way that data
    is formatted on the way out.
    msSQL does seem to always assume that numbers entered in the
    format of
    00/00/00 follow the pattern of MM/DD/YY which is American
    format. So the 8th
    of March entered in UK format of 08/03/2007 ends up being
    intrepreted by SQL
    as 3rd August. However it only does this up to the 12th of
    each month. If
    you enter the 13th of March as 13/03/2007 SQL stores it
    correctly.
    The workaround does seem to enter the number in the
    YYYY-MM-DD format as
    Julian has suggested.
    Paul Whitham
    Certified Dreamweaver MX2004 Professional
    Adobe Community Expert - Dreamweaver
    Valleybiz Internet Design
    www.valleybiz.net
    "Lionstone" <[email protected]> wrote in
    message
    news:[email protected]...
    > SQL Server does not store dates in any format. They are
    simply numbers,
    > with the integer part representing date and the
    fractional part
    > representing time. If you do not format dates on the way
    out, then you're
    > leaving things up to your web server (and depending on
    when the dates
    > become strings, it might be the ADO provider and not ASP
    that does the
    > formatting).
    >
    > The only way to reliably format dates the way you want
    is to do so
    > explicitly. You may use CONVERT for SQL Server and
    specify a format
    > option (
    http://msdn2.microsoft.com/en-us/library/aa226054(SQL.80).aspx),
    > or you may use the FormatDateTime function in your ASP
    page.
    > FormatDateTime is locale-aware when it formats dates.
    All you have to do
    > is make sure the locale is set properly (which you seem
    to have done).
    >
    >
    >
    > "TTal" <[email protected]> wrote in message
    > news:[email protected]...
    >> Hello All,
    >>
    >> I have an asp page with a hidden field that holds
    <%=Date()%>. Because
    >> the Session.LCID is set to UK this value today would
    be 12/03/2007 (UK
    >> format).
    >>
    >> When this hidden field is fed into an INSERT Stored
    Procedure in SQL
    >> Server in my testing environment, the date format
    that is inserted into
    >> the database is the same as the value in the hidden
    field eg 12/03/2007,
    >> which is what I want.
    >>
    >> Now though, the site has moved to a production web
    server with SQL
    >> Server. When I perform this exact insert using the
    same webpages and
    >> (from what I can see) the same SQL Server
    configuration, the date inserts
    >> as 03/12/2007, US format. This is causing me big
    problems as the website
    >> is complete but the wrong dateformat is producing
    some undesirable
    >> results. The whole site is set up to expect the
    original format and I
    >> cannot see why this is happening.
    >>
    >> Does anyone have any suggestions and more
    importantly how I can change
    >> this please.
    >>
    >
    >

  • Wrong date format in FM: RH_READ_OBJECT

    Hi All,
    I found an error in date format returned in field OBEG of FM: RH_READ_OBJECT.
    It returns: 20112804 and it should be 20110428 (this is Sap internal date format)
    It is strange because it does not happen all the time just in some particular scenarios.
    Do you have any idea about this issue? Is there any note related to this?
    Below a link to a debug screenshot:
    [http://tinypic.com/view.php?pic=1zegppt&s=7]
    Thanks!

    Hi,
    Try debugging the FM and check at which point the wrong date is passed on to OBEG export parameter.
    There is a piece of code available in FM -
    obeg  = temp_buffer-begda.
    May be some problem can occur fetching from buffer.
    Harish

  • Icloud Date Format wrong...

    iCloud date format preferences do not work. Day Month Year is an option but it doesn't reflect in places like the calander.

    This does not solve the problem. Much like date format settings on Mac do not change the date format on the menu bar of a mac, where it matters most. The date format settings in icloud calendar do not change the date format. Anyone have a solution?

  • Wrong date format when setting Smart Album

    I've got my date format set to the standard UK settings, eg. DD/MM/YY, but in Aperture when I create a smart folder the date settings are in the US format of MM/DD/YY. Is there anyway I can fix this - I've got System Preferences correctly set to UK formats.

    bilbo_baggins wrote:
    I've got my date format set to the standard UK settings, eg. DD/MM/YY, but in Aperture when I create a smart folder the date settings are in the US format of MM/DD/YY. Is there anyway I can fix this - I've got System Preferences correctly set to UK formats.
    There are folders and there are smart albums but I don't believe there are 'smart folders'.
    If you could describe a bit of what you are doing to would be helpful in trying to answer your question.

  • Wrong date format when creating a universe based on a MS Analysis cube

    Hi,
    When creating a universe based on a MS Analysis 2008 cube the date objects from the cube are created in the universe with CHAR format when it should be DATE format
    I have tried to resolve the issue by modifying the date object in the universe with MDX but with little success.
    I wonder if it is an error in the cube and that it actually should be possible to get the correct date format from the cube when creating the universe automatically in the universe design tool.
    The date object is organised in a hierarchy.
    Any ideas? - both to resolve the issue by using MDX in the universe object properties or in the cube.
    The universe design tool is version 4.0 SP2 patch 5
    /Kim

    Oh I knew I was missing something. Ok version 2.
    I think in general this approach would work. I assumed you are starting from 1 and resetting to 1.
    There should be error handling and so forth that is not here. Probably some details need to be tweaked.
    So the key thing here AFAIK is to put the sequence reset in an autonomous procedure. Exactly how to do that may need to be modified.
    PS this version has a bug. After the reset needs to change the increment of the sequence back to 1.
    and I left that out. oops!
    /* testtrigger */
    /* previously:
    create table mytable (
    myprimary_key number(10) primary key,
    column1 number(2)
    create sequence mysequence
    start with 1
    increment by 1
    maxvalue 99
    nocache;
    create table mylastdate (lastdate date);
    insert into mylastdate(lastdate) values (trunc(sysdate));
    create or replace procedure reset_mysequence (in_correction number) is
    pragma autonomous_transaction;
    begin
    execute immediate 'alter sequence mysequence INCREMENT BY ' || in_correction || ' MINVALUE 1';
    update mylastdate set lastdate = trunc(sysdate);
    commit;
    end;
    show errors;
    create or replace trigger mytrigger
    before insert on mytable for each row
    declare
    tmpdate number(8) := null;
    lastdate_used number(8) := null;
    correction number := null;
    lastseq number(2) := null;
    begin
    if INSERTING then
    tmpdate := to_number(to_char(sysdate,'YYYYMMDD'));
    select to_number(to_char(lastdate,'YYYYMMDD')) into lastdate_used
    from mylastdate;
    select mysequence.currval into lastseq from dual;
    /* when this displays in the forum it shows lt gt as nothing on the screen
    so this should be lastdate not equal to tmpdate */
    if lastdate_used <> tmpdate and lastseq > 1 then
    correction := -(lastseq - 1);
    reset_mysequence(correction);
    end if;
    :new.myprimary_key := (tmpdate * 100) + mysequence.nextval;
    end if;
    end;
    show errors;
    Edited by: lake on Nov 30, 2010 10:39 AM
    Edited by: lake on Nov 30, 2010 10:52 AM

  • Wrong date format when import CSV files

    When you import a CSV file that contains fields with German date formats, these fields are displayed incorrectly.
    Example: Contents of the CSV file "01.01.14". After importing the corresponding cell in Numbers has the content "40178".
    A reformat the cell to a date format is not possible.
    How do I get the date in the new version of Numbers displayed correctly?

    It seems that there are more than a few problems related to import/export with non-US localizations.
    I, personally, don't have a solution to your problem. I started to adjust my Language & Region settings to test your problem but it was several settings, I didn't get it right, and I didn't want to mess up my computer so I set everything back to US/English.
    The only workarounds I can suggest are
    Insert a new column into your table and in it put a formula that adds the number to the date 01.01.1904.  Or,
    Edit the CSV in TextEdit to Replace All "." with "/".  This will work if "." is used for nothing else but these dates.
    I recommend the second one if it will work for you. Hopefully Apple is addressing problems such as the one you are seeing.

  • Trying to change a pre-defined report. Date format is wrong, 20140217 should be 17.02.2014.

    The pre-defined report in sccm "Computers with specific software registered in Add Remove Programs" has a query like this:
    Select DISTINCT sys.Netbios_Name0, fcm.SiteCode,  sys.User_Domain0, sys.User_Name0, sys.Operating_System_Name_and0, arp.DisplayName0,
    arp.InstallDate0  
    FROM fn_rbac_R_System(@UserSIDs)  sys 
    JOIN v_Add_Remove_Programs arp ON sys.ResourceID = arp.ResourceID  
    JOIN v_FullCollectionMembership fcm on sys.ResourceID=fcm.ResourceID 
    WHERE DisplayName0 like @filterwildcard and fcm.CollectionID=@CollID
    I have highlighted the part that I added to the report.
    I have inserted an extra column in Report Builder, and added the value inside the column and the install date can be viewed in the report. However the date format is shown like this: 20140217 - I want it to be 17.02.2014.
    So I try to change this via right-clicking on the cell in Report Builder, Text Box Properties, Number. Here I choose Date and the correct format. However it does not change the date format when saving and running the report again. It just stays the same. 
    Kthxbai

    The format can be change if it was a date. But if you look that field it is NOT a date, it is a string and therefore will not  change to the data format that you want.
    On top of this, there is a bigger problem. Not ever setup records the date or in the same format so.....
    http://www.enhansoft.com/
    Sorry - I am not sure what you mean by the last statement. "Not ever setup records the date or in the same format so.."
    - Would it be possible to elaborate? Thank you very much.
    Kthxbai

  • BC4J Query by example for dates uses wrong date format

    When querying by example on date fields, I get the following nested exceptions:
    oracle.jbo.SQLStmtException: JBO-27121: SQL error during statement execution.
    JBO-26044: Error while getting estimated row count for view object
    and
    java.sql.SQLException: ORA-01830: date format picture ends before converting entire input string.
    It would seem to be caused by the following clause added to the end of the entity object's query:
    "QRSLT WHERE ( ( (DATE_FIELD = TO_DATE('23/12/2003', 'yyyy-mm-dd')) ) )"
    which causes problems as our entity objects use a 'dd/MM/yyyy' date format.
    Is there a way we can make the query by example use the same date format as the rest of our app?

    I‘m not an expert on this but I see nobody is replying so this might help you. I've been having problems with dates as well and I‘m pretty sure that the attached formatter isn't used in find mode. That is because the java date class (can't remember which one) used by the BC4J has the format yyyy-mm-dd. I don't now if it is possible to change it but I got around the problem by writing my own domain. You can take a look at Toystore demo, by Steve Muench, that uses a custom date domain, ExpirationDate (see the code below). It is mapped to a VARCHAR column in the database but it is possible to map it to a DATE column.
    I have been watching the postings with questions about dates and I have noticed that a lot of people have problems with this but I haven’t seen an answer yet.
    package toystore.model.datatypes.common;
    import java.io.Serializable;
    import java.text.SimpleDateFormat;
    import java.util.Calendar;
    import java.util.Date;
    import oracle.jbo.Transaction;
    import oracle.jbo.domain.DataCreationException;
    import oracle.jbo.domain.DomainInterface;
    import oracle.jbo.domain.DomainOwnerInterface;
    // --- File generated by Oracle Business Components for Java.
    * This custom datatype implements an immutable domain class that
    * maps to a VARCHAR column containing values like '10/2004' representing
    * expiration dates of credit cards. We could have chosen to implement
    * this as a domain that stores itself in a DATE column instead of a
    * VARCHAR column, but since the Java Pet Store demo schema stored the
    * information in a VARCHAR column, we decided to illustrate how to
    * accommodate that case using domains.
    public class ExpirationDate implements DomainInterface, Serializable {
    private Date mDate;
    private String mDateAsString;
    protected ExpirationDate() {
    mDate = new Date();
    convertDateToStringFormat();
    * Return the value of the expiration date as a java.util.Date
    public Date getDateValue() {
    return mDate;
    * Allow expiration date to be constructed from two
    * strings representing month and year
    public ExpirationDate(String monthVal, String yearVal) {
    this(monthVal+'/'+yearVal);
    public ExpirationDate(String val) {
    validate(val);
    convertDateToStringFormat();
    * The getData() method must return the type of object that JDBC will
    * see for storage in the database. Since we want this ExpirationDate
    * datatype to map to a VARCHAR column in the database, we return the
    * string format of the date
    public Object getData() {
    return mDateAsString;
    * <b>Internal:</b> <em>Applications should not use this method.</em>
    public void setContext(DomainOwnerInterface owner, Transaction trans, Object obj) {
    * Performs basic validation on strings that represent expiration dates
    * in the format of MM/YYYY. Note that in the process of testing whether
    * the string represents a valid month and year, we end up setting
    * the private member variable mDate with the date value, so if the
    * validate() method does not throw an exception, the mDate will be setup.
    protected void validate(String val) {
    if (val != null) {
    if (val.length() != 7 ||
    val.charAt(2) != '/' ||
    !isAllDigitsExceptSlashAtPositionTwo(val) ||
    !isValidMonthAndYear(val)) {
    throw new DataCreationException(ErrorMessages.class,
    ErrorMessages.INVALID_EXPRDATE,
    null,null);
    * Returns true if all digits except position 2 (zero-based) are digits
    private boolean isAllDigitsExceptSlashAtPositionTwo(String val) {
    for (int z=0, max = val.length(); z < max; z++) {
    if (z != 2 && !Character.isDigit(val.charAt(z))) {
    return false;
    return true;
    * Returns true if the val string, assumed to be in "MM/YYYY" format
    * is a valid month and year value, setting the mDate member variable
    * if they are valid.
    private boolean isValidMonthAndYear(String val) {
    try {
    int month = Integer.parseInt(val.substring(0,2));
    int year = Integer.parseInt(val.substring(3));
    Calendar c = Calendar.getInstance();
    c.setLenient(false);
    c.set(year,month-1,1); // Month is zero-based !
    mDate = c.getTime();
    catch (IllegalArgumentException i) {
    return false;
    return true;
    public String toString() {
    return mDateAsString;
    * Convert mDate to String format
    private void convertDateToStringFormat() {
    if (mDate != null) {
    SimpleDateFormat sdf = new SimpleDateFormat("MM/yyyy");
    mDateAsString = sdf.format(mDate);
    * Return true if the expiration date is in the future
    public boolean isFutureDate() {
    return mDate.compareTo(new Date())> 0;
    * Compare the Expiration Dates by comparing their respective
    * getData() values
    public boolean equals(Object obj) {
    if (obj instanceof DomainInterface) {
    Object thisData = getData();
    if (thisData != null) {
    return thisData.equals(((DomainInterface)obj).getData());
    return ((DomainInterface)obj).getData() == null;
    return false;

Maybe you are looking for