Reg Dynamic class instance creation

Hi all,
I want to create a instance for a class inside the program, but i know class name dynamically that reside inside a table.
select Classname from <table name> into <classname>.
create object <classname>->variable that got form select query.
we have any alternative solution for this.
Reg,
Hariharan

Hi Hariharan,
DATA:
   L_INST_ASY_CALL TYPE REF TO OBJECT.
As the type of L_INST_ASY_CALL is known in runtime so declare it as of type OBJECT.
Hope this would help you.
Good luck
Narin

Similar Messages

  • Class instances creation using MEF

    Hi,
    I have class implementing one interface e.g.
    interface IFoo
    Class Foo : IFoo
    Using ServiceLocator, I want to create multiple instances of class in following manner: -
    1. instance CommonFoo
    2. instance SpecificFoo1
    3. instance SpecificFoo2
    How to export this class in such a way that if I pass "Specific" as parameter to ServiceLocator it will create new instance every time. But if I pass "Common" as parameter, ServiceLocator will create only one instance
    Regards,
    Sharda

    Hi Sharda,
    Per my understanding, you want to determine retrieving Singleton object programmatically. From the description of the following link,
    http://blogs.msdn.com/b/gblock/archive/2009/01/29/managed-extensibility-framework-preview-4-a-grab-bag-of-goodies.aspx, it is supported from MEF version 4. Please check it and try the solution on that blog. Feel free to let me know the result.
    Regards,    
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Dynamic Connection Pool Creation Failing in a cluster

    Hi,
    I am trying to create a connection pool in a clustered environment. This connection
    pool is created lazily behind a Stateless Session Bean. We first attempt to determine
    whether, the connection pool exists using JdbcServices.poolExists(someName), and
    create it if it does not exist. A failure occurs on creation because it looks
    like the connection pool might have been created by a bean on a different weblogic
    VM instance. Is there any way to dynamically create a connection pool and make
    it visible to the whole cluster? Thanks in advance for any help. Michael Dolbear
    Mar 28, 2002 5:35:08 PM MST> <Info> <JDBC> <Checking existence of connection pool
    Content
    ConnectionPool requested by user guest>
    <Mar 28, 2002 5:35:08 PM MST> <Info> <JDBC> <Creating connection pool ContentConnectionPoo
    l requested by user guest>
    weblogic.common.ResourceException: weblogic.management.MBeanCreationException:
    Start server side stack trace:
    javax.management.InstanceAlreadyExistsException: domain:Name=ContentConnectionPool,Type=JD
    BCConnectionPool
    at com.sun.management.jmx.RepositorySupport.addMBean(RepositorySupport.java:134)
    at com.sun.management.jmx.MBeanServerImpl.internal_addObject(MBeanServerImpl.java:
    2352)
    at com.sun.management.jmx.MBeanServerImpl.registerMBean(MBeanServerImpl.java:874)
    at weblogic.management.internal.RemoteMBeanServerImpl.registerMBean(RemoteMBeanSer
    verImpl.java:181)
    at weblogic.management.internal.Helper.createMBean(Helper.java:376)
    at weblogic.management.internal.Helper.createAdminMBean(Helper.java:291)
    at weblogic.management.internal.RemoteMBeanServerImpl.createAdminMBean(RemoteMBean
    ServerImpl.java:278)
    at weblogic.management.internal.MBeanHomeImpl.createAdminMBean(MBeanHomeImpl.java:
    635)
    at weblogic.management.internal.MBeanHomeImpl.createAdminMBean(MBeanHomeImpl.java:
    621)
    at weblogic.management.internal.AdminMBeanHomeImpl.createAdminMBean(AdminMBeanHome
    Impl.java:397)
    at weblogic.management.internal.AdminMBeanHomeImpl_WLSkel.invoke(Unknown
    Source)
    at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:298)
    at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:267)
    at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:22)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    --------------- nested within: ------------------
    weblogic.management.MBeanCreationException: - with nested exception:
    [javax.management.InstanceAlreadyExistsException: domain:Name=ContentConnectionPool,Type=J
    DBCConnectionPool]
    at weblogic.management.internal.Helper.createMBean(Helper.java:383)
    at weblogic.management.internal.Helper.createAdminMBean(Helper.java:291)
    at weblogic.management.internal.RemoteMBeanServerImpl.createAdminMBean(RemoteMBean
    ServerImpl.java:278)
    at weblogic.management.internal.MBeanHomeImpl.createAdminMBean(MBeanHomeImpl.java:
    635)
    at weblogic.management.internal.MBeanHomeImpl.createAdminMBean(MBeanHomeImpl.java:
    621)
    at weblogic.management.internal.AdminMBeanHomeImpl.createAdminMBean(AdminMBeanHome
    Impl.java:397)
    at weblogic.management.internal.AdminMBeanHomeImpl_WLSkel.invoke(Unknown
    Source)
    at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:298)
    at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:267)
    at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:22)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    End server side stack trace
    - with nested exception:
    [javax.management.InstanceAlreadyExistsException: domain:Name=ContentConnectionPool,Type=J
    DBCConnectionPool
    Start server side stack trace:
    javax.management.InstanceAlreadyExistsException: domain:Name=ContentConnectionPool,Type=JD
    BCConnectionPool
            at com.sun.management.jmx.RepositorySupport.addMBean(RepositorySupport.java:134)
            at com.sun.management.jmx.MBeanServerImpl.internal_addObject(MBeanServerImpl.java:
    2352)
            at com.sun.management.jmx.MBeanServerImpl.registerMBean(MBeanServerImpl.java:874)
            at weblogic.management.internal.RemoteMBeanServerImpl.registerMBean(RemoteMBeanSer
    verImpl.java:181)
            at weblogic.management.internal.Helper.createMBean(Helper.java:376)
            at weblogic.management.internal.Helper.createAdminMBean(Helper.java:291)
            at weblogic.management.internal.RemoteMBeanServerImpl.createAdminMBean(RemoteMBean
    ServerImpl.java:278)
            at weblogic.management.internal.MBeanHomeImpl.createAdminMBean(MBeanHomeImpl.java:
    635)
            at weblogic.management.internal.MBeanHomeImpl.createAdminMBean(MBeanHomeImpl.java:
    621)
            at weblogic.management.internal.AdminMBeanHomeImpl.createAdminMBean(AdminMBeanHome
    Impl.java:397)
            at weblogic.management.internal.AdminMBeanHomeImpl_WLSkel.invoke(Unknown
    Source)
            at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:298)
            at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:267)
            at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:22)
            at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
            at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    End  server side stack trace
    at weblogic.jdbc.common.internal.ConnectionPool.dynaStartup(ConnectionPool.java:47
    2)
    at weblogic.jdbc.common.internal.ConnectionPool.createPool(ConnectionPool.java:727
    at weblogic.jdbc.common.internal.ConnectionPool.createPool(ConnectionPool.java:709
    at com.thc.ids.inf.framework.opf.rdbms.datastore.ConnectionPoolCreator.createConne
    ctionPool(ConnectionPoolCreator.java:82)
    at com.thc.ids.inf.framework.opf.datastore.DataStoreRepository.createConnectionPoo
    lIfNonExistent(DataStoreRepository.java:211)
    at com.thc.ids.inf.util.persistence.content.ConnectionPoolInitializer.createConnec
    tionPoolIfNeeded(ConnectionPoolInitializer.java:48)
    at com.thc.ids.inf.services.business.crs.spi.oracle.OracleRetrievalProvider.create
    ConnectionPoolIfNeeded(Unknown Source)
    at com.thc.ids.inf.services.business.crs.spi.oracle.OracleRetrievalProvider.getIma
    ge(Unknown Source)
    at com.thc.ids.inf.services.business.crs.ContentRetrievalService.getImage(Unknown
    Source)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.thc.ids.inf.util.reflection.MethodDescription.invokeMethod(MethodDescriptio
    n.java:181)
    at com.thc.ids.inf.util.reflection.MethodInvocation.invoke(MethodInvocation.java:7
    9)
    at com.thc.ids.inf.framework.service.J2EE.ejb.ServiceBean.invoke(ServiceBean.java:
    186)
    at com.thc.ids.inf.framework.service.J2EE.ejb.ServiceBean_bjedmi_EOImpl.invoke(Ser
    viceBean_bjedmi_EOImpl.java:37)
    at com.thc.ids.inf.framework.service.J2EE.ejb.ServiceBean_bjedmi_EOImpl_WLSkel.inv
    oke(Unknown Source)
    at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:298)
    at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java:93
    at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:267)
    at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:22)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    <Mar 28, 2002 5:35:08 PM MST> <Info> <JDBC> <Checking existence of connection
    pool Content
    ConnectionPool requested by user guest>
    <Mar 28, 2002 5:35:08 PM MST> <Info> <JDBC> <Creating connection pool ContentConnectionPoo
    l requested by user guest>
    weblogic.common.ResourceException: weblogic.management.MBeanCreationException:
    Start server side stack trace:
    javax.management.InstanceAlreadyExistsException: domain:Name=ContentConnectionPool,Type=JD
    BCConnectionPool
    at com.sun.management.jmx.RepositorySupport.addMBean(RepositorySupport.java:134)
    at com.sun.management.jmx.MBeanServerImpl.internal_addObject(MBeanServerImpl.java:
    2352)
    at com.sun.management.jmx.MBeanServerImpl.registerMBean(MBeanServerImpl.java:874)
    at weblogic.management.internal.RemoteMBeanServerImpl.registerMBean(RemoteMBeanSer
    verImpl.java:181)
    at weblogic.management.internal.Helper.createMBean(Helper.java:376)
    at weblogic.management.internal.Helper.createAdminMBean(Helper.java:291)
    at weblogic.management.internal.RemoteMBeanServerImpl.createAdminMBean(RemoteMBean
    ServerImpl.java:278)
    at weblogic.management.internal.MBeanHomeImpl.createAdminMBean(MBeanHomeImpl.java:
    635)
    at weblogic.management.internal.MBeanHomeImpl.createAdminMBean(MBeanHomeImpl.java:
    621)
    at weblogic.management.internal.AdminMBeanHomeImpl.createAdminMBean(AdminMBeanHome
    Impl.java:397)
    at weblogic.management.internal.AdminMBeanHomeImpl_WLSkel.invoke(Unknown
    Source)
    at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:298)
    at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:267)
    at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:22)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    --------------- nested within: ------------------
    weblogic.management.MBeanCreationException: - with nested exception:
    [javax.management.InstanceAlreadyExistsException: domain:Name=ContentConnectionPool,Type=J
    DBCConnectionPool]
    at weblogic.management.internal.Helper.createMBean(Helper.java:383)
    at weblogic.management.internal.Helper.createAdminMBean(Helper.java:291)
    at weblogic.management.internal.RemoteMBeanServerImpl.createAdminMBean(RemoteMBean
    ServerImpl.java:278)
    at weblogic.management.internal.MBeanHomeImpl.createAdminMBean(MBeanHomeImpl.java:
    635)
    at weblogic.management.internal.MBeanHomeImpl.createAdminMBean(MBeanHomeImpl.java:
    621)
    at weblogic.management.internal.AdminMBeanHomeImpl.createAdminMBean(AdminMBeanHome
    Impl.java:397)
    at weblogic.management.internal.AdminMBeanHomeImpl_WLSkel.invoke(Unknown
    Source)
    at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:298)
    at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:267)
    at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:22)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    End server side stack trace
    - with nested exception:
    [javax.management.InstanceAlreadyExistsException: domain:Name=ContentConnectionPool,Type=J
    DBCConnectionPool
    Start server side stack trace:
    javax.management.InstanceAlreadyExistsException: domain:Name=ContentConnectionPool,Type=JD
    BCConnectionPool
            at com.sun.management.jmx.RepositorySupport.addMBean(RepositorySupport.java:134)
            at com.sun.management.jmx.MBeanServerImpl.internal_addObject(MBeanServerImpl.java:
    2352)
            at com.sun.management.jmx.MBeanServerImpl.registerMBean(MBeanServerImpl.java:874)
            at weblogic.management.internal.RemoteMBeanServerImpl.registerMBean(RemoteMBeanSer
    verImpl.java:181)
            at weblogic.management.internal.Helper.createMBean(Helper.java:376)
            at weblogic.management.internal.Helper.createAdminMBean(Helper.java:291)
            at weblogic.management.internal.RemoteMBeanServerImpl.createAdminMBean(RemoteMBean
    ServerImpl.java:278)
            at weblogic.management.internal.MBeanHomeImpl.createAdminMBean(MBeanHomeImpl.java:
    635)
            at weblogic.management.internal.MBeanHomeImpl.createAdminMBean(MBeanHomeImpl.java:
    621)
            at weblogic.management.internal.AdminMBeanHomeImpl.createAdminMBean(AdminMBeanHome
    Impl.java:397)
            at weblogic.management.internal.AdminMBeanHomeImpl_WLSkel.invoke(Unknown
    Source)
            at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:298)
            at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:267)
            at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:22)
            at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
            at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    End  server side stack trace
    at weblogic.jdbc.common.internal.ConnectionPool.dynaStartup(ConnectionPool.java:47
    2)
    at weblogic.jdbc.common.internal.ConnectionPool.createPool(ConnectionPool.java:727
    at weblogic.jdbc.common.internal.ConnectionPool.createPool(ConnectionPool.java:709
    at com.thc.ids.inf.framework.opf.rdbms.datastore.ConnectionPoolCreator.createConne
    ctionPool(ConnectionPoolCreator.java:82)
    at com.thc.ids.inf.framework.opf.datastore.DataStoreRepository.createConnectionPoo
    lIfNonExistent(DataStoreRepository.java:211)
    at com.thc.ids.inf.util.persistence.content.ConnectionPoolInitializer.createConnec
    tionPoolIfNeeded(ConnectionPoolInitializer.java:48)
    at com.thc.ids.inf.services.business.crs.spi.oracle.OracleRetrievalProvider.create
    ConnectionPoolIfNeeded(Unknown Source)
    at com.thc.ids.inf.services.business.crs.spi.oracle.OracleRetrievalProvider.getIma
    ge(Unknown Source)
    at com.thc.ids.inf.services.business.crs.ContentRetrievalService.getImage(Unknown
    Source)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.thc.ids.inf.util.reflection.MethodDescription.invokeMethod(MethodDescriptio
    n.java:181)
    at com.thc.ids.inf.util.reflection.MethodInvocation.invoke(MethodInvocation.java:7
    9)
    at com.thc.ids.inf.framework.service.J2EE.ejb.ServiceBean.invoke(ServiceBean.java:
    186)
    at com.thc.ids.inf.framework.service.J2EE.ejb.ServiceBean_bjedmi_EOImpl.invoke(Ser
    viceBean_bjedmi_EOImpl.java:37)
    at com.thc.ids.inf.framework.service.J2EE.ejb.ServiceBean_bjedmi_EOImpl_WLSkel.inv
    oke(Unknown Source)
    at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:298)
    at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java:93
    at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:267)
    at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:22)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)

    The only way to do it is using MBeans. You could search this newsgroup
    for "JDBCConnectionPoolMBean" to get an idea of how it could be done.
    Slava
    P.S. http://search.bea.com/weblogic/gonews
    "Mark Mortensen" <[email protected]> wrote in message
    news:[email protected]...
    >
    Slava,
    I am working with Mike on this issue and wanted to add some moreclarifications.
    We have a two server cluster where one of the EJB's on one of the Managedservers
    creates the connection pool. The problem comes in when a request comes tothe
    second server in the cluster. The connection pool is created by the firstserver
    but it is only assigned to the first server in the targets section on theconsole.
    It isn't assigned to the cluster. Is there a way to programmaticallyassign the
    pool to the cluster instead of just the server that created the pool?
    -Mark
    "Michael Dolear" <[email protected]> wrote:
    Hi Slava,
    Here is what I am doing. The code is spread across a couple of classes.
    I am using
    what was described in BEA's doc on dynamic connection pool creation.
    I didn't
    see anything about MBean apis required:
    * Dynamically create a connection pool using
    aConnectionPoolProperties.
    Please
    see ConnectionPoolCreator
    * for the required properties that must be sent in.
    * @param aConnectionPoolProperties
    public synchronized void createConnectionPoolIfNonExistent(Properties
    aConnectionPoolProperties)
    throwsPersistenceFrameworkInitializationException
    ConnectionPoolCreator tempPoolCreator;
    Pool tempPool;
    tempPoolCreator = new ConnectionPoolCreator();
    tempPool =tempPoolCreator.getConnectionPool(aConnectionPoolProperties);
    if (tempPool == null)
    tempPoolCreator.createConnectionPool(aConnectionPoolProperties);
    >>
    * Create Connection pool given the properties that I have beenconfigured
    with
    * @return Pool
    public Pool createConnectionPool(Properties aConnectionProperties)
    throwsPersistenceFrameworkInitializationException
    JdbcServices tempServices;
    try
    tempServices = this.lookupJdbcServices();
    tempServices.createPool(aConnectionProperties);
    returntempServices.getPool(aConnectionProperties.getProperty(CONNECTION_POOL_NAME)
    catch (Exception e)
    PersistenceFrameworkUtils.logException(e);
    throw newPersistenceFrameworkInitializationException(e.getMessage());
    * Answer a connectionPool or null.
    * @return Pool
    public Pool getConnectionPool(Properties aConnectionProperties)
    throwsPersistenceFrameworkInitializationException
    JdbcServices tempServices;
    try
    tempServices = this.lookupJdbcServices();
    if (tempServices.poolExists(
    aConnectionProperties.getProperty(CONNECTION_POOL_NAME)))
    return tempServices.getPool(
    aConnectionProperties.getProperty(CONNECTION_POOL_NAME));
    else
    return null;
    catch (Exception e)
    PersistenceFrameworkUtils.logException(e);
    throw
    newPersistenceFrameworkInitializationException(e.getMessage());
    "Slava Imeshev" <[email protected]> wrote:
    Hi Michael,
    Could you show us the code? Without looking at the code
    I can only say that JdbcServices.poolExists(someName)
    returns true only in case the pool is up and running.
    If the connection pool MBean was created but not assigned
    a target, subsequent tries to create it would fail.
    Regards,
    Slava Imeshev
    "Michael Dolbear" <[email protected]> wrote in message
    news:[email protected]...
    Hi,
    I am trying to create a connection pool in a clustered environment.This
    connection
    pool is created lazily behind a Stateless Session Bean. We first
    attempt
    to determine
    whether, the connection pool exists usingJdbcServices.poolExists(someName), and
    create it if it does not exist. A failure occurs on creation becauseit
    looks
    like the connection pool might have been created by a bean on a
    different
    weblogic
    VM instance. Is there any way to dynamically create a connection pooland
    make
    it visible to the whole cluster? Thanks in advance for any help.
    Michael
    Dolbear
    Mar 28, 2002 5:35:08 PM MST> <Info> <JDBC> <Checking existence ofconnection pool
    Content
    ConnectionPool requested by user guest>
    <Mar 28, 2002 5:35:08 PM MST> <Info> <JDBC> <Creating connection poolContentConnectionPoo
    l requested by user guest>
    weblogic.common.ResourceException:weblogic.management.MBeanCreationException:
    Start server side stack trace:
    javax.management.InstanceAlreadyExistsException:domain:Name=ContentConnectionPool,Type=JD
    BCConnectionPool
    at
    com.sun.management.jmx.RepositorySupport.addMBean(RepositorySupport.java:1
    34
    at
    com.sun.management.jmx.MBeanServerImpl.internal_addObject(MBeanServerImpl.
    ja
    va:
    2352)
    at
    com.sun.management.jmx.MBeanServerImpl.registerMBean(MBeanServerImpl.java:
    87
    4)
    at
    weblogic.management.internal.RemoteMBeanServerImpl.registerMBean(RemoteMBe
    an
    Ser
    verImpl.java:181)
    atweblogic.management.internal.Helper.createMBean(Helper.java:376)
    atweblogic.management.internal.Helper.createAdminMBean(Helper.java:291)
    at
    weblogic.management.internal.RemoteMBeanServerImpl.createAdminMBean(Remote
    MB
    ean
    ServerImpl.java:278)
    at
    weblogic.management.internal.MBeanHomeImpl.createAdminMBean(MBeanHomeImpl.
    ja
    va:
    635)
    at
    weblogic.management.internal.MBeanHomeImpl.createAdminMBean(MBeanHomeImpl.
    ja
    va:
    621)
    at
    weblogic.management.internal.AdminMBeanHomeImpl.createAdminMBean(AdminMBea
    nH
    ome
    Impl.java:397)
    atweblogic.management.internal.AdminMBeanHomeImpl_WLSkel.invoke(Unknown
    Source)
    atweblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:298)
    at
    weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:267
    at
    weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java
    :2
    2)
    at
    weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    --------------- nested within: ------------------
    weblogic.management.MBeanCreationException: - with nested exception:
    [javax.management.InstanceAlreadyExistsException:domain:Name=ContentConnectionPool,Type=J
    DBCConnectionPool]
    atweblogic.management.internal.Helper.createMBean(Helper.java:383)
    atweblogic.management.internal.Helper.createAdminMBean(Helper.java:291)
    at
    weblogic.management.internal.RemoteMBeanServerImpl.createAdminMBean(Remote
    MB
    ean
    ServerImpl.java:278)
    at
    weblogic.management.internal.MBeanHomeImpl.createAdminMBean(MBeanHomeImpl.
    ja
    va:
    635)
    at
    weblogic.management.internal.MBeanHomeImpl.createAdminMBean(MBeanHomeImpl.
    ja
    va:
    621)
    at
    weblogic.management.internal.AdminMBeanHomeImpl.createAdminMBean(AdminMBea
    nH
    ome
    Impl.java:397)
    atweblogic.management.internal.AdminMBeanHomeImpl_WLSkel.invoke(Unknown
    Source)
    atweblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:298)
    at
    weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:267
    at
    weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java
    :2
    2)
    at
    weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    End server side stack trace
    - with nested exception:
    [javax.management.InstanceAlreadyExistsException:domain:Name=ContentConnectionPool,Type=J
    DBCConnectionPool
    Start server side stack trace:
    javax.management.InstanceAlreadyExistsException:domain:Name=ContentConnectionPool,Type=JD
    BCConnectionPool
    at
    com.sun.management.jmx.RepositorySupport.addMBean(RepositorySupport.java:1
    34
    at
    com.sun.management.jmx.MBeanServerImpl.internal_addObject(MBeanServerImpl.
    ja
    va:
    2352)
    at
    com.sun.management.jmx.MBeanServerImpl.registerMBean(MBeanServerImpl.java:
    87
    4)
    at
    weblogic.management.internal.RemoteMBeanServerImpl.registerMBean(RemoteMBe
    an
    Ser
    verImpl.java:181)
    atweblogic.management.internal.Helper.createMBean(Helper.java:376)
    atweblogic.management.internal.Helper.createAdminMBean(Helper.java:291)
    at
    weblogic.management.internal.RemoteMBeanServerImpl.createAdminMBean(Remote
    MB
    ean
    ServerImpl.java:278)
    at
    weblogic.management.internal.MBeanHomeImpl.createAdminMBean(MBeanHomeImpl.
    ja
    va:
    635)
    at
    weblogic.management.internal.MBeanHomeImpl.createAdminMBean(MBeanHomeImpl.
    ja
    va:
    621)
    at
    weblogic.management.internal.AdminMBeanHomeImpl.createAdminMBean(AdminMBea
    nH
    ome
    Impl.java:397)
    atweblogic.management.internal.AdminMBeanHomeImpl_WLSkel.invoke(Unknown
    Source)
    atweblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:298)
    at
    weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:267
    at
    weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java
    :2
    2)
    at
    weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    End server side stack trace
    at
    weblogic.jdbc.common.internal.ConnectionPool.dynaStartup(ConnectionPool.ja
    va
    :47
    2)
    at
    weblogic.jdbc.common.internal.ConnectionPool.createPool(ConnectionPool.jav
    a:
    727
    at
    weblogic.jdbc.common.internal.ConnectionPool.createPool(ConnectionPool.jav
    a:
    709
    at
    com.thc.ids.inf.framework.opf.rdbms.datastore.ConnectionPoolCreator.create
    Co
    nne
    ctionPool(ConnectionPoolCreator.java:82)
    at
    com.thc.ids.inf.framework.opf.datastore.DataStoreRepository.createConnecti
    on
    Poo
    lIfNonExistent(DataStoreRepository.java:211)
    at
    com.thc.ids.inf.util.persistence.content.ConnectionPoolInitializer.createC
    on
    nec
    tionPoolIfNeeded(ConnectionPoolInitializer.java:48)
    at
    com.thc.ids.inf.services.business.crs.spi.oracle.OracleRetrievalProvider.c
    re
    ate
    ConnectionPoolIfNeeded(Unknown Source)
    at
    com.thc.ids.inf.services.business.crs.spi.oracle.OracleRetrievalProvider.g
    et
    Ima
    ge(Unknown Source)
    at
    com.thc.ids.inf.services.business.crs.ContentRetrievalService.getImage(Unk
    no
    wn
    Source)
    at java.lang.reflect.Method.invoke(Native Method)
    at
    com.thc.ids.inf.util.reflection.MethodDescription.invokeMethod(MethodDescr
    ip
    tio
    n.java:181)
    at
    com.thc.ids.inf.util.reflection.MethodInvocation.invoke(MethodInvocation.j
    av
    a:7
    9)
    at
    com.thc.ids.inf.framework.service.J2EE.ejb.ServiceBean.invoke(ServiceBean.
    ja
    va:
    186)
    at
    com.thc.ids.inf.framework.service.J2EE.ejb.ServiceBean_bjedmi_EOImpl.invok
    e(
    Ser
    viceBean_bjedmi_EOImpl.java:37)
    at
    com.thc.ids.inf.framework.service.J2EE.ejb.ServiceBean_bjedmi_EOImpl_WLSke
    l.
    inv
    oke(Unknown Source)
    atweblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:298)
    at
    weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.ja
    va
    :93
    at
    weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:267
    at
    weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java
    :2
    2)
    at
    weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    <Mar 28, 2002 5:35:08 PM MST> <Info> <JDBC> <Checking existence ofconnection
    pool Content
    ConnectionPool requested by user guest>
    <Mar 28, 2002 5:35:08 PM MST> <Info> <JDBC> <Creating connection poolContentConnectionPoo
    l requested by user guest>
    weblogic.common.ResourceException:weblogic.management.MBeanCreationException:
    Start server side stack trace:
    javax.management.InstanceAlreadyExistsException:domain:Name=ContentConnectionPool,Type=JD
    BCConnectionPool
    at
    com.sun.management.jmx.RepositorySupport.addMBean(RepositorySupport.java:1
    34
    at
    com.sun.management.jmx.MBeanServerImpl.internal_addObject(MBeanServerImpl.
    ja
    va:
    2352)
    at
    com.sun.management.jmx.MBeanServerImpl.registerMBean(MBeanServerImpl.java:
    87
    4)
    at
    weblogic.management.internal.RemoteMBeanServerImpl.registerMBean(RemoteMBe
    an
    Ser
    verImpl.java:181)
    atweblogic.management.internal.Helper.createMBean(Helper.java:376)
    atweblogic.management.internal.Helper.createAdminMBean(Helper.java:291)
    at
    weblogic.management.internal.RemoteMBeanServerImpl.createAdminMBean(Remote
    MB
    ean
    ServerImpl.java:278)
    at
    weblogic.management.internal.MBeanHomeImpl.createAdminMBean(MBeanHomeImpl.
    ja
    va:
    635)
    at
    weblogic.management.internal.MBeanHomeImpl.createAdminMBean(MBeanHomeImpl.
    ja
    va:
    621)
    at
    weblogic.management.internal.AdminMBeanHomeImpl.createAdminMBean(AdminMBea
    nH
    ome
    Impl.java:397)
    atweblogic.management.internal.AdminMBeanHomeImpl_WLSkel.invoke(Unknown
    Source)
    atweblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:298)
    at
    weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:267
    at
    weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java
    :2
    2)
    at
    weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    --------------- nested within: ------------------
    weblogic.management.MBeanCreationException: - with nested exception:
    [javax.management.InstanceAlreadyExistsException:domain:Name=ContentConnectionPool,Type=J
    DBCConnectionPool]
    atweblogic.management.internal.Helper.createMBean(Helper.java:383)
    atweblogic.management.internal.Helper.createAdminMBean(Helper.java:291)
    at
    weblogic.management.internal.RemoteMBeanServerImpl.createAdminMBean(Remote
    MB
    ean
    ServerImpl.java:278)
    at
    weblogic.management.internal.MBeanHomeImpl.createAdminMBean(MBeanHomeImpl.
    ja
    va:
    635)
    at
    weblogic.management.internal.MBeanHomeImpl.createAdminMBean(MBeanHomeImpl.
    ja
    va:
    621)
    at
    weblogic.management.internal.AdminMBeanHomeImpl.createAdminMBean(AdminMBea
    nH
    ome
    Impl.java:397)
    atweblogic.management.internal.AdminMBeanHomeImpl_WLSkel.invoke(Unknown
    Source)
    atweblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:298)
    at
    weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:267
    at
    weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java
    :2
    2)
    at
    weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    End server side stack trace
    - with nested exception:
    [javax.management.InstanceAlreadyExistsException:domain:Name=ContentConnectionPool,Type=J
    DBCConnectionPool
    Start server side stack trace:
    javax.management.InstanceAlreadyExistsException:domain:Name=ContentConnectionPool,Type=JD
    BCConnectionPool
    at
    com.sun.management.jmx.RepositorySupport.addMBean(RepositorySupport.java:1
    34
    at
    com.sun.management.jmx.MBeanServerImpl.internal_addObject(MBeanServerImpl.
    ja
    va:
    2352)
    at
    com.sun.management.jmx.MBeanServerImpl.registerMBean(MBeanServerImpl.java:
    87
    4)
    at
    weblogic.management.internal.RemoteMBeanServerImpl.registerMBean(RemoteMBe
    an
    Ser
    verImpl.java:181)
    atweblogic.management.internal.Helper.createMBean(Helper.java:376)
    atweblogic.management.internal.Helper.createAdminMBean(Helper.java:291)
    at
    weblogic.management.internal.RemoteMBeanServerImpl.createAdminMBean(Remote
    MB
    ean
    ServerImpl.java:278)
    at
    weblogic.management.internal.MBeanHomeImpl.createAdminMBean(MBeanHomeImpl.
    ja
    va:
    635)
    at
    weblogic.management.internal.MBeanHomeImpl.createAdminMBean(MBeanHomeImpl.
    ja
    va:
    621)
    at
    weblogic.management.internal.AdminMBeanHomeImpl.createAdminMBean(AdminMBea
    nH
    ome
    Impl.java:397)
    atweblogic.management.internal.AdminMBeanHomeImpl_WLSkel.invoke(Unknown
    Source)
    atweblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:298)
    at
    weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:267
    at
    weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java
    :2
    2)
    at
    weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    End server side stack trace
    at
    weblogic.jdbc.common.internal.ConnectionPool.dynaStartup(ConnectionPool.ja
    va
    :47
    2)
    at
    weblogic.jdbc.common.internal.ConnectionPool.createPool(ConnectionPool.jav
    a:
    727
    at
    weblogic.jdbc.common.internal.ConnectionPool.createPool(ConnectionPool.jav
    a:
    709
    at
    com.thc.ids.inf.framework.opf.rdbms.datastore.ConnectionPoolCreator.create
    Co
    nne
    ctionPool(ConnectionPoolCreator.java:82)
    at
    com.thc.ids.inf.framework.opf.datastore.DataStoreRepository.createConnecti
    on
    Poo
    lIfNonExistent(DataStoreRepository.java:211)
    at
    com.thc.ids.inf.util.persistence.content.ConnectionPoolInitializer.createC
    on
    nec
    tionPoolIfNeeded(ConnectionPoolInitializer.java:48)
    at
    com.thc.ids.inf.services.business.crs.spi.oracle.OracleRetrievalProvider.c
    re
    ate
    ConnectionPoolIfNeeded(Unknown Source)
    at
    com.thc.ids.inf.services.business.crs.spi.oracle.OracleRetrievalProvider.g
    et
    Ima
    ge(Unknown Source)
    at
    com.thc.ids.inf.services.business.crs.ContentRetrievalService.getImage(Unk
    no
    wn
    Source)
    at java.lang.reflect.Method.invoke(Native Method)
    at
    com.thc.ids.inf.util.reflection.MethodDescription.invokeMethod(MethodDescr
    ip
    tio
    n.java:181)
    at
    com.thc.ids.inf.util.reflection.MethodInvocation.invoke(MethodInvocation.j
    av
    a:7
    9)
    at
    com.thc.ids.inf.framework.service.J2EE.ejb.ServiceBean.invoke(ServiceBean.
    ja
    va:
    186)
    at
    com.thc.ids.inf.framework.service.J2EE.ejb.ServiceBean_bjedmi_EOImpl.invok
    e(
    Ser
    viceBean_bjedmi_EOImpl.java:37)
    at
    com.thc.ids.inf.framework.service.J2EE.ejb.ServiceBean_bjedmi_EOImpl_WLSke
    l.
    inv
    oke(Unknown Source)
    atweblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:298)
    at
    weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.ja
    va
    :93
    at
    weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:267
    at
    weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java
    :2
    2)
    at
    weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)

  • Dynamic Internal Table creation and population

    Hi gurus !
    my issue refers to the slide 10 provided in this slideshow : https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b332e090-0201-0010-bdbd-b735e96fe0ae
    My example is gonna sound dumb, but anyway: I want to dynamically select from a table into a dynamically created itab.
    Letu2019s use only EKPO, and only field MENGE.
    For this, I use Classes cl_abap_elemdescr, cl_sql_result_set and the Data Ref for table creation. But while fetching the resultset, program dumps when fields like MENGE, WRBTR are accessed. Obviously their type are not correctly taken into account by my program.
    Here it comes:
    DATA: element_ref             TYPE REF TO cl_abap_elemdescr,
          vl_fieldname               TYPE string,
                 tl_components         TYPE abap_component_tab,
                 sl_components         LIKE LINE OF tl_components_alv,
    linetype_lcl               TYPE REF TO cl_abap_structdescr,
    ty_table_type            TYPE REF TO cl_abap_tabledescr,
    g_resultset             TYPE REF TO cl_sql_result_set
    u2026
    CONCATENATE sg_columns-table_name '-' sg_columns-column_name INTO vl_fieldname.
    * sg_columns-table_name contains 'EKPO'
    * sg_columns-column_name contains 'MENGE'
    * getting the element as a component
    element_ref ?= cl_abap_elemdescr=>describe_by_name( vl_fieldname ).
    sl_components-name  = sg_columns-column_name.
    sl_components-type ?= element_ref.
    APPEND sl_components TO tl_components.
    * dynamic creation of internal table
    linetype_lcl = cl_abap_structdescr=>create( tl_components ).
    ty_table_type = cl_abap_tabledescr=>create(
                      p_line_type = linetype_lcl ).
    u2026
    * Then I will create my field symbol table and line. Code has been cut here.
    CREATE DATA dy_line LIKE LINE OF <dyn_table>.
    u2026
    * Then I will execute my query. Here itu2019s: Select MENGE From EKPO Where Rownum = 1.
      g_resultset = g_stmt_ref->execute_query( stmt_str ).
    * Then structure for the Resultset is set
      CALL METHOD g_resultset->set_param_struct
        EXPORTING
          struct_ref = dy_line.
    * Fetching the lines of the resultset  => Dumpu2026
      WHILE g_resultset->next( ) > 0.
        ASSIGN dy_line->* TO <dyn_wa>.
        APPEND <dyn_wa> TO <dyn_table>.
      ENDWHILE.
    Anyone has any clue to how prevent my Dump ??
    The component for MENGE seems to be described as a P7 with 2 decimals. And the resultset wanna use a QUAN type... or something like that !

    Hello
    I have expanded your sample coding for selecting three fields out of EKPO:
    *& Report  ZUS_SDN_SQL_RESULT_SET
    *& Thread: Dynamic Internal Table creation and population
    *& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1375510"></a>
    *& NOTE: Coding for dynamic structure / itab creation taken from:
    *& Creating Flat and Complex Internal Tables Dynamically using RTTI
    *& https://wiki.sdn.sap.com/wiki/display/Snippets/Creating+Flat+and+
    *& Complex+Internal+Tables+Dynamically+using+RTTI
    REPORT  zus_sdn_sql_result_set.
    TYPE-POOLS: abap.
    DATA:
    go_sql_stmt       TYPE REF TO cl_sql_statement,
    go_resultset      TYPE REF TO cl_sql_result_set,
    gd_sql_clause     TYPE string.
    DATA:
      gd_tabfield      TYPE string,
      go_table         TYPE REF TO cl_salv_table,
      go_sdescr_new    TYPE REF TO cl_abap_structdescr,
      go_tdescr        TYPE REF TO cl_abap_tabledescr,
      gdo_handle       TYPE REF TO data,
      gdo_record       TYPE REF TO data,
      gs_comp          TYPE abap_componentdescr,
      gt_components    TYPE abap_component_tab.
    FIELD-SYMBOLS:
      <gs_record>   TYPE ANY,
      <gt_itab>     TYPE STANDARD TABLE.
    START-OF-SELECTION.
    continued.

  • Flex/AS3 Best way to construct a derived class instance from an existing base class instance?

    What is the best way to handle the instantiation of a derived class from an existing base class.
    I have a base class which is being created via remote_object [RemoteClass alias] from the server.   I have other specialized classes that are derived from this baseclass, but serialization with the server always happens with the base class.     The base class has meta data that defines what the derived class is, for example
    [RemoteClass (alias="com.myco...')]
    public Class Base
         public var derivedType:String;
         public function Base()
    public Class Derived extends Base
         public "some other data"
         public function Derived()
    In my Cairgorm command which retrieves this object from ther server I want to do this:
    public function result (event: Object):void
        var baseInstance:Base = event.result;
         if (baseInstance.derivedType = "derived")
              var derivedInstance:Derived = new Derived( baseInstance );
    What is the most efficient way of doing this?   It appears to me that doing a deep-copy/clone and instantiation of the derived class is pretty inefficient as far as memory allocation and data movement via the copy.

    Thanks for the assistance.  Let me try to clarify.
    MY UI requires a number of composite classes.    The individual components of the composite classes are being transfered to/from the server at different times depending upone which component has changed state.    The construction of the composite classes from the base class happens in my clients business logic.
    Composition happens in a derived class; but server syncronization happens using the base class.    When I recieve the object from Blazeds through the remote object event, it is in the form of the base class.  I then need to instantiate the derived class and copy the elements of the base class into it (for later composite construction).   And likewise when sending the base class back to the server, I need to upcast the derived class to its base class.   But in this case just a mere upcast does not work.  I actually need to create a new base class and copy the attrbutes into it.  I believe this is limitation of how remoting works on Flex/AS3.
    My question is, what is the best way to turn my base class into it's derived class so further composite construction can take place.   The way I am currently doing it is to create a  load method on the base class, that takes the base class as on argument.  The load function, copies all of the instance attribute references from the base class to the target class.
    public Class Base
         public function Base()
         public function load(fromClass:Base)
        {  //  copy the references for all of the instance attributes from the fromClass to this class }
    Then,  after I recieve the base class from the server.   I create a new derived class and pass the base class into the load function like this:
                for (var i:int=0; i < event.result.length; i++) {
                    var derived:Derived = new Derived();
                    derived.load(event.result[i]);
    The drawbacks of this approach is that it now requires 2 extra instance creations per object serialization.   One on recieving the object from the server and one sending it to the server.    I assume copying references are pretty efficient.  But, there is probably some GC issues.     The worst of it is in code maintenance.   The load function now has to be manually maintained and kept in sync with the server class.
    It would be interesting to hear how others have solved this problem.      The server side is an existing application with around 2M LOC, so changing the code on the server is a non-starter.
    Thanks for your help.

  • Strange error in explicit instance creation

    Dear all,
    using NW2004s I have a strange error while explicit instance creation:
    Let´s say I have a class a in the Class Builder calles c1. With method "check_data".
    In my program I do the following:
    DATA: ref_chk TYPE REF TO object.
    create object ref_chk type ('C1').
    c1->check_data( );
    If I do so I get an syntax error: The method check_data is unknown, private or protected.
    But the method is public.
    I need the explicite instance creation beacuse the class changes and I want to set it with a variable.
    Any idea what´s wrong? How can I solve the problem?
    Regards
    Roman

    Hi Roman,
    The best way to do this would be to use an Interface and then cast the class to an interface type once it has been created. However if this is not possible (i.e. the interface is not fixed for all the different classes you want to create) you can use the following code to call your class.
    DATA: ref_chk TYPE REF TO object.
    create object ref_chk type ('C1').
    call method ref_chk->('CHECK_DATA').
    Just a note the 'CHECK_DATA' in brackets can also be replaced with a variable as in the follwing example:
    DATA: ref_chk TYPE REF TO object.
    DATA: method_name type string.
    create object ref_chk type ('C1').
    method_name = 'CHECK_DATA'.
    call method ref_chk->(method_name).
    Cheers,
      De Wildt

  • Dynamic class loading problem using unknown JAR archive and directory names

    I read the following article, which enlightened me a lot:
    Ted Neward: Understanding Class.forName().
    However, it took me some while to understand that my problem is the other way around:
    I know the name of the class, I know the name of the method,
    but my program/JVM does not know where to load the classes from.
    Shortly, my problem is that the server engine that I am writing
    uses two different versions of the same library.
    So I am trying out the following solution:
    My program is named TestClassPathMain.java
    Assume the two libraries are named JAR1.jar and JAR2.jar
    and the class/instance method that should
    be exposed to TestClassPathMain.java by them is named
    TestClass1.testMethod().
    As long as I was depending on just one library,
    I put JAR1.jar in the classpath before starting java,
    and I was happy for a while.
    At the moment I got the need to use another version of
    TestClass1.testMethod() packaged in JAR2.jar,
    a call would always access JAR1.jar's
    TestClass1.testMethod().
    I then decided to remove JAR1.jar from the classpath,
    and programmatically define two separate ClassLoaders, one for use
    with JAR1.jar and the other for use with JAR2.jar.
    However, the problem is only partly solved.
    Please refer to the enclosed code for details.
    (The code in the JAR1.jar/JAR2.jar is extremely simple,
    it just tells (by hardcoding) the name of the jar it is packaged in
    and instantiates another class packaged in the same jar using
    the "new" operator and calls a method on it. I don't enclose it.)
    The TestClassPathMain.java/UC1.java/UC2.java code suite was
    successfully compiled with an arbitrary of JAR1 or JAR2 in the classpath,
    however removed from the classpath at runtime.
    (I know that this could have been done (more elegantly...?) by producing an Interface,
    but I think the main problem principle is still untouched by this potential lack of elegancy(?))
    1) This problem should not be unknown to you experts out there,
    how is it generally and/or most elegantly solved?
    The "*** UC2: Variant 2" is the solution I would like best, had it only worked.
    2) And why arent "*** UC2: Variant 2" and
    "*** static UC2: Variant 2" working,
    while "*** Main: Variant 2" is?
    3) And a mal-apropos:
    Why can't I catch the NoClassDefFoundError?
    The output:
    *** Main: Variant 1 JAR 1 ***:
    Entering TestClass1.testMethod() packaged in JAR1.jar
    About to instantiate TestClass2 with the new operator
    About to call TestClass2.testMethod()
    Entering TestClass2.testMethod() packaged in JAR1.jar
    *** Main: Variant 1 JAR 2 ***:
    Entering TestClass1.testMethod() packaged in JAR2.jar
    About to instantiate TestClass2 with the new operator
    About to call TestClass2.testMethod()
    Entering TestClass2.testMethod() packaged in JAR2.jar
    *** Main: Variant 2 JAR 1 ***:
    Entering TestClass1.testMethod() packaged in JAR1.jar
    About to instantiate TestClass2 with the new operator
    About to call TestClass2.testMethod()
    Entering TestClass2.testMethod() packaged in JAR1.jar
    *** Main: Variant 2 JAR 2 ***:
    Entering TestClass1.testMethod() packaged in JAR2.jar
    About to instantiate TestClass2 with the new operator
    About to call TestClass2.testMethod()
    Entering TestClass2.testMethod() packaged in JAR2.jar
    *** UC1: Variant 1 JAR 1 ***:
    Entering TestClass1.testMethod() packaged in JAR1.jar
    About to instantiate TestClass2 with the new operator
    About to call TestClass2.testMethod()
    Entering TestClass2.testMethod() packaged in JAR1.jar
    *** UC1: Variant 1 JAR 2 ***:
    Entering TestClass1.testMethod() packaged in JAR2.jar
    About to instantiate TestClass2 with the new operator
    About to call TestClass2.testMethod()
    Entering TestClass2.testMethod() packaged in JAR2.jar
    *** static UC2: Variant 2 JAR 1 ***:
    Exception in thread "main" java.lang.NoClassDefFoundError: TestClass1
            at UC2.runFromJarVariant2_static(UC2.java:56)
            at TestClassPathMain.main(TestClassPathMain.java:52)
    TestClassPathMain.java
    import java.lang.reflect.InvocationTargetException;
    import java.lang.reflect.Method;
    import java.net.MalformedURLException;
    import java.net.URL;
    import java.net.URLClassLoader;
    public class TestClassPathMain {
        public static void main(final String args[]) throws MalformedURLException, ClassNotFoundException, InstantiationException, SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {
                // Commented out because I cannot catch the NoClassDefFoundError.
                // Why?
                try {
                    final TestClass1 testClass1 = new TestClass1();
                    System.out.println(
                        "\nThe class TestClass1 is of some unexplicable reason available." +
                        "\nFor the purpose of the test, it shouldn't have been!" +
                        "\nExiting");
                    System.exit(1);
                } catch (NoClassDefFoundError e) {
                    System.out.println("\nPositively confirmed that the class TestClass1 is not available:\n" + e);
                    System.out.println("\n\nREADY FOR THE TEST: ...");
                // Works fine
                System.out.println("\n*** Main: Variant 1 JAR 1 ***:");
                runFromJarVariant1("file:/W:/java/eclipse/workspaces/simped_test/CP1/JAR1.jar");
                System.out.println("\n*** Main: Variant 1 JAR 2 ***:");
                runFromJarVariant1("file:/W:/java/eclipse/workspaces/simped_test/CP2/JAR2.jar");
                // Works fine
                System.out.println("\n*** Main: Variant 2 JAR 1 ***:");
                runFromJarVariant1("file:/W:/java/eclipse/workspaces/simped_test/CP1/JAR1.jar");
                System.out.println("\n*** Main: Variant 2 JAR 2 ***:");
                runFromJarVariant1("file:/W:/java/eclipse/workspaces/simped_test/CP2/JAR2.jar");
                // Works fine
                final UC1 uc1 = new UC1();
                System.out.println("\n*** UC1: Variant 1 JAR 1 ***:");
                uc1.runFromJarVariant1("file:/W:/java/eclipse/workspaces/simped_test/CP1/JAR1.jar");
                System.out.println("\n*** UC1: Variant 1 JAR 2 ***:");
                uc1.runFromJarVariant1("file:/W:/java/eclipse/workspaces/simped_test/CP2/JAR2.jar");
                // Crashes
                System.out.println("\n*** static UC2: Variant 2 JAR 1 ***:");
                UC2.runFromJarVariant2_static("file:/W:/java/eclipse/workspaces/simped_test/CP1/JAR1.jar");
                System.out.println("\n*** static UC2: Variant 2 JAR 2 ***:");
                UC2.runFromJarVariant2_static("file:/W:/java/eclipse/workspaces/simped_test/CP2/JAR2.jar");
                // Crashes
                final UC2 uc2 = new UC2();
                System.out.println("\n*** UC2: Variant 2 JAR 1 ***:");
                uc2.runFromJarVariant2("file:/W:/java/eclipse/workspaces/simped_test/CP1/JAR1.jar");
                System.out.println("\n*** UC2: Variant 2 JAR 2 ***:");
                uc2.runFromJarVariant2("file:/W:/java/eclipse/workspaces/simped_test/CP2/JAR2.jar");
        private static void runFromJarVariant1(final String jarFileURL)
            throws MalformedURLException,
                   ClassNotFoundException,
                   InstantiationException,
                   IllegalArgumentException,
                   IllegalAccessException,
                   InvocationTargetException,
                   SecurityException,
                   NoSuchMethodException {
            final URL url = new URL(jarFileURL);
            final URLClassLoader cl =
                new URLClassLoader(new URL[]{url},
                                   Thread.currentThread().getContextClassLoader());
            final Class clazz = cl.loadClass("TestClass1");
            final Object testClass1 = clazz.newInstance();
            final Method testMethod1 = clazz.getMethod("testMethod", null);
            testMethod1.invoke(testClass1, null);
        private static void runFromJarVariant2(final String jarFileURL)
            throws MalformedURLException,
                   ClassNotFoundException,
                   InstantiationException,
                   IllegalArgumentException,
                   IllegalAccessException,
                   InvocationTargetException,
                   SecurityException,
                   NoSuchMethodException {
            final URL url = new URL(jarFileURL);
            final URLClassLoader cl =
                new URLClassLoader(new URL[]{url},
                                   Thread.currentThread().getContextClassLoader());
            final Class clazz = cl.loadClass("TestClass1");
            final TestClass1 testClass1 = new TestClass1();
            testClass1.testMethod();
    UC1.java
    import java.lang.reflect.InvocationTargetException;
    import java.lang.reflect.Method;
    import java.net.MalformedURLException;
    import java.net.URL;
    import java.net.URLClassLoader;
    public class UC1 {
        public void runFromJarVariant1(final String jarFileURL)
            throws MalformedURLException,
                   ClassNotFoundException,
                   InstantiationException,
                   IllegalArgumentException,
                   IllegalAccessException,
                   InvocationTargetException,
                   SecurityException,
                   NoSuchMethodException {
            final URL url = new URL(jarFileURL);
            final URLClassLoader cl =
                new URLClassLoader(new URL[]{url},
                                   Thread.currentThread().getContextClassLoader());
            final Class clazz = cl.loadClass("TestClass1");
            final Object testClass1 = clazz.newInstance();
            final Method testMethod1 = clazz.getMethod("testMethod", null);
            testMethod1.invoke(testClass1, null);
    UC2.java
    import java.lang.reflect.InvocationTargetException;
    import java.net.MalformedURLException;
    import java.net.URL;
    import java.net.URLClassLoader;
    public class UC2 {
        public void runFromJarVariant2(final String jarFileURL)
        throws MalformedURLException,
               ClassNotFoundException,
               InstantiationException,
               IllegalArgumentException,
               IllegalAccessException,
               InvocationTargetException,
               SecurityException,
               NoSuchMethodException {
            final URL url = new URL(jarFileURL);
            final URLClassLoader cl =
                new URLClassLoader(new URL[]{url},
                                   Thread.currentThread().getContextClassLoader());
            final Class clazz = cl.loadClass("TestClass1");
            final TestClass1 testClass1 = new TestClass1();
            testClass1.testMethod();
         * Identic to the "runFromJarVariant2" method,
         * except that it is static
        public static void runFromJarVariant2_static(final String jarFileURL)
        throws MalformedURLException,
               ClassNotFoundException,
               InstantiationException,
               IllegalArgumentException,
               IllegalAccessException,
               InvocationTargetException,
               SecurityException,
               NoSuchMethodException {
            final URL url = new URL(jarFileURL);
            final URLClassLoader cl =
                new URLClassLoader(new URL[]{url},
                                   Thread.currentThread().getContextClassLoader());
            final Class clazz = cl.loadClass("TestClass1");
            final TestClass1 testClass1 = new TestClass1();
            testClass1.testMethod();
    }

    2. i need to load the class to the same JVM (i.e. to
    the same environment) of the current running
    aplication, so that when the loaded class is run, it
    would be able to invoke methods on it!!!
    ClassLoader(s) do this. Try the URLClassLoader.
    (I was talking about relatively esoteric "security"
    issues when I mentioned the stuff about Class objects
    "scope".) You might use the URLClassLoader kind of
    like this.
    Pseudo-code follows:
    // setup the class loader
    URL[] urls = new URL[1];
    urls[0] = new URL("/path/to/dynamic/classes");
    URLClassLoader ucl = new URLClassLoader(urls);
    // load a class & use make an object with the default constructor
    Object tmp = ucl.loadClass("dynamic.class.name").newInstance();
    // Cast the object to a know interface so that you can use it.
    // This may be used to further determine which interface to cast
    // the class to. Or it may simply be the interface to which all
    // dynamic classes have to conform in your program.
    InterfaceImplementedByDynamicClass loadedObj =
        (InterfaceImplementedByDynamicClass)tmp;It's really not as hard as it sounds, just write a little test of
    this and you will see how it works.

  • Dynamic class loading in J2ME

    Hi all,
    Couple of questions. Is dynamic class loading using classloaders supported in any, if not all versions of J2ME? I guess I should ask first, what exactly does J2ME cover? I see KVM, but do watches and PDA's, set top boxes, refrigerators and so forth all run the same J2ME JVM? Or are their "less feature full" versions? I was hoping the J2ME spec would be the "lowest common denominator" to program for, but I thought I read somewhere that small devices like watches may even have a "smaller" J2ME JVM or something, less capable. So can I write code for J2ME and it will run on all small devices like cell phones, pda's, and so forth? Or is there another J2ME version, perhaps small than J2ME.
    So, from what I have found so far, it appears dynamic class loading is done at startup from a DB (of sorts) as opposed to being able to dynamically find/load classes. If this is so, is there any way to support downloading and reloading new classes like you can with J2SE, such as the hot-swap feature of web servers? Does Class.forName() at least work in that you can "replace" a class with a new version, even if it is not able to have a separate classloader instance? My guess is that J2ME supports only a single classloader space, but I thought I read somewhere that Class.forName() is available. J2ME API shows it I believe, but I could be wrong.
    Any help on this topic would be appreciated.
    Thanks.

    Dynamic class loading is not available in most (if not all) J2ME profiles and configurations. Class.forName() is available (at least in the MID profile), but not to be used for dynamic class loading. It can be used when using device-specific APIs where you can try to load a class containing device specific methods (for example a class that works only on certain Nokia phones, and has methods playSound() and vibrate(), which are not available in MIDP), and if you catch a ClassNotFound exception you can load a class that doesn't use the device specific APIs and contains stubs of the methods, or you can disable certain features in you application that need those features. For an example implementation you can have a look at Nokia's Block Game example (available from their developer site - http://www.forum.nokia.com/main.html).
    As for your other more general questions about different JVM's and such, you should read all about the different configurations and profiles available in J2ME (plenty of information using in the J2ME link on this site).

  • Dynamic Class Loading and Stubs

    How Dynamic Class Loading is used on Java RMI, since stubs are generated on clients using Reflection API?
    I was reading Dynamic code downloading using JavaTM RMI (http://java.sun.com/javase/6/docs/technotes/guides/rmi/codebase.html), it seems to be out of date.
    For example, "The client requests the class definition from the codebase. The codebase the client uses is the URL that was annotated to the stub instance when the stub class was loaded by the registry. Back in step 1, the annotated stub for the exported object was then registered with the Java RMI registry bound to a name."

    "Enhancements in J2SETM 5.0
    Dynamic Generation of Stub Classes
    This release adds support for the dynamic generation of stub classes at runtime, obviating the need to use the Java(tm) Remote Method Invocation (Java RMI) stub compiler, rmic, to pregenerate stub classes for remote objects. *Note that rmic must still be used to pregenerate stub classes for remote objects that need to support clients running on _earlier versions_.*
    When an application exports a remote object (using the constructors or static exportObject methods(1) of the classes java.rmi.server.UnicastRemoteObject or java.rmi.activation.Activatable) and a pregenerated stub class for the remote object's class cannot be loaded, the remote object's stub will be a java.lang.reflect.Proxy instance (whose class is dynamically generated) with a java.rmi.server.RemoteObjectInvocationHandler as its invocation handler.
    An existing application can be deployed to use dynamically generated stub classes unconditionally (that is, whether or not pregenerated stub classes exist) by setting the system property java.rmi.server.ignoreStubClasses to "true". If this property is set to "true", pregenerated stub classes are never used.
    Notes:
    * If a remote object has pre-5.0 clients, that remote object should use a stub class pregenerated with rmic or the client will get an ClassNotFoundException deserializing the remote object's stub. Pre-5.0 clients will not be able to load an instance of a dynamically generated stub class, because such a class contains an instance of RemoteObjectInvocationHandler, which was not available prior to this release.
    * Prior to the J2SE 5.0 release, exporting a remote object would throw a java.rmi.StubNotFoundException if the pregenerated stub class for the remote object's class could not be loaded. With the added support for dynamically generated stub classes, exporting a remote object that has no pregenerated stub class will silently succeed instead. A user deploying a server application to support pre-5.0 clients must still make sure to pregenerate stub classes for the server's remote object classes, even though missing stub classes are no longer reported at export time. Such errors will instead be reported to a pre-5.0 client when it deserializes a dynamically generated stub class.
    (1) The static method UnicastRemoteObject.exportObject(Remote) is declared to return java.rmi.server.RemoteStub and therefore cannot be used to export a remote object to use a dynamically generated stub class for its stub. An instance of a dynamically generated stub class is a java.lang.reflect.Proxy instance which is not assignable to RemoteStub."
    http://java.sun.com/j2se/1.5.0/docs/guide/rmi/relnotes.html

  • Dynamic Class

    With Dynamic Classes you can add properties at run time. But
    the same can be done with Non Dynamic classes using their prototype
    property. For e.g. I've a Person Class for which the code is as
    follows:
    class Person {
    private var id:Number;
    function Person() {
    id = 007;
    Now is used this class in a fla file and make two instances
    var xx:Person=new Person()
    var yy:Person=new Person()
    trace(xx.__name) //undefined
    trace(yy.__name) //undefined
    Person.prototype.__name="myPersonClass"
    trace(xx.__name) //myPersonClass
    trace(yy.__name) //myPersonClass
    If this is true then whats the difference between dynamic and
    Non Dynamic classes coz using the prototype property we can convert
    every class into dynamic class.

    with a dynamic class you could assign distinct __name
    properties to each instance.
    what you did was to extend the Person class so it has a new
    property. if the Person class were final you would not be able to
    do that. otherwise, you can.

  • Dynamic class loading with Webstart

    Hello !
    //within the jar-file at the webstart-directory
    public interface MyFrame{
    public void createFrame();
    //within the jar-file dynamically downloaded
    public class MyExtFrame extends JFrame implements MyFrame{
    String className = "MyExtFrame";
    ClassLoader cl = ClassLoader.getSystemClassLoader();
    JarClassLoader jarLoader = new JarClassLoader (cl, jarFile));
    /* Load the class from the jar file and resolve it. */
    Class c = jarLoader.loadClass (className, true);
    /* Create an instance of the class.
    Object o = c.newInstance();
    /* Are we using a class we specifically know about? */
    if (o instanceof MyFrame){
    // Yep, lets call a method we know about. */
    MyFrame client=(MyFrame) o;
    //call a class-method (here creates the whole gui-object at once)
    client.createFrame();
    This is the code i'm using and i've encountered following problem, if i put this code into an application without webstart, anything works fine, but with webstart i'll get a: java.lang.NoClassDefFoundError
    Then i've put the MyFrame-classes into the downloaded jar-file, but this won't work either, i'll get a ClassCastException.
    What do i have to do, to become it working ?
    Thanks for any conclusions and help.
    Michael

    Finally i've found out myself, i've read some postings in this forum and put them all together, so that my webstart-application finally works the way i want...
    That was the topic:
    Downloading a jar-file and starting a class from this jar-file within a webstart application (dynamic class loading).
    I'll post my final solution for this problem, may be it would be useful in future for anyone else.
    //grant all permissions on the clientside
    Policy.setPolicy( new Policy() {
    public PermissionCollection getPermissions(CodeSource codesource) {
    Permissions perms = new Permissions();
    perms.add(new AllPermission());
    return(perms);
    public void refresh(){
    //get the current classloader
    ClassLoader cl = MyLoadedClass.class.getClassLoader();
    //create a new url-classloader while using the current classloader
    URL[] urls = new URL[1];
    File f = new File(new String(jarName));
    urls[0] = f.toURL();
    URLClassLoader ul = new URLClassLoader(urls, cl);
    //load a class from jarfile
    Class c = ul.loadClass(new String(className));
    //get an object from loaded class
    Object o = c.newInstance();
    /* Are we using a class we specifically know about? */
    if (o instanceof KnownInterface){
    // Yep, lets call a method we know about. */
    KnownInterface client = (KnownInterface) o;
    client.doAnything();

  • Dynamic class loading from String name

    Hello all,
    I have a question for dynamic class loading:
    If I have a String variable that represents a class name, how can i use it to make dynamically an object of the class tha the string variable represents?
    For example i have a string like this
    String classname="String";
    Using this i want to make a new String object .
    Can anyone tell me how can i do this(example plz)?

    I have worked out the code and this works fine:
    import java.lang.*;
    class dynamictestname{
         public dynamictestname() {
        public static Class test(String objname){
             try{
             Class theClass = Class.forName(objname);
                 return theClass;
            } catch (ClassNotFoundException e)
                throw new NoClassDefFoundError (e.getMessage());
         public static void main (String [] args){
              String classname="java.lang.String";
              Class thisClass=dynamictestname.test(classname);
              try{
              Object instance = thisClass.newInstance();
              }catch(InstantiationException e){
              }catch(IllegalAccessException ie){
    }The new problem i 've faced is that i can't instatiate a new object by the class i have created.I saw some examples with use of the java.lang.reflect but this class i used with user created classes which have methods that the user wants to run dynamically.
    I just want to make an object from the class and give it a value.
    For example if the object i have created with the
    Object instance = thisClass.newInstance();is an object of java.lang.String class
    how can i do something like this below dynamically from instance object :
    String x="TEST ";
    Thanks for the help..

  • Is it possible to remove properties from a dynamic class?

    I have a dynamic ActionScript Class that is used to send
    parameters to a WebService. Some of these parameters are always
    present, so they are public properties of the Class:
    package
    [Bindable]
    public dynamic class WebServiceCriteria
    public var property1:int;
    public var property2:String;
    public var property3:String;
    public var property4:String;
    But, I am also adding properties at runtime that can change
    over time:
    criteria.runTimeProperty = "1";
    I'm not very familiar with using dynamic classes, so I was
    wondering if it is possible to "remove" the new property. Let's say
    the next time I call the WebService I don't want that property sent
    - not even as a null. How can I remove it from the Class instance
    without creating a new instance each time?

    Hi,
    Please try delete criteria.runTimeProperty. Please find more
    details on the delete operator at the URL below.
    http://livedocs.adobe.com/flex/3/langref/operators.html#delete
    Hope this helps.

  • Help with loading dynamic classes ..need help please

    i'm trying to design a program where by i can load dynamic classes
    the problem i'm getting is that only one class is loading.
    classes are loaded by their names,and index numbers of public methods from a linklist
    .When the program runs only the first class is ever loaded and only the methods of that class ..
    help please
    //class loader
    import java.lang.reflect.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.table.*;
    public class Test2 extends Thread
         public Class c;
         public Class Ray;
         public Class[] x;
         public static Object object = null;
         public Method[] theMethods;
         public static Method[] method,usemethod;
         public int methodcount;
         public static int MethodCt;     
         public static JList list;
    public Method[] startClass(String SetMethodName)
         try
              c = Class.forName(SetMethodName);
              object = c.newInstance();
              theMethods = c.getDeclaredMethods();
              // number of methods
              //methodcount = theMethods.length;
         catch (Exception e)
              e.printStackTrace();
    // return the array then invoke the particular method later
    return theMethods ;
    public void RunMethod(Method[] SomeMethod, int methodcount)
         try
              SomeMethod[methodcount].invoke( object,null );
         catch (Exception e)
              e.printStackTrace();
    // end class loader
    //main calling program
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing .*;
    import java.lang.reflect.*;
    public class JFMenu extends JFrame
         public static JMenu pluginMenu;
         public static JMenuBar bar;
         public static final Test2 w = new Test2();
    public static Method[] setmethod;
    private static ClassLinkList startRef = null;
    private static ClassLinkList linkRef3 = null;
    private static ClassLinkList startRef2 = null;
    private String ClassName,ShortCut;
    private int MethodNumber;
    private JMenuItem PluginItem;
         JFMenu()
              super (" JFluro ");     
              JMenu fileMenu = new JMenu("File");
              fileMenu.setMnemonic('F');
              JMenuItem exitItem = new JMenuItem("Exit");
              exitItem.setMnemonic('X');
              fileMenu.add(exitItem);
              exitItem.addActionListener
                   new ActionListener()
                        public void actionPerformed(ActionEvent event )
                             System.exit(0);
              JMenu pluginMenu = new JMenu("Plugins");
              pluginMenu.setMnemonic('P');
              startRef = new ClassLinkList ("Hello","Hello ",2,1926,"Painter");
              addToList("Foo","Foo ",0,1930,"Author");
              while (startRef.linkRef5 != null)
                   //pluginMenu.addSeparator();
                   ClassName = startRef.linkRef5.className;
                   ShortCut = startRef.linkRef5.shortcutName;
    MethodNumber = startRef.linkRef5.methodNumber;
    AddMenuItem(pluginMenu,ShortCut,ClassName,MethodNumber);
                   startRef.linkRef5 = startRef.linkRef5.next;
              // create menu bar and add JFMenu window to it
              JMenuBar bar = new JMenuBar();
              setJMenuBar(bar);
              bar.add(fileMenu);
              bar.add(pluginMenu);
              //attributes for JFMenu frame
              setSize(500,200);
              setVisible(true);
         }// end JFMenu constructor
         public void AddMenuItem(JMenu MainMenu, String shortcut,String className, final int methodCount )
              if (MainMenu==null)
                   return;
              //JMenuItem item;
              JMenuItem item = new JMenuItem(shortcut);
              MainMenu.add(item);
              setmethod = w.startClass(className);
              item.addActionListener
                   new ActionListener()
                        public void actionPerformed(ActionEvent event )
                             w.RunMethod(setmethod,methodCount);
              //item.addActionListener(ij);
         public JMenuItem AddMenuItem2(JMenu MainMenu, String shortcut)
              //if (MainMenu==null)
              //     return Main;
              //JMenuItem item;
              JMenuItem item = new JMenuItem(shortcut);
              MainMenu.add(item);
              //setmethod = w.startClass(className);
              //item.addActionListener(this);
                   new ActionListener()
                        public void actionPerformed(ActionEvent event )
                             w.RunMethod(setmethod,methodCount);
              //item.addActionListener(ij);
         return item;
         public void ReloadMenu(JMenuBar Bar, JMenu PluginMenu)
              if (Bar==null)
                   return;
              //     setJMenuBar(Bar);
              Bar.add(PluginMenu);
              //item.addActionListener(ij);
    public static void main (String args[])
              JFMenu menapp = new JFMenu();
    public static void addToList(String clname, String shcutname, int metnumber, int year2,
                                  String description) {
         // Create instance of class ClassLinkList
    ClassLinkList newRef = new ClassLinkList(clname,shcutname,metnumber,year2,
                                       description);
    // Add to linked list;
         startRef = startRef.addRecordToLinkedList(newRef);
    // end main calling program
    class Hello extends Thread
    public int getNum()
    System.out.println("I can be ");
    return 5;
    public void rayshowName()
    System.out.println("anything i want ");
    public void rayshowName3()
    System.out.println("to be ");
    class Foo extends Thread
    public int getNum()
    System.out.println("IMHOFF");
    return 5;
    public void rayshowName()
    System.out.println("raYMOND");
    // FAMOUS PERSONS LINKED LIST EXAMPLE
    // Frans Coenen
    // Saturday 15 January 2000
    // Depaertment of Computer Science, University of Liverpool
    class ClassLinkList {
    /* FIELDS */
    public String className;
    public String shortcutName;
    public int methodNumber;
    public int yearOfDeath;
    public String occupation;
    public ClassLinkList next = null;
    public ClassLinkList linkRef5 = this;
    public ClassLinkList startRef = null;
    /* CONSTRUCTORS */
    /* FamousPerson constructor */
    public ClassLinkList(String classname, String shortcutname, int methodnumber, int year2,
                                  String description) {
         className = classname;
         shortcutName = shortcutname;
         methodNumber = methodnumber;
         yearOfDeath = year2;
         occupation = description;
         next = null;
    /* METHODS */
    /* Output famous person linked list */
    public void outputClassLinkedList()
         //public ClassLinkList outputClassLinkedList() {
         ClassLinkList linkRef = this;
         // Loop through linked list till end outputting each record in turn
    while (linkRef != null)
         //System.out.println(linkRef5);
         System.out.println(linkRef.className + ", " + linkRef.shortcutName +
                   " (" + linkRef.methodNumber + "-" + linkRef.methodNumber +
                   "): " + linkRef.occupation);
         linkRef = linkRef.next;     
    //return linkRef;
    //public String ShowCasname()
    //return String ;     
    /* Add a new record to the linked list */
    public ClassLinkList addRecordToLinkedList(ClassLinkList newRef) {
         ClassLinkList tempRef, linkRef;
         // Test if new person is to be added to start of list if so return
    if (newRef.testRecord(this) ) {
         newRef.next = this;
         return(newRef);
         // Loop through remainder of linked list
         tempRef = this;
         linkRef = this.next;
         while (linkRef != null) {
         if (newRef.testRecord(linkRef)) {
         tempRef.next = newRef;
              newRef.next = linkRef;
              return(this);
         tempRef = linkRef;
         linkRef = linkRef.next;
    // Add to end
    tempRef.next = newRef;
         return(this);
    /* Delete a record from the linked list given the first and last name. Four
    posibilities:
    1) Record to be deleted is at front of list
    2) Record to be deleted is at end of list
    3) Record to be deleted is in middle of list
    4) Record not found. */
    public ClassLinkList deleteRecord(String lName, String fName) {
    ClassLinkList tempRef, linkRef;
    // Record at start of list
    if ((this.className == lName) & (this.shortcutName == fName))
         return(this.next);
         // Loop through linked list to discover if record is in middle of list.
         tempRef = this;
    linkRef = this.next;
    while (linkRef != null) {
         if ((linkRef.className == lName) & (linkRef.shortcutName == fName)) {
    tempRef.next = linkRef.next;
    return(this);
    tempRef = linkRef;
    linkRef = linkRef.next;
    // Record at end of list, or not found
    if ((linkRef.className == lName) & (linkRef.shortcutName == fName))
                        linkRef = null;
         else System.out.println("Record: " + lName + " " + fName + " not found!");
         return(this);
    /* TEST METHODS */
    /* Test whether new record comes before existing record or not. If so return
    true, false otherwise. */
    private boolean testRecord(ClassLinkList existingRef) {
         int testResult = className.compareTo(existingRef.className);
         if (testResult < 0) return(true);
         else {
         if ((testResult == 0) & (shortcutName.compareTo(existingRef.shortcutName) < 0 ))
                             return(true);
         // Return false
         return(false);
         public void addToList(String clname, String shcutname, int metnumber, int year2,
                                  String description)
         // Create instance of class Famous Person
    ClassLinkList newRef = new ClassLinkList(clname,shcutname,metnumber,year2,
                                       description);
    // Add to linked list;
         startRef = startRef.addRecordToLinkedList(newRef);

    I have a similar problem. I am writing a program to read the class names from database and instantiate several classes which extends from ServiceThread (an abstract class extending from Thread).
    rs = pStmt.executeQuery();
    while(rs.next()) {
    String threadclassname = rs.getString("classname").trim();
    try{
    ServiceThread threadinstance = (ServiceThread)Class.forName(threadclassname).newInstance();
    }catch ...
    So far, only the first class is ever instantiated and runs fine. But subsequent classes do not even get pass the "... ... Class.forName(...).newInstance();" line.
    Funny thing is that there are also no exceptions. The JVM just seem to hang there.

  • Bindable Dynamic Class

    Hi,
    I'm trying to write a class to load an XML config file and
    make the settings accessible as properties of the config class.
    Now using a dynamic class i can make the properties
    accessible, but i would also like to make them bindable.
    Does anyone know how to go about this?
    Many thanks
    Matt

    Try making the actual instance of the dynamic object
    bindable, then you can bind to its properties.

Maybe you are looking for

  • Nokia n86 camera photos preview problem

    hey, i have a problem with my nokia n86 when i go to Photos > Captured photos and i "travel" by the months that the pictures were taken, for some pictures, the preview image is completely different than the actual image! for example, i browse the pho

  • Videos/movies will not sync

    So I have about 6 or 7 videos in my Itunes, I know one for usre is :Itunes" compatible as I downloaded it in that format, however they will not sync to my 120gb Ipod. I've re-set my ipod, I've removed the vids and put them back in. but they will not

  • Assign partner determination procedure for campaign automation

    Dear all, could anyone help me how to set up Partner determination in CRM? I try to create campaign automation and when I want to release it I get this error message: Diagnosis Campaign 1: Parties involved have been assigned to this marketing project

  • Unsupported chassis type 52, system can not boot

    I'm trying to get a spare Sup. V engine module operational in a 4507E and get the above message when it try to boots. I am not aware if this spare had been used in production before. Not sure if I need to open a support ticket, so I thought I would s

  • MX300G2 with TC 7.2, H323 direct mode

    Hello is there a way to suppress the message "not registered" on main screen? We are using the  MX300G2 + Touch with some other devices (e.g. MX300G1, Tandberg Profile MXP and even devices from Polycom) but without any VCS, CUCUM or TMS or any other