JAXB : ClassCastException while using generated java objects

Hi,
I am using JAXB for unmarshalling my xml to set of java objects. It is working but when i use one child object and cast it i am getting ClassCastException.
java.lang.ClassCastException: com.sun.org.apache.xerces.internal.dom.ElementNSImpl cannot be cast to com.xyz.base.EmployeeType
My XSD
======
<xsd:complexType name="EmployeeType">
</xsd:complexType>
<xsd:complexType name="EmployeeList">
     <xsd:sequence>
          <xsd:element name="Employee" type="base:EmployeeType" maxOccurs="unbounded"/>
     </xsd:sequence>
</xsd:complexType>
JAXB Binding
==========
In Binding i am direct schema compiler to use ArrayList for EmployeeList.. as i want to use this as ArrayList.
<jxb:bindings node="//xs:complexType[@name='EmployeeList']">
          <jxb:class ref="java.util.ArrayList"/>
</jxb:bindings>
Everything works well but when i extract element from EmployeeList (i.e. ArrayList) and try to type cast it to EmployeeType, getting following exception:
java.lang.ClassCastException: com.sun.org.apache.xerces.internal.dom.ElementNSImpl cannot be cast to com.xyz.base.EmployeeType
so at the time of unmarshalling how jaxb will know about the type of child element and use accordingly.
Any help would be greatly appreciated.

Hi,
Could you try outputting the class type of the object you are trying to cast?
Check the class of the object. Say use object.class.getName().
I used jaxb quite a long time ago but I believe it resolves the classes correctly.

