Help with jpa paging exception

hi i have the following method that does paging in an ejb. (dont mind the string params, not using them yet)
@Override
public List<DatamainMst> findAll(String srchCallup, String srchSurname, String srchOthernames, String srchInst, String srchCourse,int first, int pagesize) {
List<DatamainMst> mst = em.createQuery("select o from DatamainMst o")
.setFirstResult(first).setMaxResults(pagesize).getResultList();
return mst;
my database table has about 61868 records. the whole paging works well until "first" argument is 61200, and irrespective of the page size, i always get the following exception:
WARNING: java.lang.NullPointerException
at nysc.entities.DatamainMst._persistence_set(DatamainMst.java)
at org.eclipse.persistence.internal.descriptors.PersistenceObjectAttributeAccessor.setAttributeValueInObject(PersistenceObjectAttributeAccessor.java:46)
at org.eclipse.persistence.mappings.DatabaseMapping.setAttributeValueInObject(DatabaseMapping.java:1367)
at org.eclipse.persistence.mappings.DatabaseMapping.readFromRowIntoObject(DatabaseMapping.java:1258)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildAttributesIntoObject(ObjectBuilder.java:331)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:660)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildWorkingCopyCloneNormally(ObjectBuilder.java:582)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObjectInUnitOfWork(ObjectBuilder.java:551)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:491)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:443)
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:2857)
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 com.nysc.setup.MobilizedEJB.findAll(MobilizedEJB.java:37)
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 org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1056)
at org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1128)
at com.sun.ejb.containers.BaseContainer.invokeBeanMethod(BaseContainer.java:5292)
at com.sun.ejb.EjbInvocation.invokeBeanMethod(EjbInvocation.java:615)
at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:797)
at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:567)
at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doAround(SystemInterceptorProxy.java:157)
at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.aroundInvoke(SystemInterceptorProxy.java:139)
at sun.reflect.GeneratedMethodAccessor100.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:858)
at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:797)
at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:367)
at com.sun.ejb.containers.BaseContainer.__intercept(BaseContainer.java:5264)
at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:5252)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:190)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:84)
at $Proxy139.findAll(Unknown Source)
at com.nysc.view.MobilizedMBean.populateLazyDatamain(MobilizedMBean.java:46)
at com.nysc.view.MobilizedMBean.access$000(MobilizedMBean.java:21)
at com.nysc.view.MobilizedMBean$1.load(MobilizedMBean.java:64)
at org.primefaces.component.datatable.DataTable.loadLazyData(DataTable.java:644)
at org.primefaces.component.datatable.DataHelper.decodePageRequest(DataHelper.java:53)
at org.primefaces.component.datatable.DataTableRenderer.decode(DataTableRenderer.java:47)
at javax.faces.component.UIComponentBase.decode(UIComponentBase.java:790)
at javax.faces.component.UIData.processDecodes(UIData.java:980)
at com.sun.faces.context.PartialViewContextImpl$PhaseAwareVisitCallback.visit(PartialViewContextImpl.java:472)
at com.sun.faces.component.visit.PartialVisitContext.invokeVisitCallback(PartialVisitContext.java:175)
at javax.faces.component.UIData.visitTree(UIData.java:1194)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1457)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1457)
at javax.faces.component.UIForm.visitTree(UIForm.java:324)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1457)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1457)
at com.sun.faces.context.PartialViewContextImpl.processComponents(PartialViewContextImpl.java:368)
at com.sun.faces.context.PartialViewContextImpl.processPartial(PartialViewContextImpl.java:246)
at javax.faces.context.PartialViewContextWrapper.processPartial(PartialViewContextWrapper.java:179)
at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:939)
at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:78)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:79)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:277)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
at java.lang.Thread.run(Thread.java:619)
WARNING: A system exception occurred during an invocation on EJB MobilizedEJB method public java.util.List com.nysc.setup.MobilizedEJB.findAll(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,int,int)
javax.ejb.EJBException
at com.sun.ejb.containers.BaseContainer.processSystemException(BaseContainer.java:5119)
at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:5017)
at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:4805)
at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:2004)
at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1955)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:198)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:84)
at $Proxy139.findAll(Unknown Source)
at com.nysc.view.MobilizedMBean.populateLazyDatamain(MobilizedMBean.java:46)
at com.nysc.view.MobilizedMBean.access$000(MobilizedMBean.java:21)
at com.nysc.view.MobilizedMBean$1.load(MobilizedMBean.java:64)
at org.primefaces.component.datatable.DataTable.loadLazyData(DataTable.java:644)
at org.primefaces.component.datatable.DataHelper.decodePageRequest(DataHelper.java:53)
at org.primefaces.component.datatable.DataTableRenderer.decode(DataTableRenderer.java:47)
at javax.faces.component.UIComponentBase.decode(UIComponentBase.java:790)
at javax.faces.component.UIData.processDecodes(UIData.java:980)
at com.sun.faces.context.PartialViewContextImpl$PhaseAwareVisitCallback.visit(PartialViewContextImpl.java:472)
at com.sun.faces.component.visit.PartialVisitContext.invokeVisitCallback(PartialVisitContext.java:175)
at javax.faces.component.UIData.visitTree(UIData.java:1194)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1457)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1457)
at javax.faces.component.UIForm.visitTree(UIForm.java:324)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1457)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1457)
at com.sun.faces.context.PartialViewContextImpl.processComponents(PartialViewContextImpl.java:368)
at com.sun.faces.context.PartialViewContextImpl.processPartial(PartialViewContextImpl.java:246)
at javax.faces.context.PartialViewContextWrapper.processPartial(PartialViewContextWrapper.java:179)
at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:939)
at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:78)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:79)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:277)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.NullPointerException
at nysc.entities.DatamainMst._persistence_set(DatamainMst.java)
at org.eclipse.persistence.internal.descriptors.PersistenceObjectAttributeAccessor.setAttributeValueInObject(PersistenceObjectAttributeAccessor.java:46)
at org.eclipse.persistence.mappings.DatabaseMapping.setAttributeValueInObject(DatabaseMapping.java:1367)
at org.eclipse.persistence.mappings.DatabaseMapping.readFromRowIntoObject(DatabaseMapping.java:1258)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildAttributesIntoObject(ObjectBuilder.java:331)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:660)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildWorkingCopyCloneNormally(ObjectBuilder.java:582)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObjectInUnitOfWork(ObjectBuilder.java:551)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:491)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:443)
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:2857)
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 com.nysc.setup.MobilizedEJB.findAll(MobilizedEJB.java:37)
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 org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1056)
at org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1128)
at com.sun.ejb.containers.BaseContainer.invokeBeanMethod(BaseContainer.java:5292)
at com.sun.ejb.EjbInvocation.invokeBeanMethod(EjbInvocation.java:615)
at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:797)
at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:567)
at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doAround(SystemInterceptorProxy.java:157)
at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.aroundInvoke(SystemInterceptorProxy.java:139)
at sun.reflect.GeneratedMethodAccessor100.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:858)
at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:797)
at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:367)
at com.sun.ejb.containers.BaseContainer.__intercept(BaseContainer.java:5264)
at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:5252)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:190)
... 55 more
i dont know what the problem is, it seems like an eclipse link problem?
what can i do?

Well look at the generated code and if you can fix it. The code generator might have a bug so it will be worth reporting it in the bugs database of the netbeans website.
But I would advise you to do the proper thing: don't generate code. Generate getters and setters, but don't let the entire entity be generated. Do the mappings yourself, determine for yourself where you need bi-directional mappings (hint: as little as possible). Make sure that you do EAGER and LAZY initialization in the proper places. Fine tune the nullable,insertable,updateable flags to help the ORM generate the most efficient (and correct) queries possible.
In other words take control, don't let the tool be in control.

