Circle in DB due to JPA mappings

Hey,
As I understand from DBA and it also make sense it�s a bad practice to have DB circle, means that A has FK to B and B has FK to A.
In some case I have in Object A :
1. List of B (OneToMany)
2. Reference to class B (OneToOne)
In this case I will have circle in the DB because A has FK to B due to section 2 above and B has FK to A due to section 1 above.
I will be happy to hear your opinion about this issue.
Thank you

The problem the DBA highlights is the fact that you won't ever get anything in (INSERT) or out (DELETE) of the two tables because inserting a row in one table (before insertiing into the second table) would violate the constraint. However, you could get around this if the foreign key was nullable.
In the JPA case, this isn't a problem because foreign keys are not used for every entity direction of a relationship. Read up on mappedBy to specify the owning side of the relationship. This will give you insight as to when these foreign keys appear.

Similar Messages

  • JPA/Toplink changes the query logic

    Hi,
    Iam currently using JPA with Toplink implementation , i guess that toplink has its own way of optimizing the provided JPA query ; on another words , toplink sometimes changes the way you are using joins and exists statement to what looks optimized , but unfor. this caused me troubles tracking a query that should work on a certain way but its not cause the generated query by Toplink ( can be captured on the log ) does not represent the same logic , is this a known issue or do i have to write my JPA query on a way on which can be translated correctly by toplink , i know i should provide the query it self , but the model structure is too complex.
    Thanks in advance

    Hello,
    JPQL does not directly translate to SQL, so there might be some differences in what you may be expecting due to JPA requirements on the results that are returned. If there is a problem with specific queries, please let us know and file a bug if it is not behaving the way it should. A workaround would be to use a native SQL query directly.
    Best Regards,
    Chris

  • Error [TOPLINK-6007] while calling a web service deployed on external oc4j

    hello everybody,
    Actually, I'm working on a project using oracle soa suite.
    I developped a web service that works fine when I deploy it using the embeded oc4j but when I deploy it on an external oc4j, I get the followed error:
    Internal Server Error (Caught exception while handling request: Exception [TOPLINK-6007] (Oracle TopLink - 10g Release 3 (10.1.3.1.0) (Build 061004)): oracle.toplink.exceptions.QueryException Description de l'exception : Descripteur absent pour [class riad.commun.bean.rh.agents.Agents]. Interrogation : ReadObjectQuery(riad.commun.bean.rh.agents.Agents))
    Can anyone help me? please it's urgent.........

    Hello,
    The error is stating there isn't a descriptor for the Agent class the app is trying to execute a query on. This could be due to improper mappings, but assuming Agent is mapped, is more likely due to a classloader issue. TopLink uses the classloader at login to initialize the descriptors and hash them on the Class objects. If the application uses a different classloader, descriptors will not be found for classes loaded from the new classloader. How are you obtaining sessions, and where is the session being used?
    Best Regards,
    Chris

  • SSL error happened while calling a web service on a managed oc4j instance

    While calling a webservice, I got SSL Error: Unrecognized SSL message, plaintext connection? The webservice is deployed on a managed oc4j which is created on a 10.1.3.4 oracle application server. We have SSL certificate installed for http server.
    Any ideas?
    Thanks!

    Hello,
    The error is stating there isn't a descriptor for the Agent class the app is trying to execute a query on. This could be due to improper mappings, but assuming Agent is mapped, is more likely due to a classloader issue. TopLink uses the classloader at login to initialize the descriptors and hash them on the Class objects. If the application uses a different classloader, descriptors will not be found for classes loaded from the new classloader. How are you obtaining sessions, and where is the session being used?
    Best Regards,
    Chris

  • How add new table in derby  travel database

    sir i use Sun Java Studio Creator with derby
    sir i want create new table in derby travel database but when i right click
    on table not that disable and not give and table create button
    please give me idea how i add new table in derby travel database
    thank's aamir

    Within JDeveloper the generation of entities (Persistent POJOs) from tables will overwrite exiting classes. If you have additional tables you wish to map without losing existing work you will need to create the new classes and map them manually. If you are using the native TopLink mappings there is auto-map support on individual descriptors in the structure pane to automate much of this. If you are using JPA mappings it is a bit more manual at present but the tooling is ntended to give you feedback on problems as you construct and configure your mappings.
    Doug

  • Directory service integration - get no mapping working

    Hello,
    We are running SGD 4.3 and are using UNIX and LDAP login profiles. Login
    works fine (I can see LDAP address of the users in the detailed info page).
    But we do not get the Directory service integration working. Up till now I was
    thinking that this is due to wrong mappings on either SDG or/and our LDAP
    server. But now I added a filter to show the webtop server content mappings
    (server/webtop) and find the following discrepancy:
    Log file for server/webtop/moreinfo says:
    2007/01/24 17:36:49.946 (pid 21954)     server/webtop/moreinfo  #1169656609946
    The LDAP Webtop generator did not match the following apps
    user: uid=ttfguest,ou=People,ou=ttf,dc=desy,dc=de
        o=organization/cn=ddd but I do see the application named "ddd" (for which I limited the visibility via DSI to
    certain groups) on ttfguest webtop.
    Do I completely misunderstood something here - or is there some error in our
    configuration/setup whatsoever?
    Any help/tip is greatly welcome!

    This I do not understand. To be more precise:
    We allow two login profiles:
    UNIX profile
    LDAP profile
    Even if I remove all links from the UNIX profile, the users still see the ddd application.
    For the ddd application I constrained the visibility via DSI to certain LDAP users. This
    seems really to work (for me understanding) judging from the log message (see my
    first entry).
    So to my understanding nothing is overriding the constrain from the DSI but still the
    application is visible to all users.
    I up till now did not manage to get any application hidden by use of DSI (even
    though the logs give exactly what I expect - which makes me believe that the LDAP
    interoperability is fine like this).
    My general impression is that something still overrides all DSI constrains!?
    So still any tip/help would be very welcome!

  • Can HotCache use Hibernate

    I have been teaching myself the new Oracle Coherence HotCache technology & am playing around with it.
    I have a question about the JPA implementation. From what I have read, HotCache is built on TopLink & uses the JPA mappings metadat to update the cache from the database. Does that mean that the application using it HAS to be using TopLink. Would something like Hibernate work?
    Thanks!
    Nidhi

    Of course, you can use Hibernate as the CacheStore / CacheLoader of Coherence, or you can use Coherence as the second layer cache of Hibernate.

  • Shift not accepted in windows 7 login password

    shift not accepted in login password after powerup but is after restart.
    Tried a different keyboard same problem.
    Tried left and right shifts same problem.
    This has been a problem for a few weeks. Virus?
    Caps lock allows login but system is not usable due to keyboard mappings? hotkeys?

    Hello _glen,
    If the problem started a few weeks ago the quick easy solution is to restore to a time before it stopped working.
    Without doing that we can try to diagnose the issue further to see where the problem is isolated to.
    What make / model computer are you using?
    Do you have multiple accounts on the computer? Does the issue persist across multiple accounts?
    If you don't have the computer ask for a password on startup does the shift key not work within Windows upon wakeup?
    If I have helped you in any way click the Kudos button to say Thanks.
    The community works together, click Accept as Solution on the post that solves your issue for other members of the community to benefit from the solution.
    - Friendship is magical.

  • White pixels in animated GIFs with transparency

    Problem: at least one transparent pixel becomes solid white when exported as a GIF
    Details: there is approximately one pixel per layer, but occasionally there are more. There doesn't seem to be a pattern in where the pixel(s) are located. How can I prevent this from happening? If I can't, what's a good way to get rid of the pixels later?
    I use Photoshop CS3, but I think this problem may not be related to the version I'm using. Sorry if this problem has been resolved in a later version!

    The pixel is there. That's why it's showing.
    What Marion was trying to explain is, you may not have seen it before trying to save as GIF. If a pixel exists which is 5% white, you really won't see it against the transparency checkerboard. When you save for web, the application can't make a 5% opaque pixel for a gif. It's either 100% opaque or 100% transparent. Since the Save For Web sees color there.. it assumes you want that pixel and chooses 100% opaque.
    The solution is to find the partially transparent pixels and remove them before choosing save for web. Often adding a temporary solid-color layer below the artwork will help you see these partially opaque pixels, as will adding a temporary stroke layer style.
    For example this image would appear to be transparent except the two circles (horribly blurred due to size increase to for this example).
    But if I were to use Save for web, all sorts of things would appear. Look what happens when I put a temporary layer style stroke on the layer.....
    All the white pixels which were not visible suddenly become visible. In fact, download the first image and add a layer style stroke to it yourself. You'll see how nearly transparent pixles can effect an image.

  • My hard disk crashed and I cannot find out how to "contact customer service" other than this forum.  The website seems to just take me in a circle. I need to de-activate a license but cannot access the software due to a crashed hard drive.  Please help.

    My hard disk crashed and I cannot find out how to "contact customer service" other than this forum.  The website seems to just take me in a circle. I need to de-activate a license but cannot access the software due to a crashed hard drive.  Please help.

    Hi Anthony ,
    Here is the link to connect with Adobe Chat Support.
    https://helpx.adobe.com/adobe-connect/kb/connect-chat-support.html
    Hope your query gets resolved .
    Regards
    Sukrit Dhingra

  • Onetoone mappings in jpa 3.0

    I am having problems with a onetoone mapping.
    I have a Customer class
    Customer
    @Entity
    public class Customer implements Serializable {
    @Id
    @Column(name = "CUSTOMER_ID", nullable = false)
    @GeneratedValue(generator = "CusSeq")
    @SequenceGenerator(name = "CusSeq, sequenceName = "Cus_Seq", allocationSize = 1)
    private Long customerId;
    private String firstName;
    private String lastName;
    private String phoneNumber;
    //getters and setters for the variables
    @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
    @JoinColumn(name = "ADDRESS_ID", unique=true, nullable=false)
    private Address address;
    Address class
    @Entity
    public class Address implements Serializable {
    @Id
    @Column(name = "ADDRESS_ID",nullable = false)
    @GeneratedValue(generator = "AddSeq")
    @SequenceGenerator(name = "AddSeq", seqenceName = "ADD_SEQ", allocationSize = 1)
    private Long addressId;
    @OneToOne(optional=false, mappedBy = "address")
    private Customer customerAddressMandatory
    private String street1;
    private String street2
    private String city;
    private String state;
    private Strng county;
    //getters and setters for the variables
    mainTest
    public class MainTest {
    public MainTest(){
    public static void main(String[] args) {
    MainTest mainTest = new MainTest();
    Customer customer = new Customer();
    customer.setFirstName("John");
    customer.setLastName("Doe);
    customer.setPhoneNum("5716122300");
    Address address = new Address();
    address.setStreet1("111 Waxpool rd");
    address.setCity("Ashburn");
    address.setState("VA");
    address.setCounty("Loudon");
    customer.setAddress(address);
    address.setCustomerAddressMandatory(customer);
    // persistence code
    The ForeignKey in the database in Customer table is Primary_Address_Id;
    The primary Key in the Customer table is CUSTOMER_ID
    the primary key in the Address table is ADDRESS_ID
    The oneToOne mapping does not work. JPA does not work here because just for example purposes
    the address and Customer are mandatory fields for one another.
    I get an error message saying null cannot be inserted into the primary key filed of either customer
    or address depending on how I play with the onetoone mapping.
    Any help would be appreciated.
    Thanks,
    Veena
    Edited by: user597294 on Jun 8, 2011 5:36 AM
    Edited by: user597294 on Jun 8, 2011 5:37 AM
    Edited by: user597294 on Jun 8, 2011 5:57 AM

    Customer.java
    package testonetoone;
    import java.io.Serializable;
    import java.math.BigDecimal;
    import javax.persistence.CascadeType;
    import javax.persistence.Column;
    import javax.persistence.Entity;
    import javax.persistence.FetchType;
    import javax.persistence.GeneratedValue;
    import javax.persistence.Id;
    import javax.persistence.NamedQueries;
    import javax.persistence.NamedQuery;
    import javax.persistence.OneToOne;
    import javax.persistence.SequenceGenerator;
    @Entity
    @NamedQueries( { @NamedQuery(name = "Customer.findAll", query = "select o from Customer o") })
    public class Customer implements Serializable {
    @Id
    @Column(name = "CUSTOMER_ID", nullable = false)
    @GeneratedValue(generator = "CustomerSeq")
    @SequenceGenerator(name = "CustomerSeq", sequenceName = "XXXX.CUSTOMER_SEQ", allocationSize = 1)
    private BigDecimal customerId;
    @Column(name = "CUSTOMER_NAME", length = 20)
    private String customerName;
    @Column(name = "PHONES_ID", nullable = false)
    private BigDecimal phonesId;
    @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "customer")
    private Phones telephoneNumberMandatory;
    public Customer() {
    public Customer(BigDecimal customerId, String customerName, BigDecimal phonesId) {
    this.customerId = customerId;
    this.customerName = customerName;
    this.phonesId = phonesId;
    public BigDecimal getCustomerId() {
    return customerId;
    public void setCustomerId(BigDecimal customerId) {
    this.customerId = customerId;
    public String getCustomerName() {
    return customerName;
    public void setCustomerName(String customerName) {
    this.customerName = customerName;
    public BigDecimal getPhonesId() {
    return phonesId;
    public void setPhonesId(BigDecimal phonesId) {
    this.phonesId = phonesId;
    public void setTelephoneNumberMandatory(Phones telephoneNumberMandatory) {
    this.telephoneNumberMandatory = telephoneNumberMandatory;
    public Phones getTelephoneNumberMandatory() {
    return telephoneNumberMandatory;
    Phones.java
    @Entity
    @NamedQueries( { @NamedQuery(name = "Phones.findAll", query = "select o from Phones o") })
    public class Phones implements Serializable {
    @Column(name = "CUSTOMER_ID")
    private BigDecimal customerId;
    @Id
    @Column(name = "PHONES_ID", nullable = false)
    @GeneratedValue(generator = "PhonesSeq")
    @SequenceGenerator(name = "PhonesSeq", sequenceName = "XXXX.PHONES_SEQ", allocationSize = 1)
    private BigDecimal phonesId;
    @Column(name = "PHONE_NUMBER", length = 20)
    private String phoneNumber;
    @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
    private Customer customer;
    public Phones() {
    public Phones(BigDecimal customerId, String phoneNumber, BigDecimal phonesId) {
    this.customerId = customerId;
    this.phoneNumber = phoneNumber;
    this.phonesId = phonesId;
    public BigDecimal getCustomerId() {
    return customerId;
    public void setCustomerId(BigDecimal customerId) {
    this.customerId = customerId;
    public BigDecimal getPhonesId() {
    return phonesId;
    public void setPhonesId(BigDecimal phonesId) {
    this.phonesId = phonesId;
    public String getPhoneNumber() {
    return phoneNumber;
    public void setPhoneNumber(String phoneNumber) {
    this.phoneNumber = phoneNumber;
    public void setCustomer(Customer customer) {
    this.customer = customer;
    public Customer getCustomer() {
    return customer;
    TestOneToOne.java
    package testonetoone;
    import javax.persistence.EntityManager;
    import javax.persistence.EntityManagerFactory;
    import javax.persistence.Persistence;
    public class TestOneToOne {
    public TestOneToOne() {
    super();
    public static void main(String[] args) {
    TestOneToOne testOneToOne = new TestOneToOne();
    EntityManagerFactory emf = null;
    emf = Persistence.createEntityManagerFactory("TestOneToOne", new java.util.HashMap());
    // 1) Create customer, create phones, set add mapping
    EntityManager em = emf.createEntityManager();
    Customer c = new Customer();
    Phones p = new Phones();
    c.setCustomerName("Chrysler");
    p.setCustomer(c);
    p.setPhoneNumber("5716120000");
    c.setTelephoneNumberMandatory(p);
    try {
    em.getTransaction().begin();
    em.persist(c);
    em.getTransaction().commit();
    } finally {
    em.close();
    Persistence.xml
    <?xml version="1.0" encoding="windows-1252" ?>
    <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
    version="2.0">
    <persistence-unit name="TestOneToOne">
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    <jta-data-source>java:/app/jdbc/jdbc/idev01DS</jta-data-source>
    <class>testonetoone.Customer</class>
    <class>testonetoone.Phones</class>
    <properties>
    <property name="eclipselink.target-server" value="WebLogic_10"/>
    <property name="javax.persistence.jtaDataSource" value="java:/app/jdbc/jdbc/idev01DS"/>
    <property name="eclipselink.jdbc.driver" value="oracle.jdbc.OracleDriver"/>
    <property name="eclipselink.jdbc.url" value="jdbc:oracle:thin:@idev01.xxxx.com:1521:dev"/>
    <property name="eclipselink.jdbc.user" value="DBSCHEMA"/>
    <property name="eclipselink.jdbc.password" value="password"/>
    </properties>
    </persistence-unit>
    </persistence>
    The error message I get is as follows:
    [EL Warning]: 2011-06-21 09:12:14.261--UnitOfWork(24485138)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.1.3.v20110304-r9073): org.eclipse.persistence.exceptions.DatabaseException
    Internal Exception: java.sql.SQLIntegrityConstraintViolationException: ORA-01400: cannot insert NULL into ("XXXX"."CUSTOMER"."PHONES_ID")
    Error Code: 1400
    Call: INSERT INTO CUSTOMER (CUSTOMER_ID, CUSTOMER_NAME, PHONES_ID) VALUES (?, ?, ?)
         bind => [2, Chrysler, null]
    Query: InsertObjectQuery(testonetoone.Customer@2c9103)
    Exception in thread "main" javax.persistence.RollbackException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.1.3.v20110304-r9073): org.eclipse.persistence.exceptions.DatabaseException
    Internal Exception: java.sql.SQLIntegrityConstraintViolationException: ORA-01400: cannot insert NULL into ("XXXX"."CUSTOMER"."PHONES_ID")
    Error Code: 1400
    Call: INSERT INTO CUSTOMER (CUSTOMER_ID, CUSTOMER_NAME, PHONES_ID) VALUES (?, ?, ?)
         bind => [2, Chrysler, null]
    Query: InsertObjectQuery(testonetoone.Customer@2c9103)
         at org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commitInternal(EntityTransactionImpl.java:102)
         at org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commit(EntityTransactionImpl.java:63)
         at testonetoone.TestOneToOne.main(TestOneToOne.java:30)
    Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.1.3.v20110304-r9073): org.eclipse.persistence.exceptions.DatabaseException
    Internal Exception: java.sql.SQLIntegrityConstraintViolationException: ORA-01400: cannot insert NULL into ("XXXX"."CUSTOMER"."PHONES_ID")
    Error Code: 1400
    Call: INSERT INTO CUSTOMER (CUSTOMER_ID, CUSTOMER_NAME, PHONES_ID) VALUES (?, ?, ?)
         bind => [2, Chrysler, null]
    Query: InsertObjectQuery(testonetoone.Customer@2c9103)
    Edited by: user597294 on Jun 21, 2011 6:46 AM
    Edited by: user597294 on Jun 21, 2011 6:47 AM

  • Running on Weblogic Server 9 with XML mappings (JPA)

    We have a project with a number of persistent classes configured through XML mapping files instead of annotations because it should also work under JDK 1.4.
    It works perfect as a standalone client or set up in the server with a connection specified in the persistence.xml.
    However when configuring it through a resource adapter as recommended for WLS9, I'm running into problems as there seems to be no way to specify that MetaData should be taken from an XML file when it comes to the JPA edition.
    Eg. I'm missing the equivalent of:
    <mapping-file>com/xyz/xxx/Service.orm.xml</mapping-file>So naturally I get an Exception like:
    org.apache.openjpa.persistence.ArgumentException: There is no query with the name "findServiceByName" defined for any of the known persistent classes: null.And the server log also shows:
    INFO   [[ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'] openjpa.MetaData - Found 0 classes with metadata in 20 milliseconds.Any suggestions on how to fix or work around this without introducing annotations?
    Regards
    Brian Jacobsen

    Yes we are using named queries as well.
    WLS 9.2, Kodo 4.1.2.
    There are no entries in config.xml and no persistence.xml when running as recommended under WLS9 installation in the Kodo documentation.
    Everything is configured in the ra.xml for the resource adapter. But the ra.xml specification only supports specification through annotated classes for JPA as far as I can decipher, which is what I tried to describe in the original post.
    Eg. kodo.MetaDataFactory supports only classes through Type. There is no way to specify the equivalent mapping through XML files. See section 6.2 Metadata Factory in the Kodo Manual.
    Kind regards
    Brian Jacobsen

  • Query with JPA not working. Is possible to see the executed SQL statements?

    Hi all,
    I have a question regarding namedqueries. I am having an error for which I am not being able to find any solution. ORM mappings seem to be ok, and the EntityManager validates correctly. However I am getting an error when trying to retrieve some results. My question is if it is possible to retrieve the set of SQL statements queried on the server, to see if it is due to a different issue than JPA settings.
    Thanks in advance,
    Chal-lo.

    You can enable sql logging in a provider specific way (e.g for hibernate you add hibernate.show_sql=true in the hibernate.properties file).
    You could get more help if you described the problem you are getting.

  • Unable to display Flowtrace due to exception while initializing object.

    Hi,
    Getting below error while trying to view the trace of BPEL process in 11g. Any suggestions.
    Unable to display Flowtrace due to exception while initializing object, please review logs for detailed information
    Exception occured while retrieving the Flowtrace XML for the Composite Instance; ECID: 0000IqUGPYa6mJxg^9Dg^q1DDhCO000068
    java.rmi.RemoteException: EJB Exception: ; nested exception is:
    java.lang.RuntimeException: java.lang.NullPointerException
    at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:234)
    at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:223)
    at oracle.soa.management.internal.ejb.impl.FacadeFinderBean_4vacyo_FacadeFinderBeanImpl_1033_WLStub.getAuditTrail(Unknown Source)
    at oracle.soa.management.internal.ejb.EJBLocatorImpl.getAuditTrail(EJBLocatorImpl.java:468)
    at oracle.sysman.emai.model.sca.share.composite.FlowTraceModel.setFloatraceModelInfo(FlowTraceModel.java:167)
    at oracle.sysman.emai.model.sca.share.composite.FlowTraceModel.initialize(FlowTraceModel.java:74)
    at oracle.sysman.emai.model.sca.EMEntityModel._initializeEntityData(EMEntityModel.java:28)
    at oracle.sysman.emai.model.sca.common.SCAEntityObject.initializeSCAData(SCAEntityObject.java:124)
    at oracle.sysman.emai.model.sca.SCAObject.initializeData(SCAObject.java:59)
    at oracle.sysman.core.model.util.ModelUtil$EMObjectResetter.initOrResetEMObject(ModelUtil.java:319)
    at oracle.sysman.core.model.util.ModelUtil$EMObjectResetter.access$000(ModelUtil.java:280)
    at oracle.sysman.core.model.util.ModelUtil.initializeMBEMObjects(ModelUtil.java:231)
    at oracle.sysman.core.model.util.ModelUtil.initializeAllEMObjects(ModelUtil.java:128)
    at oracle.sysman.core.model.util.ModelUtil.initializeAllEMObjects(ModelUtil.java:101)
    at oracle.sysman.emSDK.adfext.ctlr.EMPagePhaseListener.doPrePrepareModel(EMPagePhaseListener.java:866)
    at oracle.sysman.emSDK.adfext.ctlr.EMPagePhaseListener.beforePhase(EMPagePhaseListener.java:794)
    at oracle.adfinternal.controller.lifecycle.ADFLifecycleImpl$PagePhaseListenerWrapper.beforePhase(ADFLifecycleImpl.java:551)
    at oracle.adfinternal.controller.lifecycle.LifecycleImpl.internalDispatchBeforeEvent(LifecycleImpl.java:100)
    at oracle.adfinternal.controller.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:187)
    at oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener.access$400(ADFPhaseListener.java:21)
    at oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener$PhaseInvokerImpl.startPageLifecycle(ADFPhaseListener.java:231)
    at oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener$1.after(ADFPhaseListener.java:267)
    at oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener.afterPhase(ADFPhaseListener.java:71)
    at oracle.adfinternal.controller.faces.lifecycle.ADFLifecyclePhaseListener.afterPhase(ADFLifecyclePhaseListener.java:53)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:364)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:177)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:97)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
    at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:247)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:157)
    at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.help.web.rich.OHWFilter.doFilter(Unknown Source)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.sysman.emSDK.license.LicenseFilter.doFilter(LicenseFilter.java:164)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:191)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.sysman.emas.fwk.MASConnectionFilter.doFilter(MASConnectionFilter.java:41)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:159)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.sysman.eml.app.AuditServletFilter.doFilter(AuditServletFilter.java:179)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.sysman.eml.app.EMRepLoginFilter.doFilter(EMRepLoginFilter.java:203)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.sysman.core.app.perf.PerfFilter.doFilter(PerfFilter.java:141)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.sysman.eml.app.ContextInitFilter.doFilter(ContextInitFilter.java:542)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.dms.wls.DMSServletFilter.doFilter(DMSServletFilter.java:330)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.doIt(WebAppServletContext.java:3684)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3650)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2268)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2174)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1446)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    Caused by: java.lang.RuntimeException: java.lang.NullPointerException
    at oracle.soa.management.internal.ejb.impl.FacadeFinderBeanImpl.getComponentInstances(FacadeFinderBeanImpl.java:722)
    at oracle.soa.management.internal.ejb.impl.FacadeFinderBeanImpl.buildAuditTrail(FacadeFinderBeanImpl.java:812)
    at oracle.soa.management.internal.ejb.impl.FacadeFinderBeanImpl.getAuditTrail(FacadeFinderBeanImpl.java:780)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
    at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
    at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
    at com.bea.core.repackaged.springframework.jee.intercept.MethodInvocationInvocationContext.proceed(MethodInvocationInvocationContext.java:104)
    at oracle.security.jps.ee.ejb.JpsAbsInterceptor$1.run(JpsAbsInterceptor.java:88)
    at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
    at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:414)
    at oracle.security.jps.wls.JpsWeblogicEjbInterceptor.runJaasMode(JpsWeblogicEjbInterceptor.java:61)
    at oracle.security.jps.ee.ejb.JpsAbsInterceptor.intercept(JpsAbsInterceptor.java:106)
    at oracle.security.jps.ee.ejb.JpsInterceptor.intercept(JpsInterceptor.java:106)
    at sun.reflect.GeneratedMethodAccessor1028.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
    at com.bea.core.repackaged.springframework.jee.intercept.JeeInterceptorInterceptor.invoke(JeeInterceptorInterceptor.java:69)
    at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
    at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
    at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at com.bea.core.repackaged.springframework.jee.spi.MethodInvocationVisitorImpl.visit(MethodInvocationVisitorImpl.java:37)
    at weblogic.ejb.container.injection.EnvironmentInterceptorCallbackImpl.callback(EnvironmentInterceptorCallbackImpl.java:54)
    at com.bea.core.repackaged.springframework.jee.spi.EnvironmentInterceptor.invoke(EnvironmentInterceptor.java:50)
    at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at com.bea.core.repackaged.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
    at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
    at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
    at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at com.bea.core.repackaged.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
    at $Proxy343.getAuditTrail(Unknown Source)
    at oracle.soa.management.internal.ejb.impl.FacadeFinderBean_4vacyo_FacadeFinderBeanImpl.getAuditTrail(FacadeFinderBean_4vacyo_FacadeFinderBeanImpl.java:1627)
    at oracle.soa.management.internal.ejb.impl.FacadeFinderBean_4vacyo_FacadeFinderBeanImpl_WLSkel.invoke(Unknown Source)
    at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:590)
    at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:478)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)
    at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:473)
    at weblogic.rmi.internal.wls.WLSExecuteRequest.run(WLSExecuteRequest.java:119)
    ... 2 more
    Caused by: java.lang.NullPointerException
    at org.eclipse.persistence.internal.security.PrivilegedAccessHelper.getMethodParameterTypes(PrivilegedAccessHelper.java:294)
    at org.eclipse.persistence.internal.descriptors.MethodAttributeAccessor.getSetMethodParameterType(MethodAttributeAccessor.java:132)
    at org.eclipse.persistence.internal.descriptors.MethodAttributeAccessor.setAttributeValueInObject(MethodAttributeAccessor.java:231)
    at org.eclipse.persistence.mappings.DatabaseMapping.setAttributeValueInObject(DatabaseMapping.java:1368)
    at org.eclipse.persistence.mappings.DatabaseMapping.readFromRowIntoObject(DatabaseMapping.java:1259)
    at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildAttributesIntoObject(ObjectBuilder.java:332)
    at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:661)
    at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildWorkingCopyCloneNormally(ObjectBuilder.java:583)
    at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObjectInUnitOfWork(ObjectBuilder.java:552)
    at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:492)
    at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:444)
    at org.eclipse.persistence.queries.ObjectLevelReadQuery.buildObject(ObjectLevelReadQuery.java:635)
    at org.eclipse.persistence.queries.ReadAllQuery.registerResultInUnitOfWork(ReadAllQuery.java:838)
    at org.eclipse.persistence.queries.ReadAllQuery.executeObjectLevelReadQuery(ReadAllQuery.java:464)
    at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:997)
    at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:675)
    at org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:958)
    at org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuery.java:432)
    at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:1021)
    at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2898)
    at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1225)
    at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1207)
    at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1181)
    at org.eclipse.persistence.internal.jpa.EJBQueryImpl.executeReadQuery(EJBQueryImpl.java:453)
    at org.eclipse.persistence.internal.jpa.EJBQueryImpl.getResultList(EJBQueryImpl.java:681)
    at weblogic.deployment.TransactionalEntityManagerProxyImpl$QueryImpl.getResultList(TransactionalEntityManagerProxyImpl.java:225)
    at com.collaxa.cube.persistence.dao.impl.jpa.JpaCubeInstanceDaoImpl.getInstances(JpaCubeInstanceDaoImpl.java:315)
    at oracle.fabric.CubeServiceEngine.getComponentInstances(CubeServiceEngine.java:1337)
    at oracle.soa.management.internal.ejb.impl.FacadeFinderBeanImpl.getComponentInstances(FacadeFinderBeanImpl.java:719)
    at oracle.soa.management.internal.ejb.impl.FacadeFinderBeanImpl.buildAuditTrail(FacadeFinderBeanImpl.java:812)
    at oracle.soa.management.internal.ejb.impl.FacadeFinderBeanImpl.getAuditTrail(FacadeFinderBeanImpl.java:780)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
    at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
    at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
    at com.bea.core.repackaged.springframework.jee.intercept.MethodInvocationInvocationContext.proceed(MethodInvocationInvocationContext.java:104)
    at oracle.security.jps.ee.ejb.JpsAbsInterceptor$1.run(JpsAbsInterceptor.java:88)
    at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
    at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:414)
    at oracle.security.jps.wls.JpsWeblogicEjbInterceptor.runJaasMode(JpsWeblogicEjbInterceptor.java:61)
    at oracle.security.jps.ee.ejb.JpsAbsInterceptor.intercept(JpsAbsInterceptor.java:106)
    at oracle.security.jps.ee.ejb.JpsInterceptor.intercept(JpsInterceptor.java:106)
    at sun.reflect.GeneratedMethodAccessor1028.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
    at com.bea.core.repackaged.springframework.jee.intercept.JeeInterceptorInterceptor.invoke(JeeInterceptorInterceptor.java:69)
    at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
    at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
    at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at com.bea.core.repackaged.springframework.jee.spi.MethodInvocationVisitorImpl.visit(MethodInvocationVisitorImpl.java:37)
    at weblogic.ejb.container.injection.EnvironmentInterceptorCallbackImpl.callback(EnvironmentInterceptorCallbackImpl.java:54)
    at com.bea.core.repackaged.springframework.jee.spi.EnvironmentInterceptor.invoke(EnvironmentInterceptor.java:50)
    at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at com.bea.core.repackaged.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
    at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
    at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
    at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at com.bea.core.repackaged.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
    at $Proxy343.getAuditTrail(Unknown Source)
    at oracle.soa.management.internal.ejb.impl.FacadeFinderBean_4vacyo_FacadeFinderBeanImpl.getAuditTrail(FacadeFinderBean_4vacyo_FacadeFinderBeanImpl.java:1627)
    at oracle.soa.management.internal.ejb.impl.FacadeFinderBean_4vacyo_FacadeFinderBeanImpl_WLSkel.invoke(Unknown Source)
    at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:589)
    at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:477)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)
    at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:473)
    at weblogic.rmi.internal.wls.WLSExecuteRequest.run(WLSExecuteRequest.java:118)
    ... 2 more
    Thanks & Regards,
    Suryaveer

    Hi,
    In our environment we got the same stack trace while accessing the BPEL Console, is there a Bug for this issue?
    Please reply
    Regards
    Chang

  • "Class Circle not found in TryBouncingBalls" error message. Help !

    Dear People,
    I have an error message :
    "TryBouncingBalls.java": Error : class Circle not found in class stan_bluej_ch5_p135.TryBouncingBalls at line 67, "
    Circle circle = new Circle(xPos + 130, 30);
    below are the classes TryBouncingBalls, BouncingBall, BallDemo, Canvas
    Thank you in advance
    Stan
    package stan_bluej_ch5_p135;
    import java.awt.*;
    import java.awt.geom.*;
    public class TryBouncingBalls
    public static void main(String[] args)
    Canvas myCanvas = new Canvas("Creativity at its best");
    myCanvas.setVisible(true);
    BouncingBall ball = new BouncingBall(50,50,16, Color.red, 500, myCanvas);
    BouncingBall ball2 = new BouncingBall(70,80,20, Color.green, 500, myCanvas);
    BouncingBall ball3 = new BouncingBall(90,100,16, Color.red, 500, myCanvas);
    BouncingBall ball4 = new BouncingBall(30,30,20, Color.green, 500, myCanvas);
    ball.draw();
    ball2.draw();
    ball.draw();
    ball2.draw();
    // make them bounce
    boolean finished = false;
    while(!finished) {
    myCanvas.wait(50); // small delay
    ball.move();
    ball2.move();
    ball3.move();
    ball4.move();
    // stop once ball has travelled a certain distance on x axis
    if(ball.getXPosition() >= 550 && ball2.getXPosition() >= 550)
    finished = true;
    myCanvas.setFont(new Font("helvetica", Font.BOLD, 14));
    myCanvas.setForegroundColor(Color.red);
    myCanvas.drawString("We are having fun, ...\n\n", 20, 30);
    myCanvas.wait(1000);
    myCanvas.setForegroundColor(Color.black);
    myCanvas.drawString("...drawing lines...", 60, 60);
    myCanvas.wait(500);
    myCanvas.setForegroundColor(Color.gray);
    myCanvas.drawLine(200, 20, 300, 50);
    myCanvas.wait(500);
    myCanvas.setForegroundColor(Color.blue);
    myCanvas.drawLine(220, 100, 370, 40);
    myCanvas.wait(500);
    myCanvas.setForegroundColor(Color.green);
    myCanvas.drawLine(290, 10, 320, 120);
    myCanvas.wait(1000);
    myCanvas.setForegroundColor(Color.gray);
    myCanvas.drawString("...and shapes!", 110, 90);
    myCanvas.setForegroundColor(Color.red);
    myCanvas.drawString("to bring to focus creative ideas !", 310, 290);
    // the shape to draw and move
    int xPos = 10;
    Rectangle rect = new Rectangle(xPos + 40, 150, 30, 20);
    Rectangle rect2 = new Rectangle(xPos + 80, 120, 50, 25);
    Rectangle rect3 = new Rectangle(xPos+ 1200, 180, 30, 30);
    Rectangle rect4 = new Rectangle(xPos + 150, 220, 40, 15);
    myCanvas.fill(rect);
    myCanvas.fill(rect2);
    myCanvas.fill(rect3);
    myCanvas.fill(rect4);
    Circle circle = new Circle(xPos + 130, 30);
    // Circle circle2 = new Circle(xPos + 150, 50);
    // Circle circle3 = new Circle(xPos + 170, 30);
    // Circle circle4 = new Circle(xPos + 200, 40);
    // myCanvas.fill(circle);
    // myCanvas.fill(circle2);
    // myCanvas.fill(circle3);
    // myCanvas.fill(circle4);
    // move the rectangle and circles across the screen
    for(int i = 0; i < 200; i ++) {
    myCanvas.fill(rect);
    myCanvas.fill(rect2);
    myCanvas.fill(rect3);
    myCanvas.fill(rect4);
    myCanvas.wait(10);
    myCanvas.erase(rect);
    myCanvas.erase(rect2);
    myCanvas.erase(rect3);
    myCanvas.erase(rect4);
    xPos++;
    rect.setLocation(xPos, 150);
    rect2.setLocation(xPos, 120);
    rect3.setLocation(xPos, 180);
    rect4.setLocation(xPos, 220);
    // at the end of the move, draw once more so that it remains visible
    myCanvas.fill(rect);
    myCanvas.fill(rect2);
    myCanvas.fill(rect3);
    myCanvas.fill(rect4);
    package stan_bluej_ch5_p135;
    import java.awt.*;
    import java.awt.geom.*;
    * Class BouncingBall - a graphical ball that observes the effect of gravity. The ball
    * has the ability to move. Details of movement are determined by the ball itself. It
    * will fall downwards, accelerating with time due to the effect of gravity, and bounce
    * upward again when hitting the ground.
    * This movement can be initiated by repeated calls to the "move" method.
    * @author Bruce Quig
    * @author Michael Kolling (mik)
    * @author David J. Barnes
    * @version 1.1 (23-Jan-2002)
    public class BouncingBall
    private static final int gravity = 3; // effect of gravity
    private int ballDegradation = 2;
    private Ellipse2D.Double circle;
    private Color color;
    private int diameter;
    private int xPosition;
    private int yPosition;
    private final int groundPosition; // y position of ground
    private Canvas canvas;
    private int ySpeed = 1; // initial downward speed
    * Constructor for objects of class BouncingBall
    * @param xPos the horizontal coordinate of the ball
    * @param yPos the vertical coordinate of the ball
    * @param ballDiameter the diameter (in pixels) of the ball
    * @param ballColor the color of the ball
    * @param groundPos the position of the ground (where the wall will bounce)
    * @param drawingCanvas the canvas to draw this ball on
    public BouncingBall(int xPos, int yPos, int ballDiameter, Color ballColor,
    int groundPos, Canvas drawingCanvas)
    xPosition = xPos;
    yPosition = yPos;
    color = ballColor;
    diameter = ballDiameter;
    groundPosition = groundPos;
    canvas = drawingCanvas;
    * Draw this ball at its current position onto the canvas.
    public void draw()
    canvas.setForegroundColor(color);
    canvas.fillCircle(xPosition, yPosition, diameter);
    * Erase this ball at its current position.
    public void erase()
    canvas.eraseCircle(xPosition, yPosition, diameter);
    * Move this ball according to its position and speed and redraw.
    public void move()
    // remove from canvas at the current position
    erase();
    // compute new position
    ySpeed += gravity;
    yPosition += ySpeed;
    xPosition +=2;
    // check if it has hit the ground
    if(yPosition >= (groundPosition - diameter) && ySpeed > 0) {
    yPosition = (int)(groundPosition - diameter);
    ySpeed = -ySpeed + ballDegradation;
    // draw again at new position
    draw();
    * return the horizontal position of this ball
    public int getXPosition()
    return xPosition;
    * return the vertical position of this ball
    public int getYPosition()
    return yPosition;
    package stan_bluej_ch5_p135;
    import java.awt.*;
    import java.awt.geom.*;
    * Class BallDemo - provides two short demonstrations showing how to use the
    * Canvas class.
    * @author Michael Kolling and David J. Barnes
    * @version 1.0 (23-Jan-2002)
    public class BallDemo
    private Canvas myCanvas;
    * Create a BallDemo object. Creates a fresh canvas and makes it visible.
    public BallDemo()
    myCanvas = new Canvas("Ball Demo", 600, 500);
    myCanvas.setVisible(true);
    * This method demonstrates some of the drawing operations that are
    * available on a Canvas object.
    public void drawDemo()
    myCanvas.setFont(new Font("helvetica", Font.BOLD, 14));
    myCanvas.setForegroundColor(Color.red);
    myCanvas.drawString("We can draw text, ...", 20, 30);
    myCanvas.wait(1000);
    myCanvas.setForegroundColor(Color.black);
    myCanvas.drawString("...draw lines...", 60, 60);
    myCanvas.wait(500);
    myCanvas.setForegroundColor(Color.gray);
    myCanvas.drawLine(200, 20, 300, 50);
    myCanvas.wait(500);
    myCanvas.setForegroundColor(Color.blue);
    myCanvas.drawLine(220, 100, 370, 40);
    myCanvas.wait(500);
    myCanvas.setForegroundColor(Color.green);
    myCanvas.drawLine(290, 10, 320, 120);
    myCanvas.wait(1000);
    myCanvas.setForegroundColor(Color.gray);
    myCanvas.drawString("...and shapes!", 110, 90);
    myCanvas.setForegroundColor(Color.red);
    // the shape to draw and move
    int xPos = 10;
    Rectangle rect = new Rectangle(xPos, 150, 30, 20);
    // move the rectangle across the screen
    for(int i = 0; i < 200; i ++) {
    myCanvas.fill(rect);
    myCanvas.wait(10);
    myCanvas.erase(rect);
    xPos++;
    rect.setLocation(xPos, 150);
    // at the end of the move, draw once more so that it remains visible
    myCanvas.fill(rect);
    * Simulates two bouncing balls
    public void bounce()
    int ground = 400; // position of the ground line
    myCanvas.setVisible(true);
    // draw the ground
    myCanvas.drawLine(50, ground, 550, ground);
    // crate and show the balls
    BouncingBall ball = new BouncingBall(50, 50, 16, Color.blue, ground, myCanvas);
    ball.draw();
    BouncingBall ball2 = new BouncingBall(70, 80, 20, Color.red, ground, myCanvas);
    ball2.draw();
    // make them bounce
    boolean finished = false;
    while(!finished) {
    myCanvas.wait(50); // small delay
    ball.move();
    ball2.move();
    // stop once ball has travelled a certain distance on x axis
    if(ball.getXPosition() >= 550 && ball2.getXPosition() >= 550)
    finished = true;
    ball.erase();
    ball2.erase();
    package stan_bluej_ch5_p135;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.geom.*;
    * Class Canvas - a class to allow for simple graphical
    * drawing on a canvas.
    * @author Michael Kolling (mik)
    * @author Bruce Quig
    * @version 1.8 (23.01.2002)
    public class Canvas
    private JFrame frame;
    private CanvasPane canvas;
    private Graphics2D graphic;
    private Color backgroundColor;
    private Image canvasImage;
    * Create a Canvas with default height, width and background color
    * (300, 300, white).
    * @param title title to appear in Canvas Frame
    public Canvas(String title)
    this(title, 600, 600, Color.white);
    * Create a Canvas with default background color (white).
    * @param title title to appear in Canvas Frame
    * @param width the desired width for the canvas
    * @param height the desired height for the canvas
    public Canvas(String title, int width, int height)
    this(title, width, height, Color.white);
    * Create a Canvas.
    * @param title title to appear in Canvas Frame
    * @param width the desired width for the canvas
    * @param height the desired height for the canvas
    * @param bgClour the desired background color of the canvas
    public Canvas(String title, int width, int height, Color bgColor)
    frame = new JFrame();
    canvas = new CanvasPane();
    frame.setContentPane(canvas);
    frame.setTitle(title);
    canvas.setPreferredSize(new Dimension(width, height));
    backgroundColor = bgColor;
    frame.pack();
    * Set the canvas visibility and brings canvas to the front of screen
    * when made visible. This method can also be used to bring an already
    * visible canvas to the front of other windows.
    * @param visible boolean value representing the desired visibility of
    * the canvas (true or false)
    public void setVisible(boolean visible)
    if(graphic == null) {
    // first time: instantiate the offscreen image and fill it with
    // the background color
    Dimension size = canvas.getSize();
    canvasImage = canvas.createImage(size.width, size.height);
    graphic = (Graphics2D)canvasImage.getGraphics();
    graphic.setColor(backgroundColor);
    graphic.fillRect(0, 0, size.width, size.height);
    graphic.setColor(Color.black);
    frame.show();
    * Provide information on visibility of the Canvas.
    * @return true if canvas is visible, false otherwise
    public boolean isVisible()
    return frame.isVisible();
    * Draw the outline of a given shape onto the canvas.
    * @param shape the shape object to be drawn on the canvas
    public void draw(Shape shape)
    graphic.draw(shape);
    canvas.repaint();
    * Fill the internal dimensions of a given shape with the current
    * foreground color of the canvas.
    * @param shape the shape object to be filled
    public void fill(Shape shape)
    graphic.fill(shape);
    canvas.repaint();
    * Fill the internal dimensions of the given circle with the current
    * foreground color of the canvas.
    public void fillCircle(int xPos, int yPos, int diameter)
    Ellipse2D.Double circle = new Ellipse2D.Double(xPos, yPos, diameter, diameter);
    fill(circle);
    * Fill the internal dimensions of the given rectangle with the current
    * foreground color of the canvas. This is a convenience method. A similar
    * effect can be achieved with the "fill" method.
    public void fillRectangle(int xPos, int yPos, int width, int height)
    fill(new Rectangle(xPos, yPos, width, height));
    * Erase the whole canvas.
    public void erase()
    Color original = graphic.getColor();
    graphic.setColor(backgroundColor);
    Dimension size = canvas.getSize();
    graphic.fill(new Rectangle(0, 0, size.width, size.height));
    graphic.setColor(original);
    canvas.repaint();
    * Erase the internal dimensions of the given circle. This is a
    * convenience method. A similar effect can be achieved with
    * the "erase" method.
    public void eraseCircle(int xPos, int yPos, int diameter)
    Ellipse2D.Double circle = new Ellipse2D.Double(xPos, yPos, diameter, diameter);
    erase(circle);
    * Erase the internal dimensions of the given rectangle. This is a
    * convenience method. A similar effect can be achieved with
    * the "erase" method.
    public void eraseRectangle(int xPos, int yPos, int width, int height)
    erase(new Rectangle(xPos, yPos, width, height));
    * Erase a given shape's interior on the screen.
    * @param shape the shape object to be erased
    public void erase(Shape shape)
    Color original = graphic.getColor();
    graphic.setColor(backgroundColor);
    graphic.fill(shape); // erase by filling background color
    graphic.setColor(original);
    canvas.repaint();
    * Erases a given shape's outline on the screen.
    * @param shape the shape object to be erased
    public void eraseOutline(Shape shape)
    Color original = graphic.getColor();
    graphic.setColor(backgroundColor);
    graphic.draw(shape); // erase by drawing background color
    graphic.setColor(original);
    canvas.repaint();
    * Draws an image onto the canvas.
    * @param image the Image object to be displayed
    * @param x x co-ordinate for Image placement
    * @param y y co-ordinate for Image placement
    * @return returns boolean value representing whether the image was
    * completely loaded
    public boolean drawImage(Image image, int x, int y)
    boolean result = graphic.drawImage(image, x, y, null);
    canvas.repaint();
    return result;
    * Draws a String on the Canvas.
    * @param text the String to be displayed
    * @param x x co-ordinate for text placement
    * @param y y co-ordinate for text placement
    public void drawString(String text, int x, int y)
    graphic.drawString(text, x, y);
    canvas.repaint();
    * Erases a String on the Canvas.
    * @param text the String to be displayed
    * @param x x co-ordinate for text placement
    * @param y y co-ordinate for text placement
    public void eraseString(String text, int x, int y)
    Color original = graphic.getColor();
    graphic.setColor(backgroundColor);
    graphic.drawString(text, x, y);
    graphic.setColor(original);
    canvas.repaint();
    * Draws a line on the Canvas.
    * @param x1 x co-ordinate of start of line
    * @param y1 y co-ordinate of start of line
    * @param x2 x co-ordinate of end of line
    * @param y2 y co-ordinate of end of line
    public void drawLine(int x1, int y1, int x2, int y2)
    graphic.drawLine(x1, y1, x2, y2);
    canvas.repaint();
    * Sets the foreground color of the Canvas.
    * @param newColor the new color for the foreground of the Canvas
    public void setForegroundColor(Color blue)
    graphic.setColor(Color.blue);
    * Returns the current color of the foreground.
    * @return the color of the foreground of the Canvas
    public Color getForegroundColor()
    return graphic.getColor();
    * Sets the background color of the Canvas.
    * @param newColor the new color for the background of the Canvas
    public void setBackgroundColor(Color newColor)
    backgroundColor = newColor;
    graphic.setBackground(newColor);
    * Returns the current color of the background
    * @return the color of the background of the Canvas
    public Color getBackgroundColor()
    return backgroundColor;
    * changes the current Font used on the Canvas
    * @param newFont new font to be used for String output
    public void setFont(Font newFont)
    graphic.setFont(newFont);
    * Returns the current font of the canvas.
    * @return the font currently in use
    public Font getFont()
    return graphic.getFont();
    * Sets the size of the canvas.
    * @param width new width
    * @param height new height
    public void setSize(int width, int height)
    canvas.setPreferredSize(new Dimension(width, height));
    Image oldImage = canvasImage;
    canvasImage = canvas.createImage(width, height);
    graphic = (Graphics2D)canvasImage.getGraphics();
    graphic.drawImage(oldImage, 0, 0, null);
    frame.pack();
    * Returns the size of the canvas.
    * @return The current dimension of the canvas
    public Dimension getSize()
    return canvas.getSize();
    * Waits for a specified number of milliseconds before finishing.
    * This provides an easy way to specify a small delay which can be
    * used when producing animations.
    * @param milliseconds the number
    public void wait(int milliseconds)
    try
    Thread.sleep(milliseconds);
    catch (InterruptedException e)
    // ignoring exception at the moment
    * Nested class CanvasPane - the actual canvas component contained in the
    * Canvas frame. This is essentially a JPanel with added capability to
    * refresh the image drawn on it.
    private class CanvasPane extends JPanel
    public void paint(Graphics g)
    g.drawImage(canvasImage, 0, 0, null);

    Dear Miciuli,
    I found the definition for the circle in the canvas class and used it to creates circles ! Thank you for jaring my brain into thinking !
    Stan
    Ellipse2D.Double circle = new Ellipse2D.Double(xPos, 70, 30 , 30);

Maybe you are looking for