Similar Messages

  • Bug: generate java objects generates error and does not terminate

    During the build of java object generation...the following error occurs (below),
    the generation progress dialog does not close,
    and the process does not terminate.
    Any suggestions?
    Thank you.
    Albert
    va.lang.NullPointerException
         at oracle.ideimpl.log.TabbedLogManager.getMsgPage(TabbedLogManager.java:101)
         at oracle.toplink.addin.log.POJOGenerationLoggingAdapter.updateTask(POJOGenerationLoggingAdapter.java:42)
         at oracle.toplink.addin.mappingcreation.MappingCreatorImpl.fireTaskUpdated(MappingCreatorImpl.java:1049)
         at oracle.toplink.addin.mappingcreation.MappingCreatorImpl.generateMappedDescriptorsForTables(MappingCreatorImpl.java:231)
         at oracle.toplink.addin.mappingcreation.MappingCreatorImpl.generateMappedDescriptorsForTables(MappingCreatorImpl.java:201)
         at oracle.toplink.addin.wizard.jobgeneration.JobWizard$1.construct(JobWizard.java:401)
         at oracle.ide.util.SwingWorker$1.run(SwingWorker.java:119)
         at java.lang.Thread.run(Thread.java:595)
    ADF configuration: Release 3 (10.1.3)
    ADF Business Components     10.1.3.36.73
    CVS Version     Internal to Oracle JDeveloper 10g (client-only)
    Java™ Platform     1.5.0_05
    Oracle IDE     10.1.3.36.73
    PMD     JDeveloper Extension 1.8
    Struts Modeler Version     10.1.3.36.73
    UML Modelers Version     10.1.3.36.73
    Versioning Support     10.1.3.36.73
    Other Configuration:
    Os Name     Microsoft Windows Xp Home Edition
    Version     5.1.2600 Service Pack 2 Build 2600
    Os Manufacturer     Microsoft Corporation
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
    Schema:
    Create Table Example.Questions
    Qid Number Not Null,
    Testid Number,
    Question Varchar2(4000),
    Answer Char(4) Default 'Zzzz' Not Null
    Create Table Example.Testgenhistory
    Testgenhistory_Testid Number Not Null,
    Testid Number Not Null,
    Requestor Varchar2(100),
    Daterequested Date Default Systimestamp
    Create Table Example.Testmaster
    Testid Number Not Null,
    Testname Varchar2(100),
    Ownerrequestor Varchar2(100) Default '[email protected]' Not Null,
    Testdatelastmodified Date
    Create Table Example.Users
    Requestor Varchar2(100) Not Null,
    Adminauthority Number Default 0 Not Null
    Alter Table Example.Questions
    Add Constraint Questions_Pk Primary Key
    Qid
    Enable
    Alter Table Example.Testgenhistory
    Add Constraint Testgenhistory_Pk Primary Key
    Testgenhistory_Testid
    Enable
    Alter Table Example.Testmaster
    Add Constraint Testmaster_Pk Primary Key
    Testid
    Enable
    Alter Table Example.Users
    Add Constraint Users_Pk Primary Key
    Requestor
    Enable
    Alter Table Example.Questions
    Add Constraint Questions_Testmaster_Fk1 Foreign Key
    Testid
    References Myschema.Testmaster
    Testid
    ) Enable
    Alter Table Example.Testgenhistory
    Add Constraint Testgenhistory_Users_Fk1 Foreign Key
    Requestor
    References Myschema.Users
    Requestor
    ) Enable
    Alter Table Example.Testgenhistory
    Add Constraint Testgenhistory_Testmaster_Fk Foreign Key
    Testid
    References Myschema.Testmaster
    Testid
    ) Enable
    Create Index Example.Testmaster_Index1 On Example.Testmaster (Testid);
    Create Sequence Example.Qidseq Increment By 1 Start With 1 Minvalue 1 ;
    Create Sequence Example.Testidseq Increment By 1 Start With 1 Minvalue 1 ;

    Hi Anuj,
    Sorry for the reply delay. I didn't get a notification of reply on the post.
    I am still able to get the error message dialog, along with the failure for the generation to terminate. (reproduced today 4/22/06 and others seem to be seeing it as well).
    I can't identify anything specific in the steps.
    Basically...
    created a new application with ejb, adf, toplink
    choose new project
    choose toplink generate java objects
    choose an existing validated database connection
    select objects (all 4 tables in my little schema)
    click through (...next...next...) to finish
    locks up and dialog appears
    I made a video of the steps, including verifying the database connection. If you want to see it, I'll email it to you.
    here it is today (I've applied all updates available up to today):
    ava.lang.NullPointerException
         at oracle.ideimpl.log.TabbedLogManager.getMsgPage(TabbedLogManager.java:101)
         at oracle.toplink.addin.log      .updateTask(POJOGenerationLoggingAdapter.java:42)
         at oracle.toplink.addin.mappingcreation.MappingCreatorImpl.fireTaskUpdated(MappingCreatorImpl.java:1049)
         at oracle.toplink.addin.mappingcreation.MappingCreatorImpl.generateMappedDescriptorsForTables(MappingCreatorImpl.java:231)
         at oracle.toplink.addin.mappingcreation.MappingCreatorImpl.generateMappedDescriptorsForTables(MappingCreatorImpl.java:201)
         at oracle.toplink.addin.wizard.jobgeneration.JobWizard$1.construct(JobWizard.java:401)
         at oracle.ide.util.SwingWorker$1.run(SwingWorker.java:119)
         at java.lang.Thread.run(Thread.java:595)

  • How to force OTT generating  java objects?

    I've read in an Oracle white paper that Oracle has an Object Type Translator (ott) utility that creates java objects from object type definitions in the database. In my installations of Oracle 8.1.7 and 9.2i my ott utility only supports output of C structures (though in ott.exe present such strings as "public void...", "throws SQLException..."). Does anyone know how to force ott.exe generating java objects?

    OTT can generate C structures or C++ classes from object definitions. You should look at JPublisher for Java classes.

  • Can scheduled tasks be set up using a Java Object?

    I need to run a script that will create a scheduled task in
    the Coldfusion Administrator CF8. I have used a Java Object to
    register a custom tag and I am wondering if you can do the same
    thing with a scheduled task.

    No special java class/object is needed actually. ColdFusion
    offers a built-in tag for this, <cfschedule>.
    Read more here:
    http://livedocs.adobe.com/coldfusion/8/Tags_r-s_11.html

  • IMP:ClassCastException while using File upload UI in Webdynpro for java

    Hi All,
    I have used a FileUpload UI element in my screen , which is working fine for only the first time we upload a file. If we try to upload any file with out refreshing the application , a ClassCastException is being thrown. Please help me in resolving the issue.
    Thanks in advance.
    Srikanth

    Thank you!!
    1. But when i use the File Upload UI and try to use the 'data' property to retrieve the bytes i am getting a null pointer exception meaning the data is not being picked up by the UI even though browsed file has data.
    2. How I am I supposed to set the 'Resource' property while downloading a PDF which has UTF-16 text and picture??
    Note: I have done the same scenario using WD04 java without any trouble.
    reg
    vln

  • Error Generating Java Objects using TopLink

    Running online tutorial: Build a Web Application with ADF Faces and Oracle TopLink
    Generated errors when trying to build Java Objects From Table Wizard at step 9.
    [b]java.lang.NullPointerException
         at oracle.ideimpl.log.TabbedLogManager.getMsgPage(TabbedLogManager.java:101)
         at oracle.toplink.addin.log.POJOGenerationLoggingAdapter.updateTask(POJOGenerationLoggingAdapter.java:42)
         at oracle.toplink.addin.mappingcreation.MappingCreatorImpl.fireTaskUpdated(MappingCreatorImpl.java:1049)
         at oracle.toplink.addin.mappingcreation.MappingCreatorImpl.generateMappedDescriptorsForTables(MappingCreatorImpl.java:231)
         at oracle.toplink.addin.mappingcreation.MappingCreatorImpl.generateMappedDescriptorsForTables(MappingCreatorImpl.java:201)
         at oracle.toplink.addin.wizard.jobgeneration.JobWizard$1.construct(JobWizard.java:401)
         at oracle.ide.util.SwingWorker$1.run(SwingWorker.java:119)
         at java.lang.Thread.run(Thread.java:595)
    Any help welcomed
    regards
    John

    Solved!!!
    I had installed JDeveloper 10g inside a directory that had a space in the directory name.

  • Error while using LiveCycle java APIs with Http servlets:"Remote EJBObject lookup failed for ejb/Inv

    Hi all,
    When i try to run more than one servelt of the Quick Start samples that using Livecycle Java APIs and i get an error of "Remote EJBObject lookup failed for ejb/Invocation provider" from any servelt i run.
    I try some Quick samples which is not servelts (java class) and it works fine, which makes me sure that my connection properties is true.
    Environment:
    The LiveCycle is based on "Websphere v6.1", and i use "Eclipse Platform
    Version: 3.4.1".
    i install "tomcat 5.5.17" to test the servelts in developing time through Eclipse.(only for test in developing time not for deploy on )
    The Jars i added in the classpath:
    adobe-forms-client.jar
    adobe-livecycle-client.jar
    adobe-usermanager-client.jar
    adobe-utilities.jar
    ejb.jar
    j2ee.jar
    ecutlis.jar
    com.ibm.ws.admin.client_6.1.0.jar
    com.ibm.ws.webservices.thinclient_6.1.0.jar
    server.jar
    utlis.jar
    wsexception.jar
    My code is :
    Properties ConnectionProps = new Properties();
    ConnectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_EJB_ENDPOINT, "iiop://localhost:2809");
    ConnectionProps.setProperty ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,ServiceClientFactoryProperties.DSC_ EJB_PROTOCOL);
    ConnectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE,ServiceClientFa ctoryProperties.DSC_WEBSPHERE_SERVER_TYPE);
    ConnectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, "Administrator");
    ConnectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, "password");
    ConnectionProps.setProperty("java.naming.factory.initial", "com.ibm.ws.naming.util.WsnInitCtxFactory");
    //Create a ServiceClientFactory object
    ServiceClientFactory myFactory = ServiceClientFactory.createInstance(ConnectionProps);
    //Create a FormsServiceClient object
    FormsServiceClient formsClient = new FormsServiceClient(myFactory);
    //Get Form data to pass to the processFormSubmission method
    Document formData = new Document(req.getInputStream());
    //Set run-time options
    RenderOptionsSpec processSpec = new RenderOptionsSpec();
    processSpec.setLocale("en_US");
    //Invoke the processFormSubmission method
    FormsResult formOut = formsClient.processFormSubmission(formData,"CONTENT_TYPE=application/pdf&CONTENT_TYPE=app lication/vnd.adobe.xdp+xml&CONTENT_TYPE=text/xml", "",processSpec);
    List fileAttachments = formOut.getAttachments();
    Iterator iter = fileAttachments.iterator();
    int i = 0 ;
    while (iter.hasNext()) {
    Document file = (Document)iter.next();
    file.copyToFile(new File("C:\\Adobe\\tempFile"+i+".jp i++;
    short processState = formOut.getAction();
    ...... (To the end of the sample)
    My Error was:
    com.adobe.livecycle.formsservice.exception.ProcessFormSubmissionException: ALC-DSC-031-000: com.adobe.idp.dsc.net.DSCNamingException: Remote EJBObject lookup failed for ejb/Invocation provider
    at com.adobe.livecycle.formsservice.client.FormsServiceClient.processFormSubmission(FormsSer viceClient.java:416)
    at HandleData.doPost(HandleData.java:62)
    at HandleData.doGet(HandleData.java:31)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j ava:252)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
    a

    I assume here that your application is deployed on a different physical machine of where LCES is deployed and running.
    Do the following test:
    - Say that LCES is deployed on machine1 and your application is deployed on machine2. Ping machine1 from machine2 and note the ip address.
    - Ping machine1 from machine1 and note the ip address.
    The two pings should match.
    - Ping machine2 from machine1 and note the ip address.
    - Ping machine2 from machine2 and note the ip address.
    The two pings should match.
    Usually this kind of error would happen if your servers have internal and external ip addresses.

  • Generate java objects from one single XML file

    Hi,
    I want to create an XML file that describes a set of "messages" (see XML below).
    I want to generate the objects "Message" with simple getters and setters for each <message> entry.
    And a little bit more complicated, I need to generate an object "Action" that will parse an incoming message based on the fields and rules described in the XML.
    XML file:
    *<messages>*
    *<message>*
    *<name>PrivateMessage</name>*
    *<fields>*
    *<receiver maxlength="32" minlength="4"/>*
    *<sender maxlength="32" minlength="4"/>*
    *<content minlength="1"/>*
    *</fields>*
    *</message>*
    *<message>*
    *<name>MessageToAll</name>*
    Message object:
    Example:
    public class MessagePrivateMessage extends Message {
         private String sender;
         private String receiver;
         private String message;
         /* all the getters and setters for the fields above */
    Action object:
    The Action will parse an incoming message based on the rules in the XML above, and create the Message object; e.g. :
    <sender maxlength="32" minlength="4"/>
    will result to
    String sender = getNextField(fields);
    if (sender == null || sender.trim().equals("")) {
         throw new InvalidMessageException("Sender username null");
    if (sender.length() > 32 || sender.length() < 4) {
         throw new InvalidMessageException("Sender username exceeds 32 characters: " + sender);
    Example:
    public class ActionPrivateMessage extends ActionReceiveClient<MessagePrivateMessage> {
         public ActionPrivateMessage() {
         public void execute(LinkedList<String> fields, EndpointServer server, int idMessage, Object stream, Date dateRead)
                   throws InvalidMessageException {
              MessagePrivateMessage dtoMessage = new MessagePrivateMessage();
              dtoMessage.setDateServerRead(dateRead);
              dtoMessage.setId(idMessage);
              dtoMessage.setStream(stream);
              parseMessage(fields, dtoMessage);
              dtoMessage.setDateServerParsed(new Date());
              server.sendPrivateMessage(dtoMessage);
         public void parseMessage(LinkedList<String> fields, MessagePrivateMessage dto)
                   throws InvalidMessageException {
              super.parseMessage(fields, dto);
              String sender = getNextField(fields);
              if (sender == null || sender.trim().equals("")) {
                   throw new InvalidMessageException("Sender username null");
              if (sender.length() > 32 || sender.length() < 4) {
                   throw new InvalidMessageException("Sender username exceeds 32 characters: " + sender);
              String receiver = getNextField(fields);
              if (receiver == null || receiver.trim().equals("")) {
                   throw new InvalidMessageException("Receiver username null");
              if (receiver.length() > 32 || receiver.length() < 4) {
                   throw new InvalidMessageException("Receiver username exceeds 32 characters: " + receiver);
              String message = getNextField(fields);
              if (message == null || message.trim().equals("")) {
                   throw new InvalidMessageException("Message null");
              if (message.length() < 1) {
                   throw new InvalidMessageException("Message exceeds 200 characters: " + message);
              if (!fields.isEmpty()) {
                   String remainingFields = "";
                   while (!fields.isEmpty()) {
                        remainingFields += fields.remove(0) + " ";
                   throw new InvalidMessageException("Fields remaining but everything has been parsed: " + remainingFields);
              dto.setSender(sender);
              dto.setReceiver(receiver);
              dto.setMessage(message);
    First question, is it possible ?
    Second one would be, how ? Any tips ?
    Thank you for any help :)

    matthew_be wrote:
    First question, is it possible ?Sure, why not.
    Second one would be, how ?Well, I think the standard way is to write the required code.
    If you really can't come up with a way, then you probably shouldn't be trying to implement such a thing.
    Any tips ?Before I would start writing my own framework for something like that, I'd take a look at all the existing Java/XML technologies out there (of which there are a bunch). Either an existing framework will solve your problem or it will prove to be helpful in your own implementation.

  • ClassCastException while looking up RMI objects bound to weblogic.JNDI under WLS 6.1

    We deploy a servlet (in a single .war archive) establishing a RMI connection to
    an external Java object bound into weblogic JNDI (WLS 6.1).
    We get a ClassCastException on invoking JNDI lookup:
    Servlet failed with Exception>
    java.lang.ClassCastException: $Proxy67
         at com.thyssenkrupp.tks.tnt.admin.rmi.ClientServlet.init(ClientServlet.java:81)
         at weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubImpl.java:698)
         at weblogic.servlet.internal.ServletStubImpl.createInstances(ServletStubImpl.java:641)
         at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:586)
         at weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.java:366)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:240)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
         at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2390)
         at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:1959)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    Curiously we don't observe these problems when we include all the classes of the
    remote application in the classpath of the WebLogic Server. Actually we want to
    avoid including external classes in weblogic.classpath for (hot) deployment reasons.
    It also seems that problems don't occur when accessing the remote object from
    an independent client application.
    We expect this to be a classloader conflict within WLS 6.1
    Does anybody know a solution to our problems?
    Thanks for suggestions
    Andreas Koerner

    There was a similar bug that was supposedly fixed in WL 6.1 SP 2. I had
    filed a bug on this myself, and was given a patch for SP1, you should be
    able to ask for the patch for CR060416.
    Peter Mularien
    Deploy Solutions, Inc.
    Andreas Koerner wrote:
    >
    We deploy a servlet (in a single .war archive) establishing a RMI connection to
    an external Java object bound into weblogic JNDI (WLS 6.1).
    We get a ClassCastException on invoking JNDI lookup:
    Servlet failed with Exception>
    java.lang.ClassCastException: $Proxy67
    at com.thyssenkrupp.tks.tnt.admin.rmi.ClientServlet.init(ClientServlet.java:81)
    at weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubImpl.java:698)
    at weblogic.servlet.internal.ServletStubImpl.createInstances(ServletStubImpl.java:641)
    at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:586)
    at weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.java:366)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:240)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
    at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2390)
    at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:1959)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    Curiously we don't observe these problems when we include all the classes of the
    remote application in the classpath of the WebLogic Server. Actually we want to
    avoid including external classes in weblogic.classpath for (hot) deployment reasons.
    It also seems that problems don't occur when accessing the remote object from
    an independent client application.
    We expect this to be a classloader conflict within WLS 6.1
    Does anybody know a solution to our problems?
    Thanks for suggestions
    Andreas Koerner

  • Preventing JAXB xjc from re-generating java code of import ed schemas...

    Hi, I am using XJC to generate java code from xsd.
    However the xsd I run it on often has imports to another xsd that will be in a jar along with its java classes already existing.
    This jar is on the calsspath too.
    XJC however not only generates java code for existing xsd, but also for every import it has.
    And also for every import each of those imported xsd's might have.
    So if it were a long import chain A->B->C->D it generates code for all.
    How can i get it to generate code for only A and assume all the remaing code can be found on the jars in the classpath.
    The A.xsd also has a catalog file associated with it that has every namespace reference pointing to the correct xsd locations within jars.
    So it even has B->C mapping and C->D mapping. This was needed or else XJC didnt even generate anything at all and complained it could not reach C from B and so on.
    Catalog file solved that problem but not the fact that it keeps regnerating code.
    Thanks
    Edited by: Priyajeet on Dec 9, 2008 1:36 PM

    Problem solved.
    The xjc compiler reads file name in a case-sensitive fashion, even on windows.
    So, common.xsd and Common.xsd are seen as two distinct files.
    This was the cause of the compilation errors, since feature1 imported the schema using the filename Common.xsd, whereas the other schemas imported common using common.xsd
    I hope this could help.
    Salvatore

  • Short Dump TSV_TNEW_PAGE_ALLOC_FAILED while using shared memory objects

    Hi Gurus,
    We are using shared memory objects to stor some data which we will be reading later. I have implemented the interfce IF_SHM_BUILD_INSTANCE in root class and using its method BUILD for automatic area structuring.
    Today our developments moved from dev system to quality system, and while writing the data into the shared memory using the methods ATTACH_FOR_WRITE and DETACH_COMMIT in one report. We started getting the run time error TSV_TNEW_PAGE_ALLOC_FAILED.This is raised when the method DETACH_COMMIT is called to commit the changes in the shared memory.
    Everyhting works fine before DETACH_COMMIT. I know that it is happening since the program ran out of extended memory, but I am not sure why it is happening at DETACH_COMMIT call. If excessive memory is being used in the program, this run time error should have been raised while calling the ATTACH_FOR_WRITE method or while filling the root class attributes. I am not sure why it is happening at DETACH_COMMIT method.
    Many Thanks in advance.
    Thanks,
    Raveesh

    Hi raveesh,
    as Naimesh suggested: Probably system parameter for shared memory area is too small. Compare the system parameters in devel and QA, check what other shared memory areas are used.
    Regarding your question, why it does not fail at ATTACH_FOR_WRITE but then on DETACH_COMMIT:
    Probably ATTACH_FOR_WRITE will set an exclusive write lock on the shared memory data, then write to some kind of 'rollback' memory and DETACH_COMMIT will really put the data into shared memory area and release the lock. The 'rollback' memory is in the LUW's work memory which is much bigger as the usual shared memory size.
    This is my assumption - don't know who can verify or reject it.
    Regards,
    Clemens

  • How to use the Java objects or methods in pl/sql function as a parameter

    dear all,
    I java object passed as a parameter in pl/sql. how can i access the java objects as parameter in pl/sql function. please give a soultion to me
    mohan reddy

    I'm not sure whether this would help you.
    Have a look at this program to list files from a directory.
    CREATE GLOBAL TEMPORARY TABLE DIR_LIST
    ( FILENAME VARCHAR2(255) )
    ON COMMIT DELETE ROWS
    Table created.
    create or replace
    and compile java source named "DirList"
    as
    import java.io.*;
    import java.sql.*;
    public class DirList
    public static void getList(String directory)
    throws SQLException
    File path = new File( directory );
    String[] list = path.list();
    String element;
    for(int i = 0; i < list.length; i++)
    element = list;
    #sql { INSERT INTO DIR_LIST (FILENAME)
    VALUES (:element) };
    Java created.
    SQL>
    create or replace
    procedure get_dir_list( p_directory in varchar2 )
    as language java
    name 'DirList.getList( java.lang.String )';
    SQL> exec get_dir_list( 'C:\Bhagat' );
    PL/SQL procedure successfully completed.
    Thanks,
    Bhagat

  • How to generate Java objects from XML files with out  scema compilation

    Dear participants,
    My name is Raghavendra , i have a requirement of reading XML files Dynamically and parse them and create java types for manipulation . i will not be provided with sxd files (no schema compilation )coz no one knows how many types of structures are there. i want a generic solution. Please Help.
    Thanks ,
    Raghavendra Ach
    you can mail me to " [email protected]"

    georgemc wrote:
    You could also look at something like Apache Digester, which will parse your XML and populate Java objects with the data. A slightly steeper learning curve than the lower-level APIs such as JDOM, but that's outweighed by the lesser development effortdon't think that would work for the original problem, which seemed to indicate that the xml had an unknown structure.

  • ClassCastException While using ArrayDescriptor

    Hi,
    Can anybody help me with this,I'm trying to insert some data in a nested table(Oracle
    8i) , for which i need to create an ArrayDescriptor which needs to be passed to
    the ARRAY on creation , if i directly get the Connection from the driver , it
    works fine , but if i try to get it from the weblogic connection pool , it gives
    a ClassCastException . I know internally oracle extension for JDBC uses OracleConnection
    , but is there any other ways/workarounds ? Please reply asap .
    ArrayDescriptor descriptor = ArrayDescriptor.createDescriptor("ARRAYOFDATA",connection);
    ARRAY array = new ARRAY(descriptor, connection, elements);
    Manisha

    Hi Manisha,
    I recently ran into the same problem you did. I came up with two workarounds for
    this.
    1. Given the WebLogic wrapped connection "conn" and the following types that I work
    with:
    CREATE TYPE dh_id_typ AS OBJECT (
    id               NUMBER(18)
    CREATE TYPE dh_id_tab AS TABLE OF dh_id_typ;
    I can do the following to make an Array of dh_id_typ objects for these id numbers
    10100, 10101, 10102, 10200, 10201, 10300:
    Dynamically build a string that looks like this:
    String sql = "select dh_id_tab(dh_id_typ(10100), dh_id_typ(10101), dh_id_typ(10102),
    dh_id_typ(10200), dh_id_typ(10201), dh_id_typ(10300)) from dual";
    Next, do this:
    Statement stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery(sql);
    rs.next();
    java.sql.Array ids = rs.getArray(1);
    "ids" is a DB server-side Array with the specified values. The Array object is good
    for the duration of the transaction. No need for Oracle-specific classes and only
    one extra round-trip to the DB. The only problem is that Oracle SQL statements have
    a max length of 64K, so your Array length is limited by the generated SQL statement's
    size.
    2. The other workaround I thought of would involve batched inserts of array elements
    to a temporary table. It doesn't suffer from any size limits. It means more round-trips
    to the database, but it might scale better. It looks like this:
    temp table & sequence schema:
    CREATE SEQUENCE dh_temp_array_seq;
    CREATE TABLE dh_temp_array (
    seq_num     NUMBER(18),
    object_id     NUMBER(18)
    java code:
    long[] ids = ... // Given id's in an array of longs.
    PreparedStatement select = conn.prepareStatement("SELECT dh_temp_array_seq.NEXTVAL
    FROM DUAL");
    ResultSet rs = select.executeQuery(select);
    rs.next();
    long seqNum = rs.getLong(1);
    rs.close();
    PreparedStatement insert = conn.prepareStatement("INSERT INTO dh_temp_array (seq_num,
    object_id) VALUES (?, ?)");
    for (int index = 0; index < ids.length; index++) {
    insert.setLong(1, seqNum);
    insert.setLong(2, ids[index]);
    insert.addBatch();
    insert.executeBatch();
    String sql = "SELECT CAST(MULTISET(select object_id from dh_temp_array where seq_num=?)
    AS dh_id_tab) FROM dual";
    PreparedStatement selectArray = conn.prepareStatment(sql);
    selectArray.setLong(1, seqNum);
    rs = selectArray.executeQuery();
    rs.next();
    Array idArray = rs.getArray(1);
    . // Use Array
    PreparedStatement delete = conn.prepareStatement("DELETE FROM dh_temp_array WHERE
    seq_num=?");
    delete.setLong(1, seqNum);
    delete.executeUpdate();
    Here, "idArray" is a DB server-side Array with the specified values. Again, no need
    for an OracleConnection. This is all done on the wrapped connection.
    Of course, you will have to adapt the examples to your schema/types.
    BTW, if BEA would just follow the suggestions in Sun's JDBC 2.0 Standard Extension
    API specification, located at:
    http://java.sun.com/products/jdbc/jdbc20.stdext.pdf (See sections 6 & 7)
    Then their Pooling/XA implementations could return us the logical connection wrapper
    created by the Oracle driver (javax.sql.PooledConnection.getConnection() & javax.sql.XAConnection.getConnection()),
    which DOES implement OracleConnection, but still hides the physical database connection
    from the application code. Note, DON'T access PooledConnection or XAConnection from
    your application code. Getting PooledConnection's/XAConnection's from their respective
    data sources will create a physical database connection every time (slow). They are
    meant for application server developers (like BEA), so they can create DataSource
    implementation classes that provide connection pooling and distributed transaction
    support, without having to create an entire JDBC wrapper driver (like BEA had to,
    before JDBC 2.0 Std. Ext. API existed).
    I hope that helps.
    -Keith
    Keith Caceres
    Middleware Architect
    Tririga Inc.
    "Manisha Mehrotra" <[email protected]> wrote:
    >
    Hi,
    Can anybody help me with this,I'm trying to insert some data in a nested
    table(Oracle
    8i) , for which i need to create an ArrayDescriptor which needs to be passed
    to
    the ARRAY on creation , if i directly get the Connection from the driver
    , it
    works fine , but if i try to get it from the weblogic connection pool ,
    it gives
    a ClassCastException . I know internally oracle extension for JDBC uses
    OracleConnection
    , but is there any other ways/workarounds ? Please reply asap .
    ArrayDescriptor descriptor = ArrayDescriptor.createDescriptor("ARRAYOFDATA",connection);
    ARRAY array = new ARRAY(descriptor, connection, elements);
    Manisha

  • ClassCastException while using session bean in OC4J

    I am facing the same problem while deploying a stateless session bean in Oracle 9i AS 1.0.2.2.1. The details are given below.
    The following code snippet is used in the client to prepare for the lookup:
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory");
    env.put(Context.SECURITY_PRINCIPAL, "admin");
    env.put(Context.SECURITY_CREDENTIALS, "welcome");
    //the following line can also have the actual machine name instead of "localhost"
    env.put(Context.PROVIDER_URL, "ormi://localhost:23893/myejbs");
    Context ctx = new InitialContext(env);
    System.out.println("Getting Home....");
    Object obj=ctx.lookup("Grouping");
    System.out.println("Home Object Is : "+obj);
    GroupingHome groupingHome = (GroupingHome)obj;
    System.out.println("Got Home");
    Grouping grouping = groupingHome.create( );
    graphs=grouping.<mehtods>();
    I've edited the config/server.xml file to have the following line:
    <application name="myejbs" path="C:\oracle\ora102\j2ee\home\applications\classes\myejbs" auto-start="true" />
    which points to the directory where the class files reside
    I've also change the port in the config/rmi.xml file to 23893.
    Now... the problem that I am facing is - while I am running a client from outside the server JVM i.e standalone client... which uses the Grouping interfaces, it works fine. giving me the desired result. But the moment I place the code in a service client deployed in the server or a jsp, I get a ClassCastException for GroupingHome whereas the SOP that I have given after lookup shows that I have found - "Grouping EJBHome". The funny thisng is that bith the working client and the JSP are using sme set of interface class files - Grouping.class (Remote) and GroupingHome.class.
    Where am I going wrong?? If anybody knows, or Giri has found an answer to his query... please post a reply.
    Thanks.
    PS: I've tried new InitialContext(); solution but it didn't work. I have also narrowed the home object with javax.rmi.PortableRemoteObject.narrow(obj,GroupingHome.class) but to no avail :(.

    Hi Gauarv,
    Did you not see my reply in the following post?
    Re: 502 service temporarily unavailable
    If I'm not mistaken, this is exactly the same question as you asked
    there.
    By the way, is there some reason you are still using OC4J version
    1.0.2.2? Is there something stopping you from upgrading to the later
    versions (9.0.2 and 9.0.3)?
    Good Luck,
    Avi.

Maybe you are looking for

  • How to implement SSO to non-SAP systems using SAP logon ticket?

    Hello, We would like to implement Single Sign On between our SAP Netweaver system and a Siebel which is a non-SAP system using SAP logon tickets. Can anyone please give me some leads on this, in particular: 1. Is there a JAVA API or an SAP plug-in th

  • Hard Drive Crash and Mac Mail Messages

    The 160GB hard drive in my 17" Mac Book Pro blew up. I was able to get all my files off before it would not reboot in any mode...except for my mac mail messages, which I forgot about until it was too late. I have logged on to the web and can see them

  • DB Calendar jobs created wrong SAPXPG_DBDEST RFC connection

    Hi All, I have just migrated our Development system from a disributed Windows System to Linux. We have ECC6, running on 2 Linux servers one is the CI and the other the DB host. I have installed a stand alone gateway on the DB host, but when I try to

  • Graphic frames in a document...

    hi to all, I need all and only graphic frames  of a document? what is the right interface? like InterfacePtr<IStoryList> for story of text frames... thanks in advance!

  • Redistribution thru SCUL.

    Hi all, We have CUA implemented in our systems. I would like to have few clarifications. 1) Is it advisable to redistribute the data from SCUL? 2) is it possible to trace old idocs related to user master changes? I believe the idoc related to a user