Extending a class that uses Generics

I'm trying to create a TableModel where the model deals with rows of data. Each row must be of the same "type", hence the need for generics. My RowTableModel is abstract. I'm trying to provide a concrete implentation for a model to use a List (ie. Vector or ArrayList) as the row type. But I can't figure out how to genericize the ListTableModel.
import java.util.*;
import javax.swing.table.*;
abstract class Row2TableModel<T> extends AbstractTableModel
    protected List<T> modelData;
    private List<String> columnNames;
    private Class[] columnClasses;
    private Boolean[] isColumnEditable;
    public Row2TableModel(List<String> columnNames)
        this(new ArrayList<T>(), columnNames);
    public Row2TableModel(List<T> modelData, List<String> columnNames)
        setDataAndColumnNames(modelData, columnNames);
//  Implement the TableModel interface
    public Class getColumnClass(int column)
        return Object.class;
    public int getColumnCount()
        return columnNames.size();
    public String getColumnName(int column)
        return "something";
    public int getRowCount()
        return modelData.size();
    public boolean isCellEditable(int row, int column)
        return true;
//  Example of custom methods
    public T getRow(int row)
        return modelData.get( row );
    public void insertRow(int row, T rowData)
        modelData.add(row, rowData);
        fireTableRowsInserted(row, row);
    protected void setDataAndColumnNames(List<T> modelData, List<String> columnNames)
        this.modelData = modelData;
        this.columnNames = columnNames;
        columnClasses = new Class[getColumnCount()];
        isColumnEditable = new Boolean[getColumnCount()];
        fireTableStructureChanged();
    class List2TableModel extends Row2TableModel
        public List2TableModel(List<String> columnNames)
            super(columnNames);
        public List2TableModel(List<List> modelData, List<String> columnNames)
            super(modelData, columnNames);
    //  Provide implementation of TableModel methods
        public Object getValueAt(int row, int column)
            List rowData = (List)getRow( row );
            return rowData.get( column );
        @SuppressWarnings("unchecked")
        public void setValueAt(Object value, int row, int column)
            List rowData = (List)getRow( row );
            rowData.set(column, value);
            fireTableCellUpdated(row, column);
}

