ClassCast Exception while casting to type String

Dear Java users
While coding a parse routine in a session EJB , I created a vector and added some elements to it.
Naturally these elements are of type object.
Now, while extracting elements out of the vector I tried to cast them to the actual type that the elements are.
Most of the elements are of type String and some of type Long and Double.Note that these are all Object wrappers not primitives.
The code compiles fine, however at run time I get the following error:
java.lang.ClassCastException : java.lang.String
I tried to do the casting two ways: (String) object and object.toString(). In both cases I got the same error.
Here is a snippet of my code where I get the error:
RETAIL_TRANX retail_db = retail_home.create(columns.elementAt(0).toString(),
columns.elementAt(1).toString(),................
Any ideas on why this is happening and how best should I cast to String.
Thank you for any help you can provide
Best
Naveen

RETAIL_TRANX retail_db = retail_home.create(columns.elementAt(0).toString(),
columns.elementAt(1).toString(),................
I'd say that the code above calls the toString() implemented in the Object class because that's what elementAt() returns. If you want String objects as arguments to the create method, you want the toString() implemented in the subclasses String, Long, and Double. To achieve this, try the following:
RETAIL_TRANX retail_db = retail_home.create(((String)columns.elementAt(0)).toString()...
This code casts the Object class object returned by elementAt to a String first and then it calls the toString() method on the String object resulting from the cast. The toString() that executes should be the one in the String rather than Object class.
This is going to fail if elementAt() doesn't return an object that can be cast to a String. In this case, what you might want to do first is test the type of object returned with the instanceof operator. Then cast to the appropriate type, in each case calling toString() after the cast has been made.
Regards,
Steve

Similar Messages

  • Exception while casting int[] to Object[],why?

    if(params.getClass().isArray()) this.params = (Object[])params;
    else this.params = new Object[]{params};
    Now I transfer int[] as "params",and ClassCastException is thrown while casting params to Object[].Since I'm using JDK5.0,why does this happen(the array has been initialized)?

    But how to retrieve every element of this
    Object(Array)? Which type should you cast it to?int[] obviously. Or forget about casting and simply create an Integer[] yourself. a for loop isn't that difficult to write.
    Are you aware that arrays are objects? That's why java doesn't autobox an int[].
    By the way, you should look at these lines of code again:
    if(params.getClass().isArray())
    this.params = (Object[])params;
    else this.params = new Object[]{params};

  • Classcast exception while sending objects to the server

    I'm getting classcast exception when i try to send objects from the java webstart application at the client side to a server. Its working fine if I do the same without using javaweb start. I'm using hessian client to send objects to the server.
    I've a web app that gets outlook contacts from the client machine and send those to the server. I'm sending these contacts as custom objects(OutlookContact) to the server using hessian client. But these objects are being sent to the server as String objects but not as OutlookContact objects. I don't know whats happening. Can anyone please tell me is there any setting that I need to set in the jnlp file.
    thanks,
    Jayaram

    I am also getting the same error. Please anybody can help

  • Exception while using Nested types in Oracle

    Hi All,
    I am getting an exception while trying to use Nested types in Oracle. The same thing works in other systems. So it might be some problem with my configuration. Can anyone please help me out with this one. Thanks in advance..
    java.sql.SQLException: Internal Error
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:208)
    at oracle.jdbc.oracore.OracleTypeCOLLECTION.initCollElemTypeName(OracleTypeCOLLECTION.java:1074)
    at oracle.jdbc.oracore.OracleTypeCOLLECTION.getAttributeType(OracleTypeCOLLECTION.java:1107)
    at oracle.jdbc.oracore.OracleNamedType.getFullName(OracleNamedType.java:81)
    at oracle.jdbc.oracore.OracleNamedType.getFullName(OracleNamedType.java:68)
    at oracle.sql.TypeDescriptor.initSQLName(TypeDescriptor.java:237)
    at oracle.sql.TypeDescriptor.getName(TypeDescriptor.java:198)
    at oracle.sql.StructDescriptor.getClass(StructDescriptor.java:1105)
    at oracle.sql.STRUCT.toJdbc(STRUCT.java:574)
    at oracle.jdbc.oracore.OracleTypeUPT.unpickle81UPT(OracleTypeUPT.java:502)
    at oracle.jdbc.oracore.OracleTypeUPT.unpickle81rec(OracleTypeUPT.java:456)
    at oracle.jdbc.oracore.OracleTypeCOLLECTION.unpickle81ImgBodyElements(OracleTypeCOLLECTION.java:1011)
    at oracle.jdbc.oracore.OracleTypeCOLLECTION.unpickle81ImgBody(OracleTypeCOLLECTION.java:952)
    at oracle.jdbc.oracore.OracleTypeCOLLECTION.unpickle81(OracleTypeCOLLECTION.java:764)
    at oracle.jdbc.oracore.OracleTypeCOLLECTION.unlinearizeInternal(OracleTypeCOLLECTION.java:243)
    at oracle.jdbc.oracore.OracleTypeCOLLECTION.unlinearize(OracleTypeCOLLECTION.java:217)
    at oracle.sql.ArrayDescriptor.toJavaArray(ArrayDescriptor.java:891)
    at oracle.sql.ARRAY.getArray(ARRAY.java:315)
    at weblogic.jdbc.wrapper.Array_oracle_sql_ARRAY.getArray(Unknown Source)
    Regards,
    Praveen G S

    Ok .. i got around this issue myself ..
    For others who might have had to face the same problem, let me tell them the problem that i had... i ll b happy if it helps someone ...
    The issue was improper privleges of the Nested Types in the schema to which my server was connecting. Once proper privelges were given, everything started working just fine ...

  • Performance issue while using data type 'STRING'.

    Hello All,
    I have created a table for storing values of different features coming under a particular country. Since the last field 'Value field' have to hold text upto 800characters for some features, i have used the data type 'String' with character length specified as 1000. I am able to store values upto 1000characters using this. Also, the table has to hold lots and lots of value, and it will increase in future also.
    Since i have mentioned the data type as 'String', I have one doubt whether this will affect the performance. Because length of most of the values in my value field is less than 75characters and in some case only it will exceed 700characters. So, my question is whether the 'String' data type will allocate the length which am specifying in the table for each entries, though the values entering is less than the specified length.
    For example, if the value of my value field is 'Very High Complexity' which is of length 20characters, will the space allocation be reduced to 20 or will it be still 1000characters?
    Hope someone can clarify my doubt.
    Thanks In Advance,
    Shino
    Moved to appropriate forum
    Edited by: Rob Burbank on Feb 23, 2009 4:27 PM

    Hi Shino,
    Well it is possible to store using STRING or LCHR in the transparent tables. There are some underlyning facts here:-
    1. You can only have one such field per table
    2. You cannot view them in the se11 / se16 table content browser
    3. You will need to maintain an additional field for storing the length of the STRING or LCHR field.
    Regarding the performance:
    even though ABAP allows storing STRING or LCHR type fields in the transparent tables but as soon as the lenght of the field crosses 255 chars it is not advisable to store it directly in the transperant tables.
    You should store that field in the knowledge repository and only a pointer to the knowledge repository in the transperant table field.
    Anyways, Since you have only one field with such a requirement then i would suggest you use STRING instead of LCHR as in LCHR you will have to mandatorily assign a length (like 1000) so even if you are storing only 20 chars or 300 chars the system will reserve a slot of 1000 chars; this is not with string as in case of string everything would be dynamic.
    The result being that the reading time increases in case of LCHR.
    I Hop this answered your question.
    Regards,
    Sagar.

  • Class cast exception while casting FTPConnectionFactory object

    Hi
    I have SOA Suite Advanced installation - 10.1.3.4 MLR#5.
    I have developed a BPEL which polls an FTP site using a JCA FTPConnectionFactory registered in JNDI - eis/Ftp/My_Ftp.
    If file is present, then BPEL doesnt fetchs it... instead calls a java program through WSIF binding.
    In java program i am retrieving the JNDI object - eis/Ftp/My_Ftp.. casting it to oracle.tip.adapter.ftp.FTPConnectionFactory and get the FTP host and credentials.
    Now using those details i mannually create an FTP Connection and retieve the file.
    This program worked for sure... but recently when i tried the same i got the ClassCastException while casting java.lang.Object got from JNDI to oracle.tip.adapter.ftp.FTPConnectionFactory. I havnt changed any thing on server since... could not understand why this issue has cropped now.
    After lot of research the issue seems due to different Classloaders. JNDI object was loaded by ClassLoaderA and in my java program it is being loaded by ClassLoaderB.
    And these two classloaders dont share classes with each other.
    This is the code:
    InitialContext ctx = new InitialContext();
    Object jndiFTPObj = ctx.lookup("eis/Ftp/My_Ftp");
    System.out.println("Got Object from JNDI is: "+jndiFTPObj+" ClassLoader - "+jndiFTPObj.getClass().getClassLoader());
    // it prints -- Got Object from JNDI is: oracle.tip.adapter.ftp.FTPConnectionFactory@1aa3bbc ClassLoader - FtpAdapter:0.0.0
    FTPConnectionFactory ftpConF = (oracle.tip.adapter.ftp.FTPConnectionFactory)jndiFTPObj;
    // here i get error -- java.lang.ClassCastException: oracle.tip.adapter.ftp.FTPConnectionFactory
    Thinking of RMI/IIOP i even tried:
    FTPConnectionFactory ftpConF = (FTPConnectionFactory)PortableRemoteObject.narrow(ctx.lookup("eis/Ftp/My_Ftp"), FTPConnectionFactory.class);
    it didnt solve the error.
    I tried loading the class using the same loader as:
    Class.forName("oracle.tip.adapter.ftp.FTPConnectionFactory",true,jndiFTPObj.getClass().getClassLoader());
    even that didnt solve the error.
    If any body has some idea... pls help
    Thanks
    Inder

    Issue was due to ClassLoaders... tried to use the same classloader... but couldnt.
    Eventually solved it by using Java Reflection.
    Thx

  • Classcast exception while using HttpsURLConnection

    I am using java1.3. I have downloaded all the jars in JSSE..however when i am using the HttpsURLConnection class i get ClassCase exception at
    HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
    I don't get any error while compiling however get the error when executing
    Any help on this will greatly appricated.
    Thanks
    Sudha

    Magic, that worked for me.
    Now the real question is why did it work. My code worked fine under JRE 1.3.1, but when I remove jsse.jar from my classpath and upgraded to JRE 1.4.1 it broke. By commenting out the System.setProperty it now works. Strange.
    Cheers,
    Paul

  • I am Getting the classcast error while using the webservice client

    Hi ,
    Iam getting classcast exception while trying to get the connection Object throurh the webservice client.
    The details are:
    the ra.xml
    <resourceadapter-version>1.6</resourceadapter-version>
    <resourceadapter>
    <resourceadapter-class>oracle.apps.contactCenter.mct.model.connector.CCAResAdapterImpl</resourceadapter-class>
    <outbound-resourceadapter>
    <connection-definition>
    <managedconnectionfactory-class>oracle.apps.contactCenter.mct.model.connector.CCAMangConnFactImpl</managedconnectionfactory-class>
    <connectionfactory-interface>oracle.apps.contactCenter.mct.publicModel.connector.MCTConnectionFactIF</connectionfactory-interface>
    <connectionfactory-impl-class>oracle.apps.contactCenter.mct.model.connector.CCAConnectionFactImpl</connectionfactory-impl-class>
    <connection-interface>oracle.apps.contactCenter.mct.publicModel.connector.MCTConnectionIF</connection-interface>
    <connection-impl-class>oracle.apps.contactCenter.mct.model.connector.CCAConnectionImpl</connection-impl-class>
    </connection-definition>
    <transaction-support>NoTransaction</transaction-support>
    <reauthentication-support>false</reauthentication-support>
    </outbound-resourceadapter>
    </resourceadapter>
    The weblogic-ra.xml
    <enable-access-outside-app>true</enable-access-outside-app>
    <outbound-resource-adapter>
    <connection-definition-group>
    <connection-factory-interface>oracle.apps.contactCenter.mct.publicModel.connector.MCTConnectionFactIF</connection-factory-interface>
    <connection-instance>
    <jndi-name>MctEIS11/connFctryCCA</jndi-name>
    <connection-properties>
    <pool-params>
    <initial-capacity>5</initial-capacity>
    <max-capacity>10</max-capacity>
    <capacity-increment>1</capacity-increment>
    </pool-params>
    </connection-properties>
    </connection-instance>
    </connection-definition-group>
    </outbound-resource-adapter>
    </weblogic-connector>
    The web.xml
    <servlet>
    <servlet-name>MyWebService1SoapHttpPort</servlet-name>
    <servlet-class>myapp.Class1JCA</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>MyWebService1SoapHttpPort</servlet-name>
    <url-pattern>/MyWebService1SoapHttpPort</url-pattern>
    </servlet-mapping>
    <session-config>
    <session-timeout>35</session-timeout>
    </session-config>
    <mime-mapping>
    <extension>html</extension>
    <mime-type>text/html</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>txt</extension>
    <mime-type>text/plain</mime-type>
    </mime-mapping>
    </web-app>
    The client is
    Context m_context;
    MCTConnectionIF m_connection = null;
    Hashtable env = new Hashtable();
    env.put( Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory" );
    env.put(Context.PROVIDER_URL, "t3://localhost:7101");
    try {
    m_context = new InitialContext(env);
    System.out.println("Got the context objNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN");
    MCTConnectionFactIF m_cxFactory = null;
    Object objFactory = null;
    objFactory = m_context.lookup("MctEIS11/connFctryCCA");
    System.out.println(objFactory.toString());
    m_cxFactory = (MCTConnectionFactIF)objFactory;
    System.out.println(m_cxFactory.toString());
    m_connection = (MCTConnectionIF)m_cxFactory.getConnection(); //
    When i run this i am getting the exception as
    Entering!!!!!!!!!!!!!!!!!!!!!
    Got the context objNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
    [oracle.apps.contactCenter.mct.model.connector.CCAConnectionFactImpl@14bc17f|mailto:oracle.apps.contactCenter.mct.model.connector.CCAConnectionFactImpl@14bc17f]
    java.lang.ClassCastException: oracle.apps.contactCenter.mct.model.connector.CCAConnectionFactImpl cannot be cast to oracle.apps.contactCenter.mct.publicModel.connector.MCTConnectionFactIF
    at myapp.Class1JCA.GetConnection(Class1JCA.java:47)
    I have checked that the jar files are matching in both client an connector side
    Please help me on this

    Is that ever running ? Where/how did you installed tuxedo ? Which OS user was used for tuxedo install ?
    Nicolas.

  • Implicit coercion of a value of type String to an unError while Adding Dynamic Rows To Flex DataGrid

    Hi friends
    I  want to add interger for in next next rows while clicking tab  button,one i enter all the values in one row if i press tab means next  row will be editable.for making that i added the following code.i have  some error shows like this
        [Bindable]
                    private var tasks:ArrayCollection;
                    private static const ADD_TASK:int= "";
                    private function init():void
                        tasks = new ArrayCollection();
                        tasks.addItem(new Task(0.01,100000,0));
                        tasks.addItem({frmAmount:ADD_TASK});
                    private function checkEdit(e:DataGridEvent):void
                        // Do not allow editing of Add Task row except for
                        // "Click to Add" column
                        if(e.rowIndex == tasks.length - 1 && e.columnIndex != 0)
                            e.preventDefault();
            private function editEnd(e:DataGridEvent):void
                    // Adding a new task
                    if(e.rowIndex == tasks.length - 1)
                    var txtIn:TextInput =TextInput(e.currentTarget.itemEditorInstance);
                    var dt:Object = e.itemRenderer.data;
                    // Add new task
                    if(parseInt(txtIn.text) != ADD_TASK)
                        tasks.addItemAt(new Task(parseInt(txtIn.text), 0, ""), e.rowIndex);----->Multiple markers at this line:
                                                                                                                             -1067: Implicit coercion of a value of type String to an unrelated type int.
                                                                                                                                -txtIn
                    // Destroy item editor
                    commPlanDetGrid.destroyItemEditor();
                        // Stop default behavior
                    e.preventDefault();
            ]]>
    Please help if any suggession
    Thanks in advance
    B.Venkatesan

    The error message indicates the problem fairly clearly.  _feed_list is defined as a ComboBox in your first line of code.  You are passing that as an argument in your populate(_feed_list) line of code.  However, the populate function is expecting an XMLList object to be passed, not a ComboBox.
    You probably really mean to be using...
              populate(feed_items);
    since that is the only XMLList to be found

  • DB Adapter 902 binding exception while passing parameters for simple string

    Hi,
    I have an PlSQL API with two input paramters of string type... But this is only started after XML validation TRUE on the BPM server.
    The error is
    <bindingFault xmlns="http://schemas.oracle.com/bpel/extension"><part name="code"><code>902</code>
    </part><part name="detail"><detail>
    Internal Exception: java.sql.SQLException: ORA-00902: invalid datatype
    Error Code: 902</detail>
    </part><part name="summary"><summary>file:/oracle/product/10.1.3/soa/bpel/domains/Website/tmp/.bpel_BPELProcess1_1.0_c64929dfd2dacf95db3c9da081c1797d.tmp/callingAPI.wsdl [ callingAPI_ptt::callingAPI(InputParameters,OutputParameters) ] - WSIF JCA Execute of operation 'callingAPI' failed due to: Error while trying to prepare and execute an API.
    An error occurred while preparing and executing the XXRBA.XXRBA_WEB_ADAPTER.FETCH_CUSTOMERS API. Cause: java.sql.SQLException: ORA-00902: invalid datatype
    [Caused by: ORA-00902: invalid datatype
    ; nested exception is:
         ORABPEL-11811
    Error while trying to prepare and execute an API.
    An error occurred while preparing and executing the XXRBA.XXRBA_WEB_ADAPTER.FETCH_CUSTOMERS API. Cause: java.sql.SQLException: ORA-00902: invalid datatype
    [Caused by: ORA-00902: invalid datatype
    Check to ensure that the API is defined in the database and that the parameters match the signature of the API. Contact oracle support if error is not fixable.
    </summary>
    </part></bindingFault>
    The input XSD parameters in BPEL input
    <element name="input" type="string"/>
    The input XSD parameters in ADAPTER
    <element name="P_WEB_ACCOUNT" type="string" db:index="1" db:type="VARCHAR2" minOccurs="0" nillable="true"/>
    <element name="P_SOLICITED_ONLY" type="string" db:index="2" db:type="VARCHAR2" minOccurs="0" nillable="true"/>
    The assignment I am doing in the .bple file is
    <assign name="Assign_1">
    <copy>
    <from expression="bpws:getVariableData('inputVariable','payload','/client:BPELProcess1ProcessRequest/client:input')"/>
    <to variable="Invoke_1_callingAPI_InputVariable" part="InputParameters"
    query="/ns2:InputParameters/ns2:P_WEB_ACCOUNT"/>
    </copy>
    <copy>
    <from expression="string('o')"/>
    <to variable="Invoke_1_callingAPI_InputVariable" part="InputParameters"
    query="/ns2:InputParameters/ns2:P_SOLICITED_ONLY"/>
    </copy>
    </assign>
    --Khaleel                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    You have an attribute type in an object service that is supposed to be numeric, but when reading form the database it seems that is retrieving a non-numeric content...
    Cheers,
    Vlad

  • Approval task SP09: Evaluation of approvalid failed with Exception: while trying to invoke the method java.lang.String.length() of an object loaded from local variable 'aValue'

    Hi everyone,
    I just installed SP09 and i was testing the solution. And I found a problem with the approvals tasks.
    I configured a simple ROLE approval task for validate add event. And when the runtime executes the task, the dispatcher log shows a error:
    ERROR: Evaluation of approvalid failed with Exception: while trying to invoke the method java.lang.String.length() of an object loaded from local variable 'aValue'
    And the notifications configured on approval task does not start either.
    The approval goes to the ToDO tab of the approver, but when approved, also the ROLE stays in "Pending" State.
    I downgraded the Runtime components to SP08 to test, and the approvals tasks works correctly.
    Has anyone passed trough this situation in SP09?
    I think there is an issue with the runtime components delivered with this initial package of SP09.
    Suggestions?

    Hi Kelvin,2016081
    The issue is caused by a program error in the Dispatcher component. A fix will be provided in Identity Management SP9 Patch 2 for the Runtime component. I expect the patch will be delivered within a week or two.
    For more info about the issue and the patch please refer to SAPNote 2016081.
    @Michael Penn - I might be able to assist if you provide the ticket number
    Cheers,
    Kristiyan
    IdM Development

  • Exception while unmarshalling UTF-8 encoded XML String, using JAXB.

    hi folks. First of all, thank you for contributing to my queries as of now.
    Problem statement.
    - This happens when i try to unmarshall a webservice response, which is nothing but a simple UTF-8 encoded XML string in an soap envelope.
    - 0xae is the register character: &reg;.
    - My next step was to ensure that my code works without this character. So I removed all occurances from my XML. It worked just fine...
    - So what do you guys suggest me to get rid of this problem?
    - Any suggestion will be treated as valuable resource.
    - Is there some kind of encoding setting with jaxb ?
    An invalid XML character (Unicode: 0xae) was found in the element content of the document.
    org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0xae) was found in the element content of the document.
         at weblogic.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1273)
         at weblogic.apache.xerces.framework.XMLDocumentScanner.reportFatalXMLError(XMLDocumentScanner.java:603)
         at weblogic.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1319)
         at weblogic.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:396)
         at weblogic.apache.xerces.framework.XMLParser.parse(XMLParser.java:1119)
         at weblogic.xml.jaxp.WebLogicXMLReader.parse(WebLogicXMLReader.java:135)
         at weblogic.xml.jaxp.RegistryXMLReader.parse(RegistryXMLReader.java:133)
         at com.sun.xml.bind.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:139)
         at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:129)
         at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:166)
         at com.hp.wwopsit.econfigure.helper.JaxbUtils.xmlStringToJaxbObject(JaxbUtils.java:66)
         at com.hp.wwopsit.econfigure.core.transformation.IPCAdapterMapper.x2oLoadConfig(IPCAdapterMapper.java:376)
         at com.hp.wwopsit.econfigure.core.adapter.IPCAdapter.loadConfiguration(IPCAdapter.java:144)
         at com.hp.wwopsit.econfigure.core.adapter.IPCAdapter.main(IPCAdapter.java:291)
    --------------- linked to ------------------
    javax.xml.bind.UnmarshalException
    - with linked exception:
    [org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0xae) was found in the element content of the document.]
         at javax.xml.bind.helpers.AbstractUnmarshallerImpl.createUnmarshalException(AbstractUnmarshallerImpl.java:284)
         at com.sun.xml.bind.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:143)
         at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:129)
         at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:166)
         at com.hp.wwopsit.econfigure.helper.JaxbUtils.xmlStringToJaxbObject(JaxbUtils.java:66)
         at com.hp.wwopsit.econfigure.core.transformation.IPCAdapterMapper.x2oLoadConfig(IPCAdapterMapper.java:376)
         at com.hp.wwopsit.econfigure.core.adapter.IPCAdapter.loadConfiguration(IPCAdapter.java:144)
         at com.hp.wwopsit.econfigure.core.adapter.IPCAdapter.main(IPCAdapter.java:291)
    ***Jaxb Exception while converting xml file to object. Possible cause, Invalid schema or unrecognized elements in input XML. Actuall exception message:javax.xml.bind.UnmarshalException
    - with linked exception:
    [org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0xae) was found in the element content of the document.]
    End..
    Output completed (44 sec consumed) - Normal Termination

    This is how the XML looks like ..
    <?xml version="1.0" encoding="UTF-8" ?>
    - <configresponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <csticShortText>processor</csticShortText>
    - <csticValues>
    - <csticValue id="024" selected="false">
    <desc>Pentium� 4 1.7GHz/400MHz</desc>
    </configresponse>

  • EJB 3.0 JNDI lookup results in Classcast Exception

    Hello everybody,
    I�m experiencing a strange problem when I want to retrieve a stateless session bean from a POJO in my enterprise app. I am using EJB 3.0, running on Glassfish build 33 and JDK 1.5.
    I have successfully deployed my ear file which has the EJB.jar and the war file in it. I�m using JSF 1.2 in the web app and I am able to use all session beans using the injection annotation in my managed beans (this is how it is supposed to be according to the spec.). However, I now need to acces a stateless session bean from a POJO (non-managed or backing bean) which resides also in the war file. I�m using the following code to retrieve the session bean:
    (where IMySessionBean = remote interface and MySessionBean is the implementation)
    try {
    ic = new InitialContext();
    MySessionBean mybean = (MySessionBean )ic.lookup("env/IMySessionBean");
    When casting the object from the lookup into MySessionBean I get a classcast Exception. However, I can see the session bean using the JNDI browser that comes with Glassfish and it�s deployed and available. If mybean is of type Object, I see that the lookup method returns a wrapper of my session bean.
    Here�s what the stacktrace says:
    java.lang.ClassCastException: com.myproject.ejb.interfaces._IMySessionBean_Wrapper
         at ...
    Do I miss something here and there�s more required to obtain a reference to the session bean? I�m pretty much stuck here and any help is greastly appreciated!
    Thanks in advance!
    Cheers,
    Joerg

    Hi Joerg,
    In the session bean client view, the bean implementation class is never used. The client
    only interacts with the local or remote interface.
    Regarding the lookup, the more portable approach is to
    lookup the ejb reference through the component environment of the web application
    rather than doing a direct global lookup. If you have already defined any ejb reference
    injections somewhere in the web app, you can look up the same dependencies via
    java:comp/env. For example, if your managed bean has the following @EJB annotation :
    @EJB(name="mybeanref") IMySessionBean beanRef;
    You can look up the same underlying dependency in your utility class :
    IMySessionBean beanRef = (IMySessionBean) new InitialContext().lookup
    ("java:comp/env/mybeanref");
    Note that the portion of the lookup string after java:comp/env/ comes from the name() attribute
    of @EJB. @EJB name() has the same semantics as the ejb-ref-name in the deployment
    descriptor. You can find more info on these topics in our EJB FAQ :
    https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html

  • Another ClassCast Exception!!

    Hi,
              I waded though the earlier classcast exception discussions and felt that
              my case was slightly different so here it goes
              I am using Weblogic Server v 4.51.
              I have my application servlets in a jar file which is included in the
              servlet classpath in the weblogic.properties file.It is not in the
              system classpath.
              I have two scenarios which fail with identical exceptions.
              I have one servlet which on one type of request stores an object into
              the session
              and on another type of request retrieves it from the session.This object
              is of a type which we have created ChartHTML and is in a jar file which
              is also in the servlet classpath.When I retrieve the ChartHTML object
              from the session it throws a classcast exception.The code line is as
              follows
              ChartHTML = (ChartHTML) session.getValue("chart");
              I am not trying to change any classes in midsession or anything.I am
              able to
              get other values previously stored in the session but they are plain
              java Strings.
              This has worked for months under JRun.
              Any help will be appreciated
              Santosh
              

    It could be in retreiving from the DB? If you have a binary type that you are storing text in, sometimes a class cast exception is thrown (though not always) if you try and push that straight into a String ie String s = resultSet.getString("actuallyABinaryFied");
    It also depends on the DB and drivers you are using. My experience of this is with mySql and mm drivers
    Just a thought...

  • Deployment exception while running a .jspx page in Jdev 11g 11.1.1.1.0

    I have a .jspx page that renders taskflows as dynamic regions. When I execute this exception is what I get.
    WARNING: [ComponentRule]{faces-config/component} Merge(oracle.adf.Table)
    <Aug 13, 2009 11:39:47 AM IST> <Warning> <HTTP> <BEA-101162> <User defined listener com.sun.faces.config.ConfigureListener failed: java.lang.IllegalAccessError: tried to access method oracle.adf.controller.v2.lifecycle.Lifecycle$Phase.<init>(Ljava/lang/String;)V from class oracle.adfinternal.controller.faces.lifecycle.JSFLifecycle$JSFPhase.
    java.lang.IllegalAccessError: tried to access method oracle.adf.controller.v2.lifecycle.Lifecycle$Phase.<init>(Ljava/lang/String;)V from class oracle.adfinternal.controller.faces.lifecycle.JSFLifecycle$JSFPhase
         at oracle.adfinternal.controller.faces.lifecycle.JSFLifecycle$JSFPhase.<init>(JSFLifecycle.java:22)
         at oracle.adfinternal.controller.faces.lifecycle.JSFLifecycle.<clinit>(JSFLifecycle.java:40)
         at oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener.<init>(ADFPhaseListener.java:241)
         at oracle.adfinternal.controller.faces.lifecycle.ADFLifecyclePhaseListener.<init>(ADFLifecyclePhaseListener.java:26)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         Truncated. see log file for complete stacktrace
    >
    <Aug 13, 2009 11:39:47 AM IST> <Warning> <HTTP> <BEA-101162> <User defined listener oracle.adf.mbean.share.config.ADFConfigLifeCycleCallBack failed: java.lang.NullPointerException.
    java.lang.NullPointerException
         at oracle.adf.mbean.share.config.ADFConfigLifeCycleCallBack.contextDestroyed(ADFConfigLifeCycleCallBack.java:122)
         at weblogic.servlet.internal.EventsManager$FireContextListenerAction.run(EventsManager.java:482)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
         at weblogic.servlet.internal.EventsManager.notifyContextDestroyedEvent(EventsManager.java:200)
         Truncated. see log file for complete stacktrace
    >
    Aug 13, 2009 11:39:47 AM oracle.mds.internal.lcm.logging.MDSLCMLogger log
    INFO: MBean: oracle.mds.lcm:name=MDSAppRuntime,type=MDSAppRuntime,Application=UI deregistered
    Aug 13, 2009 11:39:47 AM oracle.adf.share.weblogic.listeners.ADFApplicationLifecycleListener postStop
    INFO: ADFApplicationLifecycleListener.postStop
    Aug 13, 2009 11:39:47 AM oracle.adf.share.config.ADFConfigFactory cleanUpApplicationState
    INFO: Cleaning up application state
    <Aug 13, 2009 11:39:47 AM IST> <Error> <Deployer> <BEA-149265> <Failure occurred in the execution of deployment request with ID '1250143764562' for task '2'. Error is: 'weblogic.application.ModuleException: '
    weblogic.application.ModuleException:
         at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1376)
         at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:452)
         at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204)
         at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
         at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)
         Truncated. see log file for complete stacktrace
    java.lang.IllegalAccessError: tried to access method oracle.adf.controller.v2.lifecycle.Lifecycle$Phase.<init>(Ljava/lang/String;)V from class oracle.adfinternal.controller.faces.lifecycle.JSFLifecycle$JSFPhase
         at oracle.adfinternal.controller.faces.lifecycle.JSFLifecycle$JSFPhase.<init>(JSFLifecycle.java:22)
         at oracle.adfinternal.controller.faces.lifecycle.JSFLifecycle.<clinit>(JSFLifecycle.java:40)
         at oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener.<init>(ADFPhaseListener.java:241)
         at oracle.adfinternal.controller.faces.lifecycle.ADFLifecyclePhaseListener.<init>(ADFLifecyclePhaseListener.java:26)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         Truncated. see log file for complete stacktrace
    >
    <Aug 13, 2009 11:39:47 AM IST> <Error> <Deployer> <BEA-149202> <Encountered an exception while attempting to commit the 1 task for the application 'UI'.>
    <Aug 13, 2009 11:39:47 AM IST> <Warning> <Deployer> <BEA-149004> <Failures were detected while initiating deploy task for application 'UI'.>
    <Aug 13, 2009 11:39:47 AM IST> <Warning> <Deployer> <BEA-149078> <Stack trace for message 149004
    weblogic.application.ModuleException:
         at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1376)
         at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:452)
         at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204)
         at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
         at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)
         Truncated. see log file for complete stacktrace
    java.lang.IllegalAccessError: tried to access method oracle.adf.controller.v2.lifecycle.Lifecycle$Phase.<init>(Ljava/lang/String;)V from class oracle.adfinternal.controller.faces.lifecycle.JSFLifecycle$JSFPhase
         at oracle.adfinternal.controller.faces.lifecycle.JSFLifecycle$JSFPhase.<init>(JSFLifecycle.java:22)
         at oracle.adfinternal.controller.faces.lifecycle.JSFLifecycle.<clinit>(JSFLifecycle.java:40)
         at oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener.<init>(ADFPhaseListener.java:241)
         at oracle.adfinternal.controller.faces.lifecycle.ADFLifecyclePhaseListener.<init>(ADFLifecyclePhaseListener.java:26)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         Truncated. see log file for complete stacktrace
    >
    [11:39:47 AM] Weblogic Server Exception: weblogic.application.ModuleException:
    [11:39:47 AM] Caused by: java.lang.IllegalAccessError: tried to access method oracle.adf.controller.v2.lifecycle.Lifecycle$Phase.<init>(Ljava/lang/String;)V from class oracle.adfinternal.controller.faces.lifecycle.JSFLifecycle$JSFPhase
    [11:39:47 AM] See server logs or server console for more details.
    oracle.jdeveloper.deploy.DeployException: oracle.jdeveloper.deploy.DeployException: oracle.jdeveloper.deploy.DeployException: Deployment Failed
    oracle.jdeveloper.deploy.DeployException: oracle.jdeveloper.deploy.DeployException: oracle.jdeveloper.deploy.DeployException: Deployment Failed[11:39:47 AM] #### Deployment incomplete. ####
         at oracle.jdevimpl.deploy.common.Jsr88RemoteDeployer.doDeploymentAction(Jsr88RemoteDeployer.java:341)
         at oracle.jdevimpl.deploy.common.Jsr88RemoteDeployer.deployImpl(Jsr88RemoteDeployer.java:235)
         at oracle.jdeveloper.deploy.common.AbstractDeployer.deploy(AbstractDeployer.java:94)
         at oracle.jdevimpl.deploy.fwk.WrappedDeployer.deployImpl(WrappedDeployer.java:39)
         at oracle.jdeveloper.deploy.common.AbstractDeployer.deploy(AbstractDeployer.java:94)
         at oracle.jdeveloper.deploy.common.BatchDeployer.deployImpl(BatchDeployer.java:82)
         at oracle.jdeveloper.deploy.common.AbstractDeployer.deploy(AbstractDeployer.java:94)
         at oracle.jdevimpl.deploy.fwk.WrappedDeployer.deployImpl(WrappedDeployer.java:39)
         at oracle.jdeveloper.deploy.common.AbstractDeployer.deploy(AbstractDeployer.java:94)
         at oracle.jdevimpl.deploy.fwk.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:442)
         at oracle.jdeveloper.deploy.DeploymentManager.deploy(DeploymentManager.java:209)
         at oracle.jdevimpl.runner.adrs.AdrsStarter$6$1.run(AdrsStarter.java:1469)
    Caused by: oracle.jdeveloper.deploy.DeployException: oracle.jdeveloper.deploy.DeployException: Deployment Failed
         at oracle.jdevimpl.deploy.common.Jsr88DeploymentHelper.redeployApplications(Jsr88DeploymentHelper.java:627)
         at oracle.jdevimpl.deploy.common.Jsr88RemoteDeployer.doDeploymentAction(Jsr88RemoteDeployer.java:315)
         ... 11 more
    Caused by: oracle.jdeveloper.deploy.DeployException: Deployment Failed
         at oracle.jdevimpl.deploy.common.Jsr88DeploymentHelper.redeployApplications(Jsr88DeploymentHelper.java:608)
         ... 12 more
    #### Cannot run application UI due to error deploying to DefaultServer.
    [Application UI stopped and undeployed from Server Instance DefaultServer]

    I was facing a similar error, the problem was because of adf-controller.jar. My error was :
    java.lang.IllegalAccessError: tried to access method oracle.adf.controller.v2.lifecycle.Lifecycle$Phase.<init>(Ljava/lang/String;)V from class oracle.adfinternal.controller.faces.lifecycle.JSFLifecycle$JSFPhase
    The jar's 10g edition has  (1st part)oracle.adf.controller.v2.lifecycle.Lifecycle$Phase and 11g edition has (2nd part) oracle.adfinternal.controller.faces.lifecycle.JSFLifecycle$JSFPhase. So I created my own jar extracting both jars at one place using the following command
    jar -cf adf-controller.jar .
    This solved my problem.
    Hope you get the idea. The best way to face these type of errors is opening the archive and checking for the files for which the compiler is complaining.