Similar Messages

  • Help with JPA Inheritance Relationship Mapping

    Perhaps someone can help with this. I'm trying to figure out how to map what seems like a simple data model using JPA. But it is not working.
    @Entity
    public class Account {
        @OneToOne(cascade=CascadeType.ALL)
        private AbstractPaymentMethod paymentMethod;
    @Entity
    @MappedSuperClass
    @Inheritance(strategy=InheritanceType.SINGLE_TABLE)
    @DiscriminatorColumn(name="__CLASS__", discriminatorType=DiscriminatorType.STRING, length=20)
    @DiscriminatorValue("AbstractPaymentMethod")
    public abstract class AbstractPaymentMethod {
    @Entity
    @Table(name="payment_method")
    @Inheritance(strategy=InheritanceType.SINGLE_TABLE)
    @DiscriminatorColumn(name="__CLASS__", discriminatorType=DiscriminatorType.STRING, length=20)
    @DiscriminatorValue("CreditCardPaymentMethod")
    @SuppressWarnings("serial")
    @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
    public class CreditCardPaymentMethod extends AbstractPaymentMethod {
        @Column
        private String expirationDate;
    }The problem is, when I add a CreditCardPaymentMethod to an account like this...
    Account account = new Account();
    CreditCardPaymentMethod m = new CreditCardPaymentMethod();
    account.setPaymentMethod(m);
    em.persiste(account);... The entity manager attempts to save account.creditCardPaymentMethod as an AbstractPaymentMethod.
    Surely I'm doing something horribly wrong. Is there something I'm missing here?
    Thanks for any help.

    Thank you! You saved my life. After removing @MappedSuperClass, all is well.
    The entity manager is now saving my CreditCardPaymentMethod objects as CreditCardPaymentMethod classes instead of AbstractPaymentMethod classes.

  • Help with Null Pointer Exception

    Hi, I am working on a simple menu program. It compiles and works correctly except for one item. I am having a problem with Greying out a menu item...... Specifically, When I press the EDIT / OPTIONS / READONLY is supposed to Greyout the Save and SaveAs options. But, when I do that it displays a Null Pointer Exception error message in the command window.
    Your advice would be much appreciated!
    Now for the code
    /  FileName Menutest.java
    //  Sample Menu
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class MenuTest extends JFrame {
       private Action saveAction;
         private Action saveAsAction;
         private JCheckBoxMenuItem readOnlyItem;
       // set up GUI
       public MenuTest()
          super( "Menu Test" );
    //*   file menu and menu items
          // set up File menu and its menu items
          JMenu fileMenu = new JMenu( "File" );
          // set up New menu item
          JMenuItem newItem = fileMenu.add(new TestAction( "New" ));
          // set up Open menu item
          JMenuItem openItem = fileMenu.add(new TestAction( "Open" ));
              //  add seperator bar
              fileMenu.addSeparator();
          // set up Save menu item
          JMenuItem saveItem = fileMenu.add(new TestAction( "Save" ));
          // set up Save As menu item
          JMenuItem saveAsItem = fileMenu.add(new TestAction( "Save As" ));
              //  add seperator bar
              fileMenu.addSeparator();
              // set up Exit menu item
          JMenuItem exitItem = new JMenuItem( "Exit" );
          exitItem.setMnemonic( 'x' );
          fileMenu.add( exitItem );
          exitItem.addActionListener(
             new ActionListener() {  // anonymous inner class
                // terminate application when user clicks exitItem
                public void actionPerformed( ActionEvent event )
                   System.exit( 0 );
             }  // end anonymous inner class
          ); // end call to addActionListener
    //*   Edit menu and menu items
              // set up the Edit menu
              JMenu editMenu = new JMenu( "Edit" );
              //JMenuItem editMenu = new JMenu( "Edit" );
          // set up Cut menu item
          Action cutAction = new TestAction("Cut");
          cutAction.putValue(Action.SMALL_ICON, new ImageIcon("cut.gif"));
          // set up Copy menu item
          Action copyAction = new TestAction("Copy");
          copyAction.putValue(Action.SMALL_ICON, new ImageIcon("copy.gif") );
          // set up Paste menu item
          Action pasteAction = new TestAction("Paste");
          pasteAction.putValue(Action.SMALL_ICON, new ImageIcon("paste.gif") );
              editMenu.add(cutAction);
              editMenu.add(copyAction);
              editMenu.add(pasteAction);
          //  add seperator bar
              editMenu.addSeparator();
              // set up Options menu, and it submenus and items
              JMenu optionsMenu = new JMenu("Options");
              readOnlyItem = new JCheckBoxMenuItem("Read-only");
              readOnlyItem.addActionListener(
                   new ActionListener()
                   {  //  anonymous inner class
                        public void actionPerformed( ActionEvent event)
                          saveAction.setEnabled(!readOnlyItem.isSelected());
                          saveAsAction.setEnabled(!readOnlyItem.isSelected());
                }  // end anonymous inner class
              ); // end call to addActionListener
              optionsMenu.add(readOnlyItem);
              // add seperator bar
              optionsMenu.addSeparator();
              //  Work on Radio Buttons
              ButtonGroup textGroup = new ButtonGroup();
              JRadioButtonMenuItem insertItem = new JRadioButtonMenuItem("Insert");
              insertItem.setSelected(true);
              JRadioButtonMenuItem overTypeItem = new JRadioButtonMenuItem("Overtype");
              textGroup.add(insertItem);
              textGroup.add(overTypeItem);
              optionsMenu.add(insertItem);
              optionsMenu.add(overTypeItem);
              editMenu.add(optionsMenu);
    //*   Help menu and menu items
              // set up the Help menu
              JMenu helpMenu = new JMenu( "Help" );
              helpMenu.setMnemonic( 'H' );
          // set up index menu item
          JMenuItem indexItem = helpMenu.add(new TestAction( "Index" ));
          indexItem.setMnemonic( 'I' );
          helpMenu.add( indexItem );
              // set up About menu item
          JMenuItem aboutItem = new JMenuItem( "About" );
          aboutItem.setMnemonic( 'A' );
          helpMenu.add( aboutItem );
          aboutItem.addActionListener(
             new ActionListener() {  // anonymous inner class
                // display message dialog when user selects Open
                public void actionPerformed( ActionEvent event )
                   JOptionPane.showMessageDialog( MenuTest.this,
                      "This is MenuTest.java \nVersion 1.0 \nMarch 15, 2004",
                      "About", JOptionPane.PLAIN_MESSAGE );
             }  // end anonymous inner class
          ); // end call to addActionListener
          // create menu bar and attach it to MenuTest window
          JMenuBar bar = new JMenuBar();
          setJMenuBar( bar );
          bar.add( fileMenu );
              bar.add( editMenu );
              bar.add( helpMenu );
          setSize( 500, 200 );
          setVisible( true );
       } // end constructor
       public static void main( String args[] )
          MenuTest application = new MenuTest();
          application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
       // inner class to handle action events from menu items
       private class ItemHandler implements ActionListener {
          // process color and font selections
          public void actionPerformed( ActionEvent event )
           repaint();
          } // end method actionPerformed
       } // end class ItemHandler
       //  Prints to action name to System.out
      class TestAction extends AbstractAction
              public TestAction(String name) { super(name); }
          public void actionPerformed( ActionEvent event )
             System.out.println(getValue(Action.NAME) + " selected." );
       } // end class TestAction
    } // end class MenuTest

    alan, I've been trying to figure out a solution.
    You can initialize it like this
    private Action saveAction= new Action();
         private Action saveAsAction=new Action();
    THE ABOVE WILL NOT WORK.
    because Action is an interface. An interface does not have constructors. However, interface references are used for polymorphic purposes.
    Anyway, all you have to do is find some class that implemets Action interface.... I cant seem to find one. Or maybe this is not how its supposed to be done?
    Hopefully, someone can shed some light on this issue.
    FYI,
    http://java.sun.com/products/jfc/swingdoc-api-1.1/javax/swing/Action.html

  • Help with arrays and Exception in thread "main" java.lang.NullPointerExcept

    Hi, I have been having trouble all day getting this array sorted and put into a new array. I think it is something simple with my nested loops in sortCityArray() that is causing the problem. Any help would be greatly appreciated. The error is thrown on line 99 at Highway.sortCityArray(Highway.java:99)
    import java.util.Scanner;
    import java.io.*;
    import java.util.Arrays;
    public class Highway
    private String[] listOfCities=new String[200];
    private City[] cityArray=new City[200];
    private City[] sortedCityArray=new City[200];
    private String city="";
    private String city2="";
    private String fileName;
    private City x;
    private int milesToNextCity;
    private int milesAroundNextCity;
    private int speedToNextCity;
    public Highway(String filename)
    String fileName=filename;//"I-40cities.txt";
           File myFile = new File(fileName);
           try {
           Scanner scan=new Scanner(myFile);
           for(int i=0; scan.hasNextLine(); i++){
           String city=scan.nextLine();
           String city2=scan.nextLine();
           int milesToNextCity=scan.nextInt();
           int milesAroundNextCity=scan.nextInt();
           int speedToNextCity=scan.nextInt();
                   if(scan.hasNextLine()){
              scan.nextLine();
           cityArray=new City(city,city2,milesToNextCity,milesAroundNextCity,speedToNextCity);
    // System.out.println(cityArray[i].getCity());
    // System.out.println(cityArray[i].getNextCity());
    // System.out.println(cityArray[i].getLengthAB());
    // System.out.println(cityArray[i].getLengthAroundB());
    // System.out.println(cityArray[i].getSpeedAB());
    catch (Exception e) {
    System.out.println(e);
    //return cityArray;
    /*public City[] doCityArray(){
    File myFile = new File(fileName);
    try {
    Scanner scan=new Scanner(myFile);
    for(int i=0; scan.hasNextLine(); i++){
    String city=scan.nextLine();
    String city2=scan.nextLine();
    int milesToNextCity=scan.nextInt();
    int milesAroundNextCity=scan.nextInt();
    int speedToNextCity=scan.nextInt();
         if(scan.hasNextLine()){
              scan.nextLine();
    cityArray[i]=new City(city,city2,milesToNextCity,milesAroundNextCity,speedToNextCity);
    // System.out.println(cityArray[i].getCity());
    // System.out.println(cityArray[i].getNextCity());
    // System.out.println(cityArray[i].getLengthAB());
    // System.out.println(cityArray[i].getLengthAroundB());
    // System.out.println(cityArray[i].getSpeedAB());
    catch (Exception e) {
    System.out.println(e);
    return cityArray;
    public City[] sortCityArray(){
    sortedCityArray[0]=new City(cityArray[0].getCity(),cityArray[0].getNextCity(),cityArray[0].getLengthAB(),cityArray[0].getLengthAroundB(),cityArray[0].getSpeedAB());
    for(int j=0; j<cityArray.length; j++ )
         for(int i=0; i<cityArray.length ;i++)
              if(sortedCityArray[j].getNextCity().equals(cityArray[i].getCity())){
              sortedCityArray[j+1]=new City(cityArray[i].getCity(),cityArray[i].getNextCity(),cityArray[i].getLengthAB(),cityArray[i].getLengthAroundB(),cityArray[i].getSpeedAB());
              break;
    /*     for(int i=0; i<cityArray.length ;i++)
              if(sortedCityArray[j].getNextCity().equals(cityArray[i].getCity())){
              sortedCityArray[j+1]=new City(cityArray[i].getCity(),cityArray[i].getNextCity(),cityArray[i].getLengthAB(),cityArray[i].getLengthAroundB(),cityArray[i].getSpeedAB());
         break;
              for(int i=0; i<cityArray.length ;i++)
              if(sortedCityArray[j].getNextCity().equals(cityArray[i].getCity())){
              sortedCityArray[j+1]=new City(cityArray[i].getCity(),cityArray[i].getNextCity(),cityArray[i].getLengthAB(),cityArray[i].getLengthAroundB(),cityArray[i].getSpeedAB());
         break;
              for(int i=0; i<cityArray.length ;i++)
              if(sortedCityArray[j].getNextCity().equals(cityArray[i].getCity())){
              sortedCityArray[j+1]=new City(cityArray[i].getCity(),cityArray[i].getNextCity(),cityArray[i].getLengthAB(),cityArray[i].getLengthAroundB(),cityArray[i].getSpeedAB());
         break;
    //     j++;
    System.out.println(sortedCityArray[0].getCity());
    System.out.println(sortedCityArray[0].getNextCity());
    System.out.println(sortedCityArray[0].getLengthAB());
    System.out.println(sortedCityArray[0].getLengthAroundB());
    System.out.println(sortedCityArray[0].getSpeedAB());
    System.out.println(sortedCityArray[1].getCity());
    System.out.println(sortedCityArray[1].getNextCity());
    System.out.println(sortedCityArray[1].getLengthAB());
    System.out.println(sortedCityArray[1].getLengthAroundB());
    System.out.println(sortedCityArray[1].getSpeedAB());
    System.out.println(sortedCityArray[2].getCity());
    System.out.println(sortedCityArray[2].getNextCity());
    System.out.println(sortedCityArray[2].getLengthAB());
    System.out.println(sortedCityArray[2].getLengthAroundB());
    System.out.println(sortedCityArray[2].getSpeedAB());
    System.out.println(sortedCityArray[3].getCity());
    System.out.println(sortedCityArray[3].getNextCity());
    System.out.println(sortedCityArray[3].getLengthAB());
    System.out.println(sortedCityArray[3].getLengthAroundB());
    System.out.println(sortedCityArray[3].getSpeedAB());
    System.out.println(sortedCityArray[4].getCity());
    System.out.println(sortedCityArray[4].getNextCity());
    System.out.println(sortedCityArray[4].getLengthAB());
    System.out.println(sortedCityArray[4].getLengthAroundB());
    System.out.println(sortedCityArray[4].getSpeedAB());
    return cityArray;
    /*public String[] listOfCities(){
    File myFile = new File("I-40cities.txt");
    try {
    Scanner scan=new Scanner(myFile);
    for(int i=0; scan.hasNextLine(); i++){
         String city=scan.nextLine();
         city=city.trim();
    scan.nextLine();
    scan.nextLine();
         listOfCities[i]=city;
         System.out.println(listOfCities[i]);
    catch (Exception e) {
    System.out.println(e);
    return listOfCities;
    public static void main(String args[]) {
    Highway h = new Highway("out-of-order.txt");
    h.sortCityArray();

    the ouput is perfect according to the print lines if I use (increase the int where j is in the loop manually by one) :
         for(int i=0; i<cityArray.length ;i++)
              if(sortedCityArray[0].getNextCity().equals(cityArray.getCity())){
              sortedCityArray[0+1]=new City(cityArray[i].getCity(),cityArray[i].getNextCity(),cityArray[i].getLengthAB(),cityArray[i].getLengthAroundB(),cityArray[i].getSpeedAB());
              break;
         for(int i=0; i<cityArray.length ;i++)
              if(sortedCityArray[1].getNextCity().equals(cityArray[i].getCity())){
              sortedCityArray[1+1]=new City(cityArray[i].getCity(),cityArray[i].getNextCity(),cityArray[i].getLengthAB(),cityArray[i].getLengthAroundB(),cityArray[i].getSpeedAB());
         break;
              for(int i=0; i<cityArray.length ;i++)
              if(sortedCityArray[2].getNextCity().equals(cityArray[i].getCity())){
              sortedCityArray[2+1]=new City(cityArray[i].getCity(),cityArray[i].getNextCity(),cityArray[i].getLengthAB(),cityArray[i].getLengthAroundB(),cityArray[i].getSpeedAB());
         break;
              for(int i=0; i<cityArray.length ;i++)
              if(sortedCityArray[3].getNextCity().equals(cityArray[i].getCity())){
              sortedCityArray[3+1]=new City(cityArray[i].getCity(),cityArray[i].getNextCity(),cityArray[i].getLengthAB(),cityArray[i].getLengthAroundB(),cityArray[i].getSpeedAB());
         break;
    But I cant do this for 200 elements. Are the loops nested right?
    Edited by: modplan on Sep 22, 2008 6:49 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Help with Jar file exception

    I have been following the example of instruction at:
    http://forum.java.sun.com/thread.jsp?forum=31&thread=332680
    But I get an exception when I do the following.
    D:\pro>jar umf mf.txt myjar.class
    java.io.IOException: invalid header field
            at java.util.jar.Attributes.read(Attributes.java:359)
            at java.util.jar.Manifest.read(Manifest.java:162)
            at java.util.jar.Manifest.<init>(Manifest.java:52)
            at sun.tools.jar.Main.update(Main.java:487)
            at sun.tools.jar.Main.run(Main.java:167)
            at sun.tools.jar.Main.main(Main.java:904)Can somebody help me on this?
    Thanks I will really appreciate.

    I cannot execute the file, after I created, and then I add the mf intothe class, I double clicked but doesn't do anything.
    Should I run it with the java -jar myjar.jar?
    When I do it it throws me the following:
    D:\z>jar cf myjar.jar myjar.class
    D:\z>jar umf mf.txt myjar.class
    D:\z>java -jar myjar.jar
    Failed to load Main-Class manifest attribute from
    myjar.jar
    D:\chris\1\z>help please.

  • Help with JPA

    hi, hmmm i'm totally new to EJB, i must say JPA is confusing (at least for me), but "never give up, right?" , Ha!.
    ok, m reading an article now, nd we have these two classes
    @Entity
    public class Inventory {
    @Id
    @Column(name="ITEM_SKU", insertable=false, updatable=false)
    protected long id;
    @OneToOne
    @JoinColumn(name="ITEM_SKU")
    protected Item item;
    public void setItem(Item item) {
    this.item = item;
    this.id = item.getSKU();
    //////////// and
    @Entity
    public class Item {
    protected long SKU;
    @Id
    @GeneratedValue
    public long getSKU() {
    return SKU;
    i think i understand the annotation part, my question is this?
    1).does it mean the ITEM_SKU column in the inventory table will contain an object of Item entity or what?
    2).are both entities persistable? if yes, if you persisit an inventory entity, what will the ITEM_SKU column contain?.
    please, help and if u gat links to usefull material, please drop.
    thanks.

    Hi,
    You will have two tables in the DB named Inventory and Item.
    Inventory will have a column named ITEM_SKU. This is the primary key, and it's a foreign key to the second table Item. Item has a column named SKU.
    The entities are persistable, however if you try to persist the inventory without an Item (null instance variable) you will probably get an exception, because the primary key, or the foreign key constraint will fail.
    If it's not null, both objects will be persisted. So 2 records will be written into the database.

  • Need little help with JPA code and displaying database data into tables

    Hello Everyone,
    I am using java6 and Netbeans 6.1 on Windows XP platform.
    This is probably very simple but have'nt been able to figure it out yet. I am using the Travel Java Databse included in NB6 as a learning tool.
    I have a JComboBox connected to Person Table and want to display a Trip table from using the selected item from theJcombobox. In other words, Trip table shows only the Person selected from the Jcombobox.
    If someone could point me on the right direction how to code JPA code or how to use NB6 GUI to accomplish this.
    Thanks

    The w and wi are just table aliases that make it easier to
    referrence those tables by column when joining multiple tables
    (avoids having to prefix column names with the entire table name,
    etc.) When doing a self-join (joining a table to itself), the use
    of table aliases is
    required, otherwise you would have no other way to tell
    which column belonged to which "instance" of table.
    The query itself is pretty simple. It is just using a
    correlated subquery to select only those instances of
    workstationApps where the count of appID instances in
    workstationAppIndex is less than the amount specified in the
    maxConcurrentInstalls for the same appID.
    Also, I do see what you are doing with #form.searchType#, I
    was just making sure that it was what you really intended to do.
    Phil

  • Help with New NumberFormat Exception

    Hello. I'm new to java and I can't figure this out. I'm trying to prevent customers from entering a negative value for the quantity or price with a (quantity <= 0)New NumberFormat Exception but it's not working. The negative values are being calculated in the grand total giving impossible results. -$4.50 can't be. How can I fix this problem?
    Is this the right forum for my question? If its not, please move this away.
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.Date;
    import java.text.*;
    import java.text.DecimalFormat;
    public class BookOrderApplet extends Applet implements ActionListener
         //Declare variables.
         String Title, Author, answer;
         int quantity, numBooks, numTrans;
         double price, lastTot, subTotal, shipping, salesTax, total;
         //Create Date.
         Date currentDate = new Date();
         //Create Labels.
         Label dateLabel = new Label("" + currentDate);
         Label lblBookTitle = new Label("Book Title: ");
         Label lblAuthor = new Label("Author:");
         Label lblPrice = new Label("Price");
         Label lblQuantity = new Label("Quantity:");
         Label lblNumberOfLastTransactions = new Label("Number of Tansactions: 0");
         Label lblLastItemTotal = new Label("Last Item Total: 0");
         Label lblNumberOfBooks = new Label("Number of Books: 0");
         Label lblSubTotal = new Label("Subtotal: 0");
         Label lblSalesTax = new Label("Sales Tax: 0");
         Label lblShipping = new Label("Shipping: 0");
         Label lblOrderTotal = new Label("Order Total: 0");
         //Create TextFields.
         TextField txtTitle = new TextField(13);
         TextField txtAuthor = new TextField(13);
         TextField txtPrice = new TextField(20);
         TextField txtQuantity = new TextField(20);
         TextArea statusArea = new TextArea();
         //Create Buttons.
         Button calcButton = new Button("Calculate Total");
         Button resetButton = new Button("Reset Form");
         //Constructing the interface.
         public void init()
              //Add Labels.
              add(dateLabel);
              add(lblBookTitle);
              add(lblAuthor);
              add(lblQuantity);
              add(lblPrice);
              add(lblNumberOfLastTransactions);
              add(lblLastItemTotal);
              add(lblNumberOfBooks);
              add(lblSubTotal);
              add(lblSalesTax);
              add(lblShipping);
              add(lblOrderTotal);
              //Add Fields.
              add(txtTitle);
              add(txtAuthor);
              add(txtQuantity);
              add(txtPrice);
              //Add buttons.
              add(calcButton);
              add(resetButton);
              add(statusArea);
              setBackground(Color.white);
              statusArea.getPreferredSize();
              calcButton.addActionListener(this);
              resetButton.addActionListener(this);
         public void actionPerformed(ActionEvent e)
              if(e.getSource() == calcButton)
                   Title = txtTitle.getText();
                   Author = txtAuthor.getText();
                   quantity = getQuant();
                   price = getPrice();
                   transCount();
                   lastTot();
                   numBooks();
                   subTotal();
                   salesTax = salesTax();
                   shipping = shipping();
                   total = total();
                   answer = outFormat();
              else
              //resetButton should clear all the fields.
                        txtTitle.setText("");
                        txtAuthor.setText("");
                        txtQuantity.setText("");
                        txtPrice.setText("");
                        lblNumberOfLastTransactions.setText("Number of Tansactions: 0");
                        lblLastItemTotal.setText("Last Item Total: 0");
                        lblNumberOfBooks.setText("Number of Books: 0");
                        lblSubTotal.setText("Subtotal: 0");
                        lblSalesTax.setText("Sales Tax: 0");
                        lblShipping.setText("Shipping: 0");
                        lblOrderTotal.setText("Order Total: 0");
                        statusArea.setText("");
         //Prevent user from entering invalid quanity numbers.
         public int getQuant()
              try
                   quantity = Integer.parseInt(txtQuantity.getText());
                   if (quantity <= 0) throw new NumberFormatException();
              catch (NumberFormatException g)
                   statusArea.setText("Please enter a valid number for quantity.");
              return quantity;
         //Prevent user from entering invalid price numbers.
         public double getPrice()
              try
                    price = Double.parseDouble(txtPrice.getText());
                    if(price <= 0) throw new NumberFormatException();
              catch (NumberFormatException h)
                   statusArea.setText("Please enter a valid number for price.");
              return price;
         //Add up the number of transactions.
         public void transCount()
              numTrans = numTrans + 1;
              lblNumberOfLastTransactions.setText ("Number of Transactions: " + numTrans);
         //Previous Item Total.
         public void lastTot()
              DecimalFormat twoDigits = new DecimalFormat("#0.00");
              lblLastItemTotal.setText ("Last Item Total: $" + twoDigits.format(subTotal));
         //Add up the number of books.
         public void numBooks()
              numBooks = Integer.parseInt(txtQuantity.getText()) + numBooks;
              lblNumberOfBooks.setText ("Number of Books: " + numBooks);
         //Multiply price * quanity to get SubTotal.
         public void subTotal()
              DecimalFormat twoDigits = new DecimalFormat("#0.00");
              subTotal = price * quantity;
              lblSubTotal.setText("Subtotal: $" + twoDigits.format(subTotal));
         //Need to put a Sales Tax value later.
         public double salesTax()
              lblSalesTax.setText("Sales Tax: " + salesTax);
              return 0;
         //Shipping Total
         public double shipping()
              if (subTotal >= 50)
                   lblShipping.setText("Shipping: FREE!");
                   return 0;
              else
                   shipping = numBooks * 2;
                   lblShipping.setText("Shipping: " + shipping);
              return shipping;
         //GrandTotal
         public double total()
              DecimalFormat twoDigits = new DecimalFormat("#0.00");
              total = subTotal + shipping + salesTax;
              lblOrderTotal.setText("Order Total: $" + twoDigits.format(total));
              return total;
         //Put everything together.
         public String outFormat()
              DecimalFormat twoDigits = new DecimalFormat("#0.00");
              String answer = "You ordered: " + Title + " by " +  Author + "." + "     You purchased: " + quantity + " copies for $" + twoDigits.format(price) + " per item." + "    The Grand Total comes to: $" + twoDigits.format(total) ;
              statusArea.append("\n");
              statusArea.append(answer);
              return answer;
    }

    I suggest changing your code slightly. In the actionPerformed() method when you are calling other methods to parse the input, use a try/catch block around those methods. Something like thispublic void actionPerformed(ActionEvent e) {
              if(e.getSource() == calcButton) {
                   try {
                        Title = txtTitle.getText();
                        Author = txtAuthor.getText();
                        quantity = getQuant();
                        price = getPrice();
                        transCount();
                        lastTot();
                        numBooks();
                        subTotal();
                        salesTax = salesTax();
                        shipping = shipping();
                        total = total();
                        answer = outFormat();
                   } catch(NumberFormatException ne) {
              } else {
                   //resetButton should clear all the fields.
         }Then, inside the methods that parse the data, change the code so the exception is thrown to the caller, something like this     //Prevent user from entering invalid quanity numbers.
         public int getQuant() {
              boolean error = false;
              try {
                   quantity = Integer.parseInt(txtQuantity.getText());
              } catch(NumberFormatException ne) {
                   error = true;
              error = error | quantity <= 0;
              if (error) {
                   statusArea.setText("Please enter a valid number for quantity.");
                   throw new NumberFormatException();
              return quantity;
         }This allows the error to cause the program to skip calculating.
    I also think you have a logic problem with how you are calculating shipping.

  • Help with:   java.sql.SQLIntegrityConstraintViolationException

    Hi, guys
    I need help with the following exception: java.sql.SQLIntegrityConstraintViolationException: The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by 'SQL090403155751200' defined on 'BOOK_ORDER'.
    the things is my primary key is unique, so i checked the indexes and i found that i have two 'SQL090403155751200' indexes.
    I would like to know:
    1. can i delete the index without causing further database problems
    2. what causes this problem and how can i avoid it.
    By the way im using netbeans 6.5 and derby database

    rizza_99 wrote:
    I would like to know:
    1. can i delete the index without causing further database problems
    2. what causes this problem and how can i avoid it.
    By understanding what the application/system is supposed to be doing and the correctly creating indexes on the database that reflect the business needs.
    Once you do that then the nature of the indexes that are needed are obvious.
    You certainly don't delete indexes without that understanding however.

  • Help with: oracle.toplink.essentials.exceptions.ValidationException

    hi guys,
    I really need ur help with this.
    I have a remote session bean that retrieves a list of books from the database using entity class and I call the session bean from a web service. The problem is that when i display the books in a jsp directly from the session bean everything works ok but the problem comes when I call the session bean via the web service than it throws this:
    Exception Description: An attempt was made to traverse a relationship using indirection that had a null Session. This often occurs when an entity with an uninstantiated LAZY relationship is serialized and that lazy relationship is traversed after serialization. To avoid this issue, instantiate the LAZY relationship prior to serialization.
    at oracle.toplink.essentials.exceptions.ValidationException.instantiatingValueholderWithNullSession(ValidationException.java:887)
    at oracle.toplink.essentials.internal.indirection.UnitOfWorkValueHolder.instantiate(UnitOfWorkValueHolder.java:233)
    at oracle.toplink.essentials.internal.indirection.DatabaseValueHolder.getValue(DatabaseValueHolder.java:105)
    at oracle.toplink.essentials.indirection.IndirectList.buildDelegate(IndirectList.java:208)
    at oracle.toplink.essentials.indirection.IndirectList.getDelegate(IndirectList.java:330)
    at oracle.toplink.essentials.indirection.IndirectList$1.<init>(IndirectList.java:425)
    at oracle.toplink.essentials.indirection.IndirectList.iterator(IndirectList.java:424)
    at com.sun.xml.bind.v2.runtime.reflect.Lister$CollectionLister.iterator(Lister.java:278)
    at com.sun.xml.bind.v2.runtime.reflect.Lister$CollectionLister.iterator(Lister.java:265)
    at com.sun.xml.bind.v2.runtime.property.ArrayElementProperty.serializeListBody(ArrayElementProperty.java:129)
    at com.sun.xml.bind.v2.runtime.property.ArrayERProperty.serializeBody(ArrayERProperty.java:152)
    at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:322)
    at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:681)
    at com.sun.xml.bind.v2.runtime.property.ArrayElementNodeProperty.serializeItem(ArrayElementNodeProperty.java:65)
    at com.sun.xml.bind.v2.runtime.property.ArrayElementProperty.serializeListBody(ArrayElementProperty.java:168)
    at com.sun.xml.bind.v2.runtime.property.ArrayERProperty.serializeBody(ArrayERProperty.java:152)
    at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:322)
    at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:681)
    at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:277)
    at com.sun.xml.bind.v2.runtime.BridgeImpl.marshal(BridgeImpl.java:100)
    at com.sun.xml.bind.api.Bridge.marshal(Bridge.java:141)
    at com.sun.xml.ws.message.jaxb.JAXBMessage.writePayloadTo(JAXBMessage.java:315)
    at com.sun.xml.ws.message.AbstractMessageImpl.writeTo(AbstractMessageImpl.java:142)
    at com.sun.xml.ws.encoding.StreamSOAPCodec.encode(StreamSOAPCodec.java:108)
    at com.sun.xml.ws.encoding.SOAPBindingCodec.encode(SOAPBindingCodec.java:258)
    at com.sun.xml.ws.transport.http.HttpAdapter.encodePacket(HttpAdapter.java:320)
    at com.sun.xml.ws.transport.http.HttpAdapter.access$100(HttpAdapter.java:93)
    at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:454)
    at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:244)
    at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:135)
    at com.sun.enterprise.webservice.JAXWSServlet.doPost(JAXWSServlet.java:176)
    ... 29 more
    This happens when I test the web service using netbeans 6.5.
    here's my code:
    session bean:
    ArrayList bookList = null;
    public ArrayList retrieveBooks()
    try
    List list = em.createNamedQuery("Book.findAll").getResultList();
    bookList = new ArrayList(list);
    catch (Exception e)
    e.getCause();
    return bookList;
    web service:
    @WebMethod(operationName = "retrieveBooks")
    public Book[] retrieveBooks()
    ArrayList list = ejbUB.retrieveBooks();
    int size = list.size();
    Book[] bookList = new Book[size];
    Iterator it = list.iterator();
    int i = 0;
    while (it.hasNext())
    Book book = (Book) it.next();
    bookList[i] = book;
    i++;
    return bookList;
    Please help guys, it's very urgent

    Yes i have a relationship but i didnt want it to be directly. Maybe this is a design problem but in my case I dont expect any criminals to be involved in lawsuit. My tables are like that:
    CREATE TABLE IF NOT EXISTS Criminal(
         criminal_id INTEGER NOT NULL AUTO_INCREMENT,
         gender varchar(1),
         name varchar(25) NOT NULL,
         last_address varchar(100),
         birth_date date,
         hair_color varchar(10),
         eye_color varchar(10),
         weight INTEGER,
         height INTEGER,
         PRIMARY KEY (criminal_id)
    ENGINE=INNODB;
    CREATE TABLE IF NOT EXISTS Lawsuit(
         lawsuit_id INTEGER NOT NULL AUTO_INCREMENT,
         courtName varchar(25),
         PRIMARY KEY (lawsuit_id),
         FOREIGN KEY (courtName) REFERENCES Court_of_Law(courtName) ON DELETE NO ACTION
    ENGINE=INNODB;
    CREATE TABLE IF NOT EXISTS Rstands_trial(
         criminal_id INTEGER,
         lawsuit_id INTEGER,
         PRIMARY KEY (criminal_id, lawsuit_id),
         FOREIGN KEY (criminal_id) REFERENCES Criminal(criminal_id) ON DELETE NO ACTION,
         FOREIGN KEY (lawsuit_id) REFERENCES Lawsuit(lawsuit_id) ON DELETE CASCADE
    ENGINE=INNODB;So I couldnt get it.

  • Need help with error: XML parser failed: Error An exception occurred! Type:......

    <p>Need help with the following error.....what does it mean....</p><p>28943 3086739136 XML-240304 3/7/07 7:13:23 PM |SessionNew_Job1<br /><font color="#ff0000">28943 3086739136 XML-240304 3/7/07 7:13:23 PM XML parser failed: Error <An exception occurred! Type:UnexpectedEOFException, Message:The end of input was not expected> at</font><br />28943 3086739136 XML-240304 3/7/07 7:13:23 PM line <7>, char <8> in <<?xml version="1.0" encoding="WINDOWS-1252" ?><br />28943 3086739136 XML-240304 3/7/07 7:13:23 PM <DSConfigurations><br />28943 3086739136 XML-240304 3/7/07 7:13:23 PM <DSConfiguration default="true" name="Configuration1"><br />28943 3086739136 XML-240304 3/7/07 7:13:23 PM <case_sensitive>no</case_sensitive><br />28943 3086739136 XML-240304 3/7/07 7:13:23 PM <database_type>Oracle</database_type><br />28943 3086739136 XML-240304 3/7/07 7:13:23 PM <db_alias_name1>ODS_OWNER</db_alias_name1><br />28943 3086739136 XML-240304 3/7/07 7:13:23 PM <db_ali>, file <>.<br />28943 3086739136 XML-240307 3/7/07 7:13:23 PM |SessionNew_Job1<br />28943 3086739136 XML-240307 3/7/07 7:13:23 PM XML parser failed: See previously displayed error message.</p><p>Any help would be greatly appreciated.  It&#39;s something to do with my datasource and possibly the codepage but I&#39;m really not sure.</p><p>-m<br /></p>

    please export your datastore as ATL and send it to support. Somehow the internal language around configurations got corrupted - never seen before.

  • JCO Runtime error with JPAAS

    Hi,
    I am currently facing the following issue while using JCO 3
    I use the same code in stand alone java project i can connect to the system using JCO and get the results but the same when i try to use it with JPAAS inside a web application i get the following error.
    Can anyone help me out on what could be the problem?
    here is the stack trace
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    java.lang.RuntimeException: org.apache.cxf.interceptor.Fault: Could not initialize class com.sap.conn.jco.rt.JCoRuntimeFactory
         org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:107)
         org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:323)
         org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:118)
         org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:208)
         org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:223)
         org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:166)
         org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:113)
         org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:184)
         org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:112)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
         org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:163)
    root cause
    org.apache.cxf.interceptor.Fault: Could not initialize class com.sap.conn.jco.rt.JCoRuntimeFactory
         org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:155)
         org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:121)
         org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:162)
         org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:89)
         org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
         java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
         java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
         java.util.concurrent.FutureTask.run(FutureTask.java:138)
         org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
         org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:106)
         org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
         org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:118)
         org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:208)
         org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:223)
         org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:166)
         org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:113)
         org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:184)
         org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:112)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
         org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:163)
    root cause
    java.lang.NoClassDefFoundError: Could not initialize class com.sap.conn.jco.rt.JCoRuntimeFactory
         com.sap.conn.jco.rt.RuntimeEnvironment.<init>(RuntimeEnvironment.java:43)
         sun.reflect.GeneratedConstructorAccessor14.newInstance(Unknown Source)
         sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
         java.lang.reflect.Constructor.newInstance(Constructor.java:513)
         java.lang.Class.newInstance0(Class.java:355)
         java.lang.Class.newInstance(Class.java:308)
         com.sap.conn.jco.ext.Environment.getInstance(Environment.java:155)
         com.sap.conn.jco.ext.Environment.isDestinationDataProviderRegistered(Environment.java:401)
         com.sap.did.integration.direct.ABAP_System_Connect.<init>(ABAP_System_Connect.java:43)
         com.sap.did.services.impl.IntegrationServiceImpl.getOpenInvoices(IntegrationServiceImpl.java:37)
         com.sap.did.rest.impl.VendorsImpl.getVendorInvoices(VendorsImpl.java:61)
         sun.reflect.GeneratedMethodAccessor25.invoke(Unknown Source)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         java.lang.reflect.Method.invoke(Method.java:597)
         org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:173)
         org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:89)
         org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:162)
         org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:89)
         org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
         java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
         java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
         java.util.concurrent.FutureTask.run(FutureTask.java:138)
         org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
         org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:106)
         org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
         org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:118)
         org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:208)
         org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:223)
         org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:166)
         org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:113)
         org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:184)
         org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:112)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
         org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:163)
    note The full stack trace of the root cause is available in the SAP logs.
    Both the jar file and the dll file are present in the war file and still i get this error.
    Regards,
    Suhas

    I am experiencing exactly the same problems on one of two identical machines after something happened in the registry.
    The first problem that appered was an error 1325 "Favorites is not a valid short name".
    I did find the registry key involved (%userprofile%\Favorites) and fixed it.
    So now the the next one: yours.
    I think the solution can be found in the list of registry keys that Adobe Reader is accessing.
    btw Eusing registry cleaner did not find this key to be in error.
    Problem is that the Reader does not ask for an alternative location after stumbling on the key.
    Who can gnerate a list of keys accessed?

  • Help with HP Laser Printer 1200se

    HP Support Line,
    Really need your assistance.  I have tried both contacting HP by phone (told they no longer support our printer via phone help), the tech told me that I needed to contact HP by e-mail for assistance.   I then sent an e-mail for assistance and got that reply today, the reply is as follows  "Randall, unfortunately, HP does not offer support via e-mail for your product.  However many resources are available on the HP web site that may provide the answer to your inquiry.  Support is also available via telephone.  A list of technical support numbers can be round at the following URL........."  The phone numbers listed are the ones I called and the ones that told me I needed to contact the e-mail support for help.
    So here I am looking for your help with my issue.
    We just bought a new HP Pavillion Slimline Desk Top PC (as our 6 year old HP Pavillion PC died on us).  We have 2 HP printers, one (an all-in-one type printer, used maily for copying and printing color, when needed) is connected and it is working fine with the exception of the scanning option (not supported by Windows 7).  However we use our Laser Printer for all of our regular prining needs.  This is the HP LaserPrinter 1200se, which is about 6 years old but works really well.  For this printer we currently only have a parallel connection type cord and there is not a parallel port on the Slimline HP PC.  The printer also has the option to connedt a USB cable (we do not currently have this type of cable).
    We posed the following two questions:
    1.  Is the Laser Jet 1200se compatible with Windows 7?
    and if this is the case
    2.  Can we purchase either a) a USC connection cord (generic or do we need a printer specific cord)? or b) is there there a printer cable converter adapater to attach to our parallel cable to convert to a USB connection?
    We do not want to purchase the USB cable if Windows 7 will not accept the connection, or if doing this will harm the PC.
    We really would appreciate any assitance that you might give us.
    Thank you,
    Randy and Leslie Gibson

    Sorry, both cannot be enabled by design.  That said, devices on a network do not care how others are connected.  You can print from a wireless connection to a wired (Ethernet) printer and v/v.
    Say thanks by clicking "Kudos" "thumbs up" in the post that helped you.
    I am employed by HP

  • WRT310N: Help with DMZ/settings (firmware 1.0.09) for wired connection

    Hello. I have a WRT310N and have been having a somewhat difficult time with my xbox 360's connection. I have forwarded all the necessary ports (53, 80, 88, 3074) for it to run, and tried changing MTU and what-not.
    I don't know if I have DMZ setup incorrectly, or if it's my settings.
    Setup as follows:
    PCX2200 modem connected via ethernet to WRT310N. 
    The WRT310N has into ethernet port 1 a WAP54G, and then upstairs (so that my Mother's computer can get a strong signal) I have another WAP54G that I believe receives its signal from the downstairs 54G. 
    In the back of the WRT310N, I have my computer connected via ethernet port 3, and my Xbox 360 connected via ethernet port 4.
    Now, I first figured I just have so many connections tied to the router and that is the reason for being so slow. However, when I unplug all the other ethernet cords and nothing is connected wirelessly, except for my Xbox connected to ethernet port 4, it is still poor. Also, with everything connected (WAP54G and other devices wirelessly) I get on my PC and run a speedtest.  For the sake of advice, my speedtests I am running on my PC are (after 5 tests) averagely 8.5 Mbps download, and 1.00 Mbps upload, with a ping of  82ms.
    Here is an image of the results:
    http://www.speedtest.net][IMG]http://www.speedtest.net/result/721106714.png
    Let me add a little more detail of my (192.168.1.1) settings for WRT310N.
    For starters, my Father's IT guy at his workplace set up this WRT310N and WAP54G's. So some of these settings may be his doing. I just don't know which.
    "Setup" as Auto-configurations DHCP. I've added my Xbox's IP address to the DHCP reservation the IP of 192.168.1.104. This has (from what I've noticed) stayed the same for days.
    MTU: Auto, which stays at 1500 when I check under status.
    Advanced Routing: NAT routing enabled, Dynamic Routing disabled. 
    Security: Disabled SPI firewall, UNchecked these: Filter Anonymous Internet Requests, Multicast, and Internet NAT redirection.
    VPN passthrough: All 3 options are enabled (IPSec, PPTP, L2TP)
    Access Restrictions: None.
    Applications and Gaming: Single port forwarding has no entries. Port Range Forwarding I have the ports 53 UDP/TCP, 88 UDP, 3074 UDP/TCP, and 80 TCP forwarded to IP 192.168.1.104 enabled. (192.168.1.104 is the IP for my xbox connected via ethernet wired that is in DHCP reserved list)
    Port Range Triggering: It does not allow me to change anything in this page.
    DMZ: I have it Enabled. This is where I am a bit confused. It says "Source IP Address" and it has me select either "Any IP address" or to put entries to the XXX.XXX.XXX.XXX to XXX fields. I have selected use any IP address. Then the source IP area, it says "Destination:"  I can do either "IP address: 192.168.1.XXX" or "MAC address:" Also, under MAC Address, it says DHCP Client Table and I went there and saw my Xbox under the DHCP client list (It shows up only when the Xbox is on) and selected it.  
    Under QoS: WMM Enabled, No acknowledgement disabled.
    Internet Access Priority: Enabled. Upstream Bandwith I set it to Manual and put 6000 Kbps. I had it set on Auto before, but I changed it. I have no idea what to put there so I just put a higher number. 
    Then I added for Internet Access Priority a Medium Priority for Ethernet Port 4 (the port my xbox is plugged into).
    Administration: Management: Web utility access: I have checked HTTP, unchecked HTTPS.
    Web utility access via Wireless: Enabled. Remote Access: Disabled.
    UPnp: Enabled.
    Allow Users to Configure: Enabled.
    Allow users to Disable Internet Access: Enabled.
    Under Diagnostics, when I try and Ping test 192.168.1.104 (xbox when on and connected to LIVE), I get:
    PING 192.168.1.104 (192.168.1.104): 24 data bytes
    Request timed out.
    Request timed out.
    Request timed out.
    Request timed out.
    Request timed out.
    --- 192.168.1.104 data statistics ---
    5 Packets transmitted, 0 Packets received, 100% Packet loss
    Also, when I do Traceroute Test for my Xbox's IP, I just keep getting: 
    traceroute to 192.168.1.104 (192.168.1.104), 30 hops max, 40 byte packets
    1 * * * 192.168.1.1 Request timed out.
    2 * * * 192.168.1.1 Request timed out.
     As for the Wireless Settings, it is all on the default settings with Wi-Fi Protected setup Enabled.
    To add, I have tried connecting my modem directly to the Xbox and my connection is much improved. I have no difficulty getting the NAT open, for it seems my settings are working for that. Any help with these settings would be VERY much appreciated. 
    Message Edited by CroftBond on 02-18-2010 01:09 PM

    I own 2 of these routers (one is a spare) with the latest firmware and I have been having trouble with them for over a year.  In my case the connection speed goes to a crawl and the only way to get it back is to disable the SPI firewall.  Rebooting helps for a few minutes, but the problem returns.  All of the other fixes recommended on these forums did not help.  I found out the hard way that disabling the SPI Firewall also closes all open ports ignoring your port forwarding settings.  If you have SPI Firewall disabled, you will never be able to ping your IP from an external address.  Turn your SPI Firewall back on and test your Ping. 
    John

  • Help with if statement for a beginner.

    Hello, I’m new to the dev lark and wondered if someone could point me in the right direction.
    I have the following (working!) app that lets users press a few buttons instead of typing console commands (please do not be too critical of it, it’s my first work prog).
    //DBS File send and Receive app 1.0
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import javax.swing.*;
    import java.awt.BorderLayout;
    import java.awt.FlowLayout;
    import java.awt.Font;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.JButton;
    import javax.swing.JCheckBox;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JTextArea;
    import java.applet.Applet;
    public class Buttons extends JFrame
         public Buttons()
              super("DBS 2");          
              JTextArea myText = new JTextArea   ("Welcome to the DBS application." +
                                                           "\n" +
                                                           "\n\n1. If you have received an email informing you that the DBS is ready to dowload please press the \"Receive DBS\" button." +
                                                           "\n" +
                                                           "\n1. Once this has been Received successfully please press the \"Prep File\" button." +
                                                           "\n\n2. Once the files have been moved to their appropriate locations, please do the \"Load\" into PAS." +
                                                           "\n\n3. Once the \"Load\" is complete, do the \"Extract\"." +
                                                           "\n\n4. When the \"Extract\" has taken place please press the \"File Shuffle\" button." +
                                                           "\n\n5. When the files have been shuffled, please press the \"Send DBS\" Button." +
                                                           "\n\nJob done." +
                                                           "\n", 20,50);
              JPanel holdAll = new JPanel();
              JPanel topPanel = new JPanel();
              JPanel bottomPanel = new JPanel();
              JPanel middle1 = new JPanel();
              JPanel middle2 = new JPanel();
              JPanel middle3 = new JPanel();
              topPanel.setLayout(new FlowLayout());
              middle1.setLayout(new FlowLayout());
              middle2.setLayout(new FlowLayout());
              middle3.setLayout(new FlowLayout());
              bottomPanel.setLayout(new FlowLayout());
              myText.setBackground(new java.awt.Color(0, 0, 0));     
              myText.setForeground(new java.awt.Color(255,255,255));
              myText.setFont(new java.awt.Font("Times",0, 16));
              myText.setLineWrap(true);
              myText.setWrapStyleWord(true);
              holdAll.setLayout(new BorderLayout());
              topPanel.setBackground(new java.awt.Color(153, 101, 52));
              bottomPanel.setForeground(new java.awt.Color(153, 0, 52));
              holdAll.add(topPanel, BorderLayout.CENTER);
              topPanel.add(myText, BorderLayout.NORTH);
              setSize(700, 600);
              setDefaultCloseOperation(EXIT_ON_CLOSE);
              getContentPane().add(holdAll, BorderLayout.CENTER);
              Container c = getContentPane();
              c.setLayout(new FlowLayout());
              final JButton receiveDBS = new JButton("Receive DBS"); //marked as final as it is called in an Inner Class later
              final JButton filePrep = new JButton("Prep File");
              final JButton fileShuffle = new JButton("File Shuffle");
              final JButton sendDBS = new JButton("Send DBS");
              JButton exitButton = new JButton("Exit");
    //          JLabel statusbar = new JLabel("Text here");
              receiveDBS.setFont(new java.awt.Font("Arial", 0, 25));
              filePrep.setFont(new java.awt.Font("Arial", 0, 25));
              fileShuffle.setFont(new java.awt.Font("Arial", 0, 25));
              sendDBS.setFont(new java.awt.Font("Arial", 0, 25));
              exitButton.setBorderPainted ( false );
              exitButton.setMargin( new Insets ( 10, 10, 10, 10 ));
              exitButton.setToolTipText( "EXIT Button" );
              exitButton.setFont(new java.awt.Font("Arial", 0, 20));
              exitButton.setEnabled(true);  //Set to (false) to disable
              exitButton.setForeground(new java.awt.Color(0, 0, 0));
              exitButton.setHorizontalTextPosition(SwingConstants.CENTER); //Don't know what this does
              exitButton.setBounds(10, 30, 90, 50); //Don't know what this does
              exitButton.setBackground(new java.awt.Color(153, 101, 52));     
              topPanel.add(receiveDBS);
              middle1.add(filePrep);
              middle2.add(exitButton);
              middle3.add(fileShuffle);
              bottomPanel.add(sendDBS);
              receiveDBS.addActionListener(new ActionListener()
                   public void actionPerformed(ActionEvent ae)
                        if (ae.getSource() == receiveDBS);
                        try
                             Runtime.getRuntime().exec("cmd.exe /c start c:\\DBS\\ReceiveDBSfile.bat");
                        catch(Exception e)
                             System.out.println(e.toString());
                             e.printStackTrace();
              filePrep.addActionListener(new ActionListener()
                   public void actionPerformed(ActionEvent ae)
                        if (ae.getSource() == filePrep);
                        try
                             Runtime.getRuntime().exec("cmd.exe /c start c:\\DBS\\filePrep.bat");
                        catch(Exception e)
                             System.out.println(e.toString());
                             e.printStackTrace();
              exitButton.addActionListener(new ActionListener()
                   public void actionPerformed(ActionEvent ae)
                        System.exit(0);
              fileShuffle.addActionListener(new ActionListener()
                   public void actionPerformed(ActionEvent ae)
                        if (ae.getSource() == fileShuffle);
                        try
                             Runtime.getRuntime().exec("cmd.exe /c start c:\\DBS\\fileShuffle.bat");
                        catch(Exception e)
                             System.out.println(e.toString());
                             e.printStackTrace();
              sendDBS.addActionListener(new ActionListener()
                   public void actionPerformed(ActionEvent ae)
                        if (ae.getSource() == sendDBS);
                        try
                             Runtime.getRuntime().exec("cmd.exe /c start c:\\DBS\\sendDBSFile.bat");
                        catch(Exception e)
                             System.out.println(e.toString());
                             e.printStackTrace();
              c.add(receiveDBS);
              c.add(filePrep);
              c.add(fileShuffle);
              c.add(sendDBS);
              c.add(exitButton);
    //          c.add(statusbar);
         public static void main(String args[])
              Buttons xyz = new Buttons();
              xyz.setVisible(true);
         }What I would like help with is the following…
    I would like output to either a JLabel or JTextArea to appear if a file appears on the network. Something along these lines…
    If file named nststrace*.* is in \\[network path] then output “Download successful, please proceed.”
    btw I have done my best to search this forum for something similar and had no luck, but I am looking forward to Encephalopathic’s answer as he/she has consistently made me laugh with posted responses (in a good way).
    Thanks in advance, Paul.

    Hospital_Apps_Monkey wrote:
    we're starting to get aquainted, but I think "best friend" could take a while as it is still as hard going as I recall, but I will persevere.Heh, it's not so bad! For example, if I had no idea how to test whether a file exists, I would just scan the big list of classes on the left for names that sound like they might include File operations. Hey look, File! Then I'd look at all of File's methods for something that tests whether it exists or not. Hey, exists! Then if I still couldn't figure out how to use it, I'd do a google search on that particular method.

Maybe you are looking for

  • [SOLVED] I need a simple way to start/stop a virtualbox vm

    Hi,   I need a very simple way to start a headless virtualbox vm on login, and cleanly save its state on system shutdown/reboot. I can't use solutions like vboxtool because my home directory is encrypted and only available after I login.   I have wri

  • The APP STORE app on the iPhone 4S not working correctly for UPDATES now.

    It used to be, when I had APPS that needed to be updated, I would see a badge on the APP STORE icon with the number of apps that needed to be updated. Then I could tap on the icon for the APP STORE, and I would see the UPDATE button showing the badge

  • HP 4535s NEW CPU

    Hello, I need help .. I want to upgrade my notebook HP 4535s (E2-3000m, 8GB, 500GB HDD, Windows 7 x64),  but i'm not sure which cpu should i buy http://www.ebay.com/itm/AMD-laptop-processor-APU-QUAD-CORE-A10-4600M-2-3Ghz-Socket-FS1-FS1r2-TURBO-3... o

  • Selecting the best live video production set up!

    I am currently an art director but have worked with television and video depts. in the past. I have been asked to head up a new dept. at my church. I am looking for the best set-up for doing live video to record and do all the media, lighting, projec

  • Where does Network Manager get its "secrets?"

    I am experimenting with PEAP authentication on a wireless network via Network Manager, and in the NM logs (journalctl -u NetworkManager), I keep seeing a line like this one: Sep 11 10:56:26 anchor NetworkManager[1300]: <info> Activation (wlp2s0/wirel