Hi,
You mean something like that in your impementation
class List2TableModel extends Row2TableModel<List<Integer>> {
          public List2TableModel(List<String> columnNames) {
               super(columnNames);
          public List2TableModel(List<List<Integer>> modelData, List<String> columnNames) {
               super(modelData, columnNames);
          // Provide implementation of TableModel methods
          public Integer getValueAt(int row, int column) {
               List<Integer> rowData = (List<Integer>) getRow(row);
               return rowData.get(column);
          }Regards,
Alan Mehio
London,UK

Similar Messages

  • AS3.0: How to extend a class that extends MovieClip

    When I try to set the base class of a library symbol to a
    class that doesn't DIRECTLY extend MovieClip, but instead extends
    another class that DOES extend MovieClip, it's disallowed, saying,
    "The class 'Whatever' must subclass 'flash.display.MovieClip' since
    it is linked..."
    Is this just a validation bug in the property windows, only
    checking one class deep into the inheritance hierarchy? Because the
    specified class does extend MovieClip, just two levels in instead
    of one. Is there a fix for this? Or must library symbols always
    directly extend MovieClip? If so, why?

    Which classes from flash.display have you imported. Just
    because a class extends another doesn't mean that it inherits all
    of its properties. Saying a class extends sprite doesn't give you
    access to all of it's properties, members and display unless you
    first import flash.display.* or flash.display.Sprite. If you aren't
    already importing flash.display.*, try importing
    flash.display.MovieClip and see what happens...

  • Import java class that uses DbConnection

    How to import java class that uses DbConnection? I don't want to write my own PluginDataSource.
    It is possible to get Connection in imported java classes?

    This is not possible. Even connection used by individual PDS are only limited to those individaul PDS only and are not shared across them.
    Thanks
    Rohit

  • Making a generic class that uses interfaces.

    I've learned how to do this:
    class MyClass<T extends Object> {
    }But I want a generic class that takes objects that implement another object like this:
    class MyClass<T implements Runnable> {
    }Why doesn't this work? Is there any way to do this?

    happypigface wrote:
    Yes thank you. Thats strange that Java does that. I didn't really test it yet, but I know Runnable is an instance and eclipse doesn't have any compiling errors for it. I'm glad that you can do this. It wouldn't very useful if you could only specify that the generic class had to be a subclass, not an implementation of a class.Generics are about types rather than classes and interfaces. Hence, one specifies the supertype(s) of a Generic Parameter by using the extends keyword.
    Note, however, it's possible to extend multiple interface types but only one class type.

  • Deploying java class that uses oraclexmlsql.jar

    Hi,
    I'm trying to deploy a java class that I wrote. It simply gets some data out of my oracle database as xml using the oraclexmlsql package. It works fine when I compile it within JDeveloper.
    When I try to deploy it JDeveloper gives out the following error:
    Errors in xmlquerydb:
    ORA-29521: refferenced name oracle/xml/sql/query/OracleXMLQuery could not be found
    loadjava: 1 errors
    I can't figure out why that happens. I have used other classes and deployed them as Java stored Procedure and they work fine.
    Thanks for help
    Andre

    I tried to load the oraclexmlsql.jar into the shema where I put my class. The classes from this jar were loaded but can not be compiled( apart from 3 ). I also tried loading my class into sys but I still can't compile it or the oraclexmlsql.jar classes.
    Is the xsu12.jar a collection of all the classes that are allready in Sys after the database install?
    I have noticed that on expanding the oraclexmlsql.jar file has a strange format and two classes classes are in the directory from which I expanded the jar. These two classes do not get a synonym on loading into the db. Could that have anything to do with it?
    Thanks for more help
    Andre

  • Extending a component that uses mx:script

    I have a Flex project whose main mxml file includes an mx:script block, which points to an external file. Although a good deal of the functionality of the application is abstracted into classes, a fair bit of the implementation such as UI element animation / interaction is inside the file pointed to by mx:script.
    I now have to make an extension to the application, but don't want to copy-paste the script file. However as it is not a class, I can't just extend it, and I can't include it into another file and override its methods either. I could wrap the whole thing inside a class, but then I'll be forced to refer to stage components using this["componentName"] instead of just this.componentName, I also don't get code completion using this, and there are hundreds of places in the file I'd need to correct.
    Has anyone run into the issue of trying to extend an mxml component like this? If so, how did you do it?

    Ok so I read up on MXML documentation, and how that translates to a compiled .swf file, and found that functions and variables declared in the mx:script block are added to the application's class upon compile. With this, I reasoned that if I declared my old application as a custom class, and then inherited from that class with the new application, the new app would inherit everything from the old one... Didn't work. However, if instead of declaring a custom class for the old application, I instead declare a custom class for my new app that extends the old apps application NAME, stuff compiles. I'm getting some null pointer errors though, so not sure if something went tits up somewhere, will investigate.

  • Error 1119 when class extends another class that extends movieclip

    hiya
    i came across this problem and i have no clue why it's happening. basically, consider 2 nested movieclips on the stage, something like stage -> main -> filler.  both movieclips have instance names (main and filler).
    in the library, i set main to export for actionscript, using class A:
    package {
        import flash.display.MovieClip;
        public class A extends MovieClip {     
            public function A ():void {
                trace ('construct A');
                trace (this.filler); // should trace [movieclip] etc
    it works fine. now i change it's export settings to use class B, that extends A, and it breaks:
    package {
        import flash.display.MovieClip;
        public class B extends A {
            public function B ():void {
                trace ('construct B');
    this throws an error 1119: Access of possibly undefined property filler through a reference with static type A.
    can anyone give me a hint on that, as it works with class A, but not B extending A? i understand it was meant to work?
    many thanks

    afaik, if you dont declare super(), flash will make a call for you (but best practice is to call it always).
    but i found the "solution" in another forum.
    it seems that flash implicitly generates variables if you have instance names/symbols on the stage. there is an option to disable that under publish settings -> Actionscript version -> Settings -> automatically declare stage instances. by disabling that, we were able to declare public var filler:MovieClip; on class A, and that worked.
    although, that solution doesnt look attractive to me. the other solution posted on another forum was to make calls to this ["filler"] instead of this.filler. that seems to work fine. i guess it has to do with the automatic variable generated thing.. who knows?
    i hope that helps someone else too

  • Help! - JRE can't find classes that use inner classes!

    Whenever I try to launch an app using the JRE, if the class was built with an inner class definition, the JRE says it can't find the class.
    For instance:
    I created a class called GUI, which contains anonymous inner class definitions for the button handlers: addActionListener(new ActionListener()){, etc. 
    When I compile this class I get GUI.class and GUI$1.class
    When I try to launch this using the JRE:
    jre -cp c:\progra~1\myApps GUI
    The JRE spits out
    'Class not found: GUI'
    BUT if I go back and remove the action handlers so that the only compiled class file is GUI.class (not GUI$1.class) then the JRE can find the class no problem.
    What in the good Lord's name is going on here?

    Thanks for the response. Got the 1.2.2 version of the JRE, where I guess you no longer invoke jre.exe (no such file exists) but java.exe instead (not well documented).
    Also, the newer version of the JRE has no problems locating classes, so I guess I'm OK.

  • Sample Javadoc comments for classes or methods using generics?

    Can anyone show me a sample Javadoc comment for a class or a method that uses generics. All my attempts so far ended up in warnings from the Javadoc tool..
    I also looked in the Sun forums, in the Javadoc documentation, but nowhere could I find anything that would help me write correct javadoc comments.
    Any luck for you guys?
    Thanks a lot,
    -Laurent

    Thanks man, sorry it must seem obvious to you, but
    for some reason I couldn't get it to work.No. The first time I also had to ask.
    Now an even more difficult (for me) question: how
    would you refer to that method in a @see or {@link
    ..} javadoc comment?Manually erase the method:
    * The see tag refers to this method
    * @param <T> a type variable
    * @see #foo(Object)
    <T> void foo(T t) {}

  • JSP extending application class?

    Greetings,
              I'm in the midst of porting some servlets from an implementation that
              didn't use jsp at all to a MVC type model.
              For some quick and dirty output, I wanted to define a couple jsp files
              that extended a app BaseServlet class (frame and menu functions included
              on this servlet) so that
              I could do stuff like this
              </body>
              <% setSideMenu(<array of Menu structures from session>); %>
              ... other html
              where setSideMenu was one of the functions this jsp inherited from my
              BaseServlet class.
              Unfortunately, the JSP compiled, but whenever I try to use it, the
              client browser sits waiting for output that never comes.
              Now, before I go off and debug this with lots of printlns, is there
              some easy explaination for why WLS would do this (did I break the JSP
              implementation by extending a class that was not weblogic.xxx?)
              If I remove the "page extends..." directive, the jsp returns after
              compilation ok.
              Thanks In Advance,
              Brian Homrich
              Chicago Illinois
              

      There is no  such thing as a javafx  class.  It is a regular  java class.  The Aapplication class is  the entry
    point  for JavaFX application.  You have to extend the Application class to create Javafx  application .

  • Failure When Deploying EJB Project That Uses Library Onto Glassfish

    <font size=4>Hi,
    I have a multi project application that I am developing and I am having issues testing it. I have set up a EAR, WAR, EJB, and two library JARs. The EJB contains classes that use components from the library JARs or implement abstract classes from the library JARs. I have added the library JARs to the compile-time libraries of the EJB. I then also added the library JARs to the libraries of the EAR. However when I then go to deploy the EAR onto the Glassfish server I get this error, displayed in the Glassfish log:</font><br>
    <font size=2><font color="red">WARNING: Error in annotation processing: java.lang.NoClassDefFoundError: com/foo/sdk/core/AbstractClass</font><br>
    <font color="red">WARNING: Error in annotation processing: java.lang.NoClassDefFoundError: com/foo/sdk/core/AbstractClass</font><br>
    <font color="red">WARNING: Error in annotation processing: java.lang.NoClassDefFoundError: com/foo/sdk/core/AbstractClass</font><br>
    <font color="red">WARNING: Error in annotation processing: java.lang.NoClassDefFoundError: com/foo/sdk/core/AbstractClas</font><br>
    <font color="red">SEVERE: Class [ com/foo/sdk/core/InterfaceClass ] not found. Error while loading [ class com.foo2.BeanFooClass ]</font><br>
    <font color="red">SEVERE: Exception while deploying the app [FooEAR]</font><br>
    <font color="red">SEVERE: Invalid ejb jar [BeanFoo.jar]: it contains zero ejb. </font><br>
    Note:
    1. A valid ejb jar requires at least one session, entity (1.x/2.x style), or message-driven bean.
    2. EJB3+ entity beans (@Entity) are POJOs and please package them as library jar.
    3. If the jar file contains valid EJBs which are annotated with EJB component level annotations (@Stateless, @Stateful, @MessageDriven, @Singleton), please check server.log to see whether the annotations were processed properly.
    java.lang.IllegalArgumentException: Invalid ejb jar [BeanFoo.jar]: it contains zero ejb.
    Note:
    1. A valid ejb jar requires at least one session, entity (1.x/2.x style), or message-driven bean.
    2. EJB3+ entity beans (@Entity) are POJOs and please package them as library jar.
    3. If the jar file contains valid EJBs which are annotated with EJB component level annotations (@Stateless, @Stateful, @MessageDriven, @Singleton), please check server.log to see whether the annotations were processed properly.
         at com.sun.enterprise.deployment.util.EjbBundleValidator.accept(EjbBundleValidator.java:76)
         at com.sun.enterprise.deployment.util.ApplicationValidator.accept(ApplicationValidator.java:128)
         at com.sun.enterprise.deployment.EjbBundleDescriptor.visit(EjbBundleDescriptor.java:730)
         at com.sun.enterprise.deployment.Application.visit(Application.java:1768)
         at com.sun.enterprise.deployment.archivist.ApplicationArchivist.validate(ApplicationArchivist.java:799)
         at com.sun.enterprise.deployment.archivist.ApplicationArchivist.openWith(ApplicationArchivist.java:277)
         at com.sun.enterprise.deployment.archivist.ApplicationFactory.openWith(ApplicationFactory.java:240)
         at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:170)
         at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:93)
         at com.sun.enterprise.v3.server.ApplicationLifecycle.loadDeployer(ApplicationLifecycle.java:826)
         at com.sun.enterprise.v3.server.ApplicationLifecycle.setupContainerInfos(ApplicationLifecycle.java:768)
         at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:368)
         at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
         at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:370)
         at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:355)
         at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:370)
         at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1067)
         at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:96)
         at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1247)
         at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1235)
         at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:465)
         at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:222)
         at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:168)
         at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
         at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:234)
         at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:822)
         at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:719)
         at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1013)
         at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
         at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
         at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
         at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
         at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
         at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
         at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
         at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
         at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
         at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
         at java.lang.Thread.run(Thread.java:679)
    <font color="red">SEVERE: Exception while deploying the app [FooEAR] : Invalid ejb jar [FooBean.jar]: it contains zero ejb. </font><br>
    Note:
    1. A valid ejb jar requires at least one session, entity (1.x/2.x style), or message-driven bean.
    2. EJB3+ entity beans (@Entity) are POJOs and please package them as library jar.
    3. If the jar file contains valid EJBs which are annotated with EJB component level annotations (@Stateless, @Stateful, @MessageDriven, @Singleton), please check server.log to see whether the annotations were processed properly.</font><br>
    <font size=4>I am using these technologies:
    NetBeans IDE 7.0 for Java EE
    Glassfish 3.1
    I did read that putting the libraries in this directory: <glassfish_home>/domains/domain1/lib may resolve the problem, however there must be a better way.
    Any help would be greatly appreciated!</font>
    Edited by: 866180 on Jun 15, 2011 2:32 PM

    First of all, use a normal font when posting a question. This is just terrible to read.
    You have multiple failures here. Did you actually read and try to understand the error?
    java.lang.NoClassDefFoundError: com/foo/sdk/core/AbstractClassJava is not going to lie, this class is not on the classpath of the application. Either the jar is missing, the class is missing from the jar or you put the jar in the wrong place. Open up the ear using your favorite zip tool and check out its structure. What is the path to the jar inside it?
    Also, open up the META-INF/manifest.mf file inside the EJB jar. Is there a class-path line in there? There shouldn't be!
    A valid ejb jar requires at least one session, entity (1.x/2.x style), or message-driven bean. Apparently your EJB jar contains not a single EJB or MDB class. Did you forget some annotations perhaps?
    Seems to me that your application compiles, but other than that it is very much broken.

  • Portlets development: When to use the class that extends PortletBridge...

    When I create some Portlet (.jspx based) JDeveloper generate some resources. One of those is a class (with the name that I´ve configured) that extends PortletBridge...
    Ok. So, I want to know if I use JSF standards should I put my actions into this class or should I create another Managed bean to handle that? What to do with this generated class?
    Thank you.

    So you want to create a portlet that uses JSF instead of JSP?
    You can JDev do that for you. When you create a new portlet there is a step where you can specify the default page for the portlet mode (view, edit).
    On the right hand side you can select ADF JSF (or something like that).
    JDev will then create a class that extends the PortletBridge class and you don't have to do anything more. Just edit the jspx like it's a normal page.

  • Using the UI editor  for a class that extends an abstract class

    Hi,
    At the moment it's unfortunately impossible to use the UI editor to edit a class that extends a certain abstract class. There is a way to circumvent this problem, by using a proxy class. Does anyone know how to create a proxy class for this purpose and how to register it?
    Hopefully a future JDeveloper release will solve this problem. Is this a planned feature?
    Regards,
    Peter

    I hope it works for you now (why using , but not indentation?).                                                                                                                                                                                           

  • Getting information about a class using generics...

    Hi there.
    I have declared a class: "public class SomeClass<SC extends SomeClass>{/*Do something*/}".
    Can anyone tell me why a statement like "System.out.println(SC.class.getSimpleName());" within a method defined in SomeClass will not compile? Is there some other way to achieve what I want?

    YoungWinston wrote:
    Owen Thomas wrote:
    Well then, it would be great to be able to key a switch that tells the compiler one isn't working with "legacy code", if this might allow generics to reach a hitherto untapped potential.I don't see how, since not everybody is going to need (or want) such a switch. It also sounds like a recipe for disaster. Should we add such a switch for every enhancement that might have backwards-compatibility problems?Isn't that what the "deprecated" feature is for? Sure, there'll be backwards compatibility issues for a while, but after a few years, with management, things should settle as code is moved from pre to post "super-generics".
    Much of the Java core, and many third-party libraries might have to be re-written in that circumstance... economic stimulus.How could the Java core have been re-written if it requires use of a "not backwards-compatible" flag?i have not reason to believe that code compiled under a super-generics switch need not be backwards-compatible. One may have to simply exercise care in its use.
    I didn't want to bore you with trivia, and I didn't want you to frustrate me with more quips (well-meant though I'm sure they are) about how to write code. ;-)In which case I can only assume that you're using generics for something that probably, more correctly, requires reflection. Have you looked at the relevant parts of Class, as I suggested?No, but as you are impressing on me to have a look, I could do no wrong to have a sniff around. However, with no specific motivation in the current context, I don't think anything will catch my eye. The current need isn't great enough.

  • Problem with HP-UX extended procedures that use C++ Standard library

    I am experiencing a problem with using the C++ standard library on HP-UX inside my extended procedures.
    Here is the definition for the library and procedures:
    -bash-3.2$ more nuhash2.sql
    CREATE OR REPLACE LIBRARY xp_nuencryption_l
    AS
    '/home/jchamber/datasecure/lib/libxp_nuencryption.sl';
    CREATE OR REPLACE PACKAGE xp_nuencryption
    AS
    PROCEDURE xp_nuhash2;
    END xp_nuencryption;
    CREATE OR REPLACE PACKAGE BODY xp_nuencryption
    IS
    PROCEDURE xp_nuhash2
    IS EXTERNAL
    LIBRARY xp_nuencryption_l
    NAME "xp_nuhash2"
    LANGUAGE C;
    END xp_nuencryption;
    Here is the PL/SQL test program:
    -bash-3.2$ more testnuhash2.sql
    SET SERVEROUTPUT ON SIZE 1000000
    DECLARE
    BEGIN
    xp_nuencryption.xp_nuhash2 ();
    END;
    Here is the implementation of the extended procudure - notice how we are using the C++ Standard library:
    -bash-3.2$ more xp_nuhash2.cpp
    #include <string.h>
    #include <iostream>
    #include <fstream>
    class MyException {
    public:
    MyException() {}
    int func(std::ofstream& fout )
    fout << "func: About to throw exception in func()" << std::endl;
    throw MyException();
    extern "C"
    void xp_nuhash2 ()
    std::ofstream fout("/home/jchamber/xp_nuhash2.txt");
    try {
    fout << "xp_nuhash2: About to call func()" << std::endl;
    func(fout);
    catch (MyException& ex) {
    fout << "xp_nuhash2: caught MyException" << std::endl;
    fout << std::flush;
    fout.close();
    Here is how we build the library on HP-UX:
    # compile
    aCC -g -AA DA2.0W DS2.0 +z -c xp_nuhash2.cpp -o xp_nuhash.o
    #link using aCC
    aCC -g -AA DA2.0W DS2.0 +z -b -o /home/jchamber/datasecure/lib/libxp_nuencryption.sl xp_nuhash.o \
    /usr/lib/pa20_64/libstd_v2.a \
    /usr/lib/pa20_64/libCsup_v2.a
    chatr +dbg enable /home/jchamber/datasecure/lib/libxp_nuencryption.sl
    Here is how we test:
    SQL> @nuhash2
    Library created.
    Package created.
    Package body created.
    SQL> @testnuhash2
    DECLARE
    ERROR at line 1:
    ORA-28576: lost RPC connection to external procedure agent
    ORA-06512: at "JCHAMBER.XP_NUENCRYPTION", line 0
    ORA-06512: at line 3
    Now, if i use classic C++ (aCC -AP) it works. The trouble is, we have a lot of code that uses the Standard C++ library and we don't have the time to port it back to classic C++.
    The problem seems to be with an incompatibility with the standard C++ library. What is the magic potion of linker and/or compiler switches that would enable my extended procedures to use the standard C++ library?
    Here is the environment we are using:
    Oracle 9i (64-bit)
    HP UX 11.11
    Regards

    I am experiencing a problem with using the C++ standard library on HP-UX inside my extended procedures.
    Here is the definition for the library and procedures:
    -bash-3.2$ more nuhash2.sql
    CREATE OR REPLACE LIBRARY xp_nuencryption_l
    AS
    '/home/jchamber/datasecure/lib/libxp_nuencryption.sl';
    CREATE OR REPLACE PACKAGE xp_nuencryption
    AS
    PROCEDURE xp_nuhash2;
    END xp_nuencryption;
    CREATE OR REPLACE PACKAGE BODY xp_nuencryption
    IS
    PROCEDURE xp_nuhash2
    IS EXTERNAL
    LIBRARY xp_nuencryption_l
    NAME "xp_nuhash2"
    LANGUAGE C;
    END xp_nuencryption;
    Here is the PL/SQL test program:
    -bash-3.2$ more testnuhash2.sql
    SET SERVEROUTPUT ON SIZE 1000000
    DECLARE
    BEGIN
    xp_nuencryption.xp_nuhash2 ();
    END;
    Here is the implementation of the extended procudure - notice how we are using the C++ Standard library:
    -bash-3.2$ more xp_nuhash2.cpp
    #include <string.h>
    #include <iostream>
    #include <fstream>
    class MyException {
    public:
    MyException() {}
    int func(std::ofstream& fout )
    fout << "func: About to throw exception in func()" << std::endl;
    throw MyException();
    extern "C"
    void xp_nuhash2 ()
    std::ofstream fout("/home/jchamber/xp_nuhash2.txt");
    try {
    fout << "xp_nuhash2: About to call func()" << std::endl;
    func(fout);
    catch (MyException& ex) {
    fout << "xp_nuhash2: caught MyException" << std::endl;
    fout << std::flush;
    fout.close();
    Here is how we build the library on HP-UX:
    # compile
    aCC -g -AA DA2.0W DS2.0 +z -c xp_nuhash2.cpp -o xp_nuhash.o
    #link using aCC
    aCC -g -AA DA2.0W DS2.0 +z -b -o /home/jchamber/datasecure/lib/libxp_nuencryption.sl xp_nuhash.o \
    /usr/lib/pa20_64/libstd_v2.a \
    /usr/lib/pa20_64/libCsup_v2.a
    chatr +dbg enable /home/jchamber/datasecure/lib/libxp_nuencryption.sl
    Here is how we test:
    SQL> @nuhash2
    Library created.
    Package created.
    Package body created.
    SQL> @testnuhash2
    DECLARE
    ERROR at line 1:
    ORA-28576: lost RPC connection to external procedure agent
    ORA-06512: at "JCHAMBER.XP_NUENCRYPTION", line 0
    ORA-06512: at line 3
    Now, if i use classic C++ (aCC -AP) it works. The trouble is, we have a lot of code that uses the Standard C++ library and we don't have the time to port it back to classic C++.
    The problem seems to be with an incompatibility with the standard C++ library. What is the magic potion of linker and/or compiler switches that would enable my extended procedures to use the standard C++ library?
    Here is the environment we are using:
    Oracle 9i (64-bit)
    HP UX 11.11
    Regards

Maybe you are looking for

  • Transaction log full

    Transaction log is full in production system ,when i was tried login into sap system it show the error message 'SNAP_NO_NEW_ENTRIES'. our system is db2 and AIX ,can any body hlep us step by step procedure for reslove the issue . For best answer will

  • How to get  Subvalues using Combo box ?

    Hi , friends, I have one Combo box : Having list of all Districts When i select one of District it will give all related villages regarding District that i selected in another combo box. How to achieve this ? in one page itself I have another idea bu

  • Date Stamping pics to be printed

    I would like to select a number of photos that are going to be printed either with a service or on my printer and add a date stamp to all of the selected photos. All I have been able to do now is edit each picture and add a date on them one at a time

  • Random bell symbol in middle of screen Iphone 4s

    At random moments (as it seems) a bel symbol appears in the middle of the screen. This symbol doesnot react on pushing it. Does any one know the function of this bel and how I can disable it? Rgeards, Ton

  • Best Firewire External Hard Drive for Mac?

    I have been waiting for Thunderbolt Hard-drives to come out, but with none out yet, i need a fast and reliable 3TB External Hardrive for my macbook pro. I will be using it for All my Picture, Audio and Video Files Pictures - Photoshop Files, all raw