Maybe you are looking for

  • How do I control my program?

    Hi, The program below works fine, except the control is all out of whack. I would like to control the program flow from the main method. Hence call the getSNMP() and store the result of fixResponseString() to a global variable. But I keep on receivin

  • Problem with my ipod mini

    Hi @ all i have a problem. I formated my ipod on windows and no i can't turn it on, everytime it shows the folder with the exclamation mark. I downloaded the iPod updater to recover it, but evertime it says: Eroror at writing on hard disk. I have no

  • Can't expand Scrolling Credits to more than 3.3 seconds

    I'm adding a scrolling credit at the end of my movie; not over a video clip, but as a stand-alone credit with one of the standard backgrounds. When I first put it in the project, it defaults to a 2-second length. I need about 15 seconds, but it will

  • CVI IDE: Is it possible to see list of functions for faster navigation?

    Colleagues, Very simple question about CVI IDE. Is it possible to see whole list of functions for fast and convenient navigation, like in Micro$oft Visual Studio: When I have C code with more than 20-30 functions and 2000+ lines - its a very inconven

  • Troubles syncing itunes playlist to iphone4

    Hello, I had organized my playlists in my itunes, but when I sync my iphone, the playlist comes up with a whole different list of music than what the playlist was supposed to be. The phone recognises that I made a playlist (same playlist name, etc..)