32位java上的StackOverflowException - 不是64位

时间:2014-04-09 13:04:32

标签: java serialization jvm 32bit-64bit stack-overflow

我编写了一个基于JavaFX的桌面应用程序,它是在NetBeans 7.4上开发的。我正在使用Glassfish来汇集jdbc连接和JMS流量。开发是在Win 7 64位系统上,使用64位java 1.7_51。我的一个用户有一台32位win 7机器,应用程序拒绝在他的机器上正确运行。实际上有2个glassfish服务器,每个服务器都提供来自不同逻辑公司的数据连接。两个glassfish服务器上的所有服务器代码都是使用相同的代码库构建的。在32位java上运行的应用程序在从一个服务器而不是另一个服务器读取数据时会得到StackOverflowException,所以我认为它与服务器的部署有某种关系。当我什么也找不到的时候,然后我将数据序列化为一个文件,当从文件中读取数据时,同一个数据集给我溢出。同样,这只是在32位版本的java中。我使用32位java jdk重建了应用程序,错误仍然存​​在。在64位java jvm上运行32位jar没有问题。 尝试从数据库读取时的堆栈跟踪:

2014-04-08 15:19:52,820 [INFO  PricingPresenter] - Entering com.lamtec.pricingcl
ient.PricingPresenter.displayLamtecProducts.
2014-04-08 15:19:52,824 [INFO  PricingPresenter] - Entering com.lamtec.pricingcl
ient.PricingPresenter.clearTables.
2014-04-08 15:19:52,828 [INFO  PricingPresenter] - Entering com.lamtec.pricingcl
ient.PricingPresenter.init.
2014-04-08 15:19:52,832 [INFO  PricingPresenter] - Properties:  {org.omg.CORBA.O
RBInitialHost=10.20.10.207, MessageTypeLoader=COM.LAMTEC.SHIPPING.UPDATE_LOADER,
 org.omg.CORBA.ORBInitialPort=3700, EnableProductDevelopment=true, RunAtCustom=f
alse, MessageTypeShipper=COM.LAMTEC.SHIPPING.UPDATE_SHIPPER, LamtecServer=http:/
/enterprise:8080/LamtecServer, CustomServer=http://resolute:8080/LamtecServer, P
roductDevelopmentServer=http://resolute:56156/ProductDevelopmentServer}.
2014-04-08 15:19:52,835 [INFO  PricingPresenter] - Entering com.lamtec.pricingcl
ient.PricingPresenter.getProductList
2014-04-08 15:19:52,839 [INFO  PricingPresenter] - Entering com.lamtec.pricingcl
ient.PricingPresenter.getAdhesiveList
2014-04-08 15:19:52,843 [INFO  PricingPresenter] - Entering com.lamtec.pricingcl
ient.PricingPresenter.getChemicalList
2014-04-08 15:19:52,850 [INFO  PricingPresenter] - Entering com.lamtec.pricingcl
ient.PricingPresenter.getMaterialList
2014-04-08 15:19:52,854 [INFO  PricingPresenter] - Entering com.lamtec.pricingcl
ient.PricingPresenter.hideProductNames.
org.springframework.remoting.RemoteAccessException: Could not access HTTP invoke
r remote service at [http://enterprise:8080/LamtecServer/lamtecserver.service];
nested exception is java.lang.StackOverflowError
        at org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor
.convertHttpInvokerAccessException(HttpInvokerClientInterceptor.java:212)
        at org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor
.invoke(HttpInvokerClientInterceptor.java:145)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami
cAopProxy.java:202)
        at com.sun.proxy.$Proxy15.listProducts(Unknown Source)
        at com.lamtec.pricingclient.PricingPresenter$15.call(PricingPresenter.ja
va:2504)
        at com.lamtec.pricingclient.PricingPresenter$15.call(PricingPresenter.ja
va:2500)
        at javafx.concurrent.Task$TaskCallable.call(Unknown Source)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.StackOverflowError
        at java.io.ObjectInputStream$PeekInputStream.readFully(Unknown Source)
        at java.io.ObjectInputStream$BlockDataInputStream.readInt(Unknown Source
)
        at java.io.ObjectInputStream.readHandle(Unknown Source)
        at java.io.ObjectInputStream.readClassDesc(Unknown Source)
        at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
        at java.io.ObjectInputStream.readObject0(Unknown Source)
        at java.io.ObjectInputStream.readObject(Unknown Source)
        at java.util.ArrayList.readObject(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor46.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
        at java.io.ObjectInputStream.readSerialData(Unknown Source)
        at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
        at java.io.ObjectInputStream.readObject0(Unknown Source)
        at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
        at java.io.ObjectInputStream.readSerialData(Unknown Source)
        at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
        at java.io.ObjectInputStream.readObject0(Unknown Source)
        at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
        at java.io.ObjectInputStream.readSerialData(Unknown Source)
        at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
        at java.io.ObjectInputStream.readObject0(Unknown Source)
        at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
        at java.io.ObjectInputStream.readSerialData(Unknown Source)
        at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
        at java.io.ObjectInputStream.readObject0(Unknown Source)
        at java.io.ObjectInputStream.readObject(Unknown Source)
        at java.util.ArrayList.readObject(Unknown Source)
etc....

尝试从文件中读取序列化数据时:

2014-04-08 15:19:43,715 [INFO  PricingPresenter] - Entering com.lamtec.pricingcl
ient.PricingPresenter.doReadArchive.
2014-04-08 15:19:43,762 [INFO  ArchiveSelectorController] - Entering com.lamtec.
pricingclient.ArchiveSelectorController.getPrimaryStage.
2014-04-08 15:19:43,765 [INFO  ArchiveSelectorController] - Entering com.lamtec.
pricingclient.ArchiveSelectorController.getPrimaryStage.
2014-04-08 15:19:43,769 [INFO  ArchiveSelectorController] - Entering com.lamtec.
pricingclient.ArchiveSelectorController.getPrimaryStage.
2014-04-08 15:19:47,674 [INFO  ArchiveSelectorController] - Entering com.lamtec.
pricingclient.ArchiveSelectorController.doArchiveSelectedLoad.
2014-04-08 15:19:47,684 [INFO  ArchiveSelectorController] - Entering com.lamtec.
pricingclient.ArchiveSelectorController.getPrimaryStage.
2014-04-08 15:19:47,689 [INFO  ArchiveSelectorController] - Entering com.lamtec.
pricingclient.ArchiveSelectorController.isArchiveSelected.
2014-04-08 15:19:47,695 [INFO  PricingPresenter] - Entering com.lamtec.pricingcl
ient.PricingPresenter.clearTables.
2014-04-08 15:19:47,864 [INFO  PricingPresenter] - Entering read archive product
s
Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: java
.lang.reflect.InvocationTargetException
        at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(Unknown Source)
        at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unkn
own Source)
        at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknow
n Source)
        at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknow
n Source)
        at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
        at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Sou
rce)
        at com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source)
        at com.sun.javafx.event.EventUtil.fireEvent(Unknown Source)
        at javafx.event.Event.fireEvent(Unknown Source)
        at javafx.scene.control.MenuItem.fire(Unknown Source)
        at com.sun.javafx.scene.control.skin.ContextMenuContent$MenuItemContaine
r.doSelect(Unknown Source)
        at com.sun.javafx.scene.control.skin.ContextMenuContent$MenuItemContaine
r$6.handle(Unknown Source)
        at com.sun.javafx.scene.control.skin.ContextMenuContent$MenuItemContaine
r$6.handle(Unknown Source)
        at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unkn
own Source)
        at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknow
n Source)
        at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknow
n Source)
        at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(U
nknown Source)
        at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Sourc
e)
        at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Sou
rce)
        at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Sourc
e)
        at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Sou
rce)
        at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Sourc
e)
        at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Sou
rce)
        at com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source)
        at com.sun.javafx.event.EventUtil.fireEvent(Unknown Source)
        at javafx.event.Event.fireEvent(Unknown Source)
        at javafx.scene.Scene$MouseHandler.process(Unknown Source)
        at javafx.scene.Scene$MouseHandler.process(Unknown Source)
        at javafx.scene.Scene$MouseHandler.access$1900(Unknown Source)
        at javafx.scene.Scene.impl_processMouseEvent(Unknown Source)
        at javafx.scene.Scene$ScenePeerListener.mouseEvent(Unknown Source)
        at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotificatio
n.run(Unknown Source)
        at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotificatio
n.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(Unkn
own Source)
        at com.sun.glass.ui.View.handleMouseEvent(Unknown Source)
        at com.sun.glass.ui.View.notifyMouse(Unknown Source)
        at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
        at com.sun.glass.ui.win.WinApplication.access$100(Unknown Source)
        at com.sun.glass.ui.win.WinApplication$3$1.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at sun.reflect.misc.Trampoline.invoke(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 
        at java.lang.reflect.Method.invoke(Unknown Source)
        at sun.reflect.misc.MethodUtil.invoke(Unknown Source)
        ... 41 more
Caused by: java.lang.StackOverflowError
        at java.io.ObjectInputStream$BlockDataInputStream.readByte(Unknown Sourc
e)
        at java.io.ObjectInputStream.readString(Unknown Source)
        at java.io.ObjectInputStream.readObject0(Unknown Source)
        at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
        at java.io.ObjectInputStream.readSerialData(Unknown Source)
        at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
        at java.io.ObjectInputStream.readObject0(Unknown Source)
        at java.io.ObjectInputStream.readObject(Unknown Source)
        at java.util.ArrayList.readObject(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor46.invoke(Unknown Source)

无论数据存储在何处,它都会发生这一事实让我觉得它是数据,但是对所有数据进行手动检查(幸好4个表中只有大约200-500行),它不是

所以,我在这里寻找关于潜在原因可能是什么的建议。回顾一下,如果我用32位或64位jdk构建并不重要,唯一重要的是我使用的jvm。一个32位的jvm总是崩溃读取相同的数据;即使在64位操作系统上运行。 堆栈溢出通常指向某种类型的失控递归,但在代码中没有类似的东西。数据库提取是一个简单的“select * from ...”,来自文件的数据的反序列化是从ObjectInputBuffer到ArrayList<>的直接读取。 谢谢你的帮助。

抱歉,忘记了一些代码 - 这是反序列化文件:

        try (FileInputStream fin = new FileInputStream(home.toString() + "/products.ser"); ObjectInputStream oin = new ObjectInputStream(fin)) {
            logger.info("Entering read archive products");
            ArrayList<Product> aInputList = (ArrayList<Product>) oin.readObject();
            if (pricingProductTableList == null) {
                pricingProductTableList = FXCollections.observableArrayList(aInputList);
            } else {
                pricingProductTableList.clear();
                pricingProductTable.getItems().clear();
                pricingProductTableList.addAll(aInputList);
            }
            pricingProductTable.getItems().setAll(pricingProductTableList);
            oin.close();
            fin.close();
        } catch (Exception ex) {
            DialogFX error = new DialogFX(DialogFX.Type.ERROR);
            error.setMessage("Invalid Selection " + ex.getMessage());
            error.showDialog();
            return;
        }
        try (FileInputStream fin = new FileInputStream(home.toString() + "/chemicals.ser"); ObjectInputStream oin = new ObjectInputStream(fin)) {
            ArrayList<Chemical> aInputList = (ArrayList<Chemical>) oin.readObject();
            logger.info("Entering read archive chemicals");
            if (pricingChemicalTableList == null) {
                pricingChemicalTableList = FXCollections.observableArrayList(aInputList);
            } else {
                pricingChemicalTableList.clear();
                pricingChemicalTable.getItems().clear();
                pricingChemicalTableList.addAll(aInputList);
            }
            pricingChemicalTable.getItems().setAll(pricingChemicalTableList);
            oin.close();
            fin.close();
        } catch (Exception ex) {
            DialogFX error = new DialogFX(DialogFX.Type.ERROR);
            error.setMessage("Invalid Selection " + ex.getMessage());
            error.showDialog();
            return;
        }
        try (FileInputStream fin = new FileInputStream(home.toString() + "/adhesives.ser"); ObjectInputStream oin = new ObjectInputStream(fin)) {
            ArrayList<Adhesive> aInputList = (ArrayList<Adhesive>) oin.readObject();
            logger.info("Entering read archive adhesives");
            if (pricingAdhesiveTableList == null) {
                pricingAdhesiveTableList = FXCollections.observableArrayList(aInputList);
            } else {
                pricingAdhesiveTableList.clear();
                pricingAdhesiveTable.getItems().clear();
                pricingAdhesiveTableList.addAll(aInputList);
            }
            pricingAdhesiveTable.getItems().setAll(pricingAdhesiveTableList);
            oin.close();
            fin.close();
        } catch (Exception ex) {
            DialogFX error = new DialogFX(DialogFX.Type.ERROR);
            error.setMessage("Invalid Selection " + ex.getMessage());
            error.showDialog();
            return;
        }
        try (FileInputStream fin = new FileInputStream(home.toString() + "/materials.ser"); ObjectInputStream oin = new ObjectInputStream(fin)) {
            ArrayList<Material> aInputList = (ArrayList<Material>) oin.readObject();
            logger.info("Entering read archive materials");
            if (pricingMaterialTableList == null) {
                pricingMaterialTableList = FXCollections.observableArrayList(aInputList);
            } else {
                pricingMaterialTableList.clear();
                pricingMaterialTable.getItems().clear();
                pricingMaterialTableList.addAll(aInputList);
            }
            pricingMaterialTable.getItems().setAll(pricingMaterialTableList);
            oin.close();
            fin.close();
        } catch (Exception ex) {
            DialogFX error = new DialogFX(DialogFX.Type.ERROR);
            error.setMessage("Invalid Selection " + ex.getMessage());
            error.showDialog();
            return;
        }

所有数据库提取都如下所示:

private ObservableList<Product> getProductList() {
    logger.info("Entering {}.getProductList", this.getClass().getName());
    if (costingService == null) {
        return null;
    }
    final Task<ObservableList> loadProductTask = new Task<ObservableList>() {
        @Override
        protected ObservableList call() throws Exception {
            return FXCollections.observableList(costingService.listProducts());
        }
    };

    loadProductTask.stateProperty().addListener(new ChangeListener<Worker.State>() {
        @Override
        public void changed(ObservableValue<? extends Worker.State> source, Worker.State oldState, Worker.State newState) {
            if (newState.equals(Worker.State.SUCCEEDED)) {
                if (pricingProductTableList != null && !pricingProductTableList.isEmpty()) {  // moved here from beginning of method, now table doesn't redraw
                    pricingProductTableList.clear();
                }
                pricingProductTableList = loadProductTask.getValue();
                pricingProductTable.getItems().setAll(pricingProductTableList);
                if (tempProduct != null) {
                    Platform.runLater(new Runnable() {
                        @Override
                        public void run() {
                            int index = pricingProductTableList.indexOf(tempProduct);
                            pricingProductTable.getSelectionModel().select(index);
                            pricingProductTable.requestFocus();
                            pricingProductTable.scrollTo(index);
                        }
                    });
                }
            } else if (newState.equals(Worker.State.FAILED)) {
                loadProductTask.getException().printStackTrace();
            }
        }
    });

    new Thread(loadProductTask).start();

    return pricingProductTableList;
}

Product Entity类(与所有持久化类基本相同):

@Entity
@Table(name = "Product")
@NamedQueries({
    @NamedQuery(name = "Product.findAll", query = "SELECT p FROM Product p order by p.pr    oduct"),
    @NamedQuery(name = "Product.findById", query = "SELECT p FROM Product p WHERE p.id =     :id"),

    @NamedQuery(name = "Product.findByProduct", query = "SELECT p FROM Product p WHERE     p.product = :product order by p.product"),
    @NamedQuery(name = "Product.findBySelected", query = "SELECT p FROM Product p WHERE     p.selected = :selected"),
    @NamedQuery(name = "Product.findBySubtotal", query = "SELECT p FROM Product p WHERE     p.subtotal = :subtotal"),
    @NamedQuery(name = "Product.findBySellingPrice", query = "SELECT p FROM Product p     WHERE p.sellingPrice = :sellingPrice"),
    @NamedQuery(name = "Product.findByWaste", query = "SELECT p FROM Product p WHERE     p.waste = :waste")})

public class Product implements Serializable {
private static final long serialVersionUID = -6259908469382195499L;
private Long id;
private String pCost;
private String product;
private String selected;
private String subtotal;
private String tCost;
private String wCost;
private String sellingPrice;
private String waste;
private String wipCost;
private String finishedCost;
private Boolean inactive;
private String updateUser;
private Date creationDate;
private Date updateDate;
private List<AdhesiveComponent> adhesiveComponentList;
private List<MaterialComponent> materialComponentList;
private List<MachineHour> machineHourList;

public Product() {
    this.creationDate = new Date();
}

public Product(Long id) {
    this.id = id;
}

public Product(Long id, String product) {
    this.creationDate = new Date();
    this.id = id;
    this.product = product;
}

public Product(Product product) {
    this.creationDate = new Date();
    this.pCost = product.getPCost();
    this.product = product.getProduct() + "_COPY";
    this.subtotal = product.getSubtotal();
    this.waste = product.getWaste();
    this.wCost = product.getWCost();
    this.sellingPrice = product.getSellingPrice();
    this.selected = product.getSelected();
    this.inactive = product.getInactive();
    this.tCost = product.getTCost();
    this.wipCost = product.getWipCost();
    this.finishedCost = product.getFinishedCost();
}

public Product(String pCost, String product, String selected, String subtotal, String tCost, String wCost, String sellingPrice, String waste,
        String wipCost, String finishedCost, Boolean inactive) {
    this.creationDate = new Date();
    this.pCost = pCost;
    this.product = product;
    this.selected = selected;
    this.subtotal = subtotal;
    this.tCost = tCost;
    this.wCost = wCost;
    this.sellingPrice = sellingPrice;
    this.waste = waste;
    this.wipCost = wipCost;
    this.finishedCost = finishedCost;
    this.inactive = inactive;
}

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Basic(optional = false)
@Column(name = "id")
public Long getId() {
    return id;
}

public void setId(Long id) {
    this.id = id;
}

@Column(name = "pcost", length=12)
public String getPCost() {
    return pCost;
}

public void setPCost(String pCost) {
    this.pCost = pCost;
}

@Basic(optional = false)
@Column(name = "product", unique = true)
public String getProduct() {
    return product;
}

public void setProduct(String product) {
    this.product = product;
}

@Column(name = "selected")
public String getSelected() {
    return selected;
}

public void setSelected(String selected) {
    this.selected = selected;
}

@Column(name = "subtotal", length=12)
public String getSubtotal() {
    return subtotal;
}

public void setSubtotal(String subtotal) {
    this.subtotal = subtotal;
}

@Column(name = "tcost", length=12)
public String getTCost() {
    return tCost;
}

public void setTCost(String tCost) {
    this.tCost = tCost;
}

@Column(name = "wcost", length=12)
public String getWCost() {
    return wCost;
}

public void setWCost(String wCost) {
    this.wCost = wCost;
}


@Column(name="selling_price", length=12)
public String getSellingPrice() {
    return sellingPrice;
}

public void setSellingPrice(String sellingPrice) {
    this.sellingPrice = sellingPrice;
}

@Column(name = "waste", length=12)
public String getWaste() {
    return waste;
}

public void setWaste(String waste) {
    this.waste = waste;
}

@Column(name = "wib_cost", length = 12)
public String getWipCost() {
    return wipCost;
}

public void setWipCost(String wipCost) {
    this.wipCost = wipCost;
}

@Column(name = "finished_cost", length = 12)
public String getFinishedCost() {
    return finishedCost;
}

public void setFinishedCost(String finishedCost) {
    this.finishedCost = finishedCost;
}

@Basic(optional=false)
@Column(name= "inactive")
public Boolean getInactive() {
    return inactive;
}

public void setInactive(Boolean inactive) {
    this.inactive = inactive;
}

@Column(name = "update_user", length = 4)
public String getUpdateUser() {
    return updateUser;
}

public void setUpdateUser(String updateUser) {
    this.updateUser = updateUser;
}

@Temporal(TemporalType.TIMESTAMP)
@Column(name = "creation_date")
public Date getCreationDate() {
    return creationDate;
}

public void setCreationDate(Date creationDate) {
    this.creationDate = creationDate;
}

@Temporal(TemporalType.TIMESTAMP)
@Column(name = "update_date")
public Date getUpdateDate() {
    return updateDate;
}

public void setUpdateDate(Date updateDate) {
    this.updateDate = updateDate;
}

@OneToMany(mappedBy="product", cascade={CascadeType.ALL}, targetEntity=AdhesiveComponent.class, orphanRemoval = true)
@LazyCollection(LazyCollectionOption.FALSE)
public List<AdhesiveComponent> getAdhesiveComponentList() {
    return adhesiveComponentList;
}

public void setAdhesiveComponentList(List<AdhesiveComponent> adhesiveComponentSet) {
    this.adhesiveComponentList = adhesiveComponentSet;
}

@OneToMany(mappedBy="product", cascade={CascadeType.ALL}, targetEntity=MaterialComponent.class, orphanRemoval = true)
@LazyCollection(LazyCollectionOption.FALSE)
public List<MaterialComponent> getMaterialComponentList() {
    return materialComponentList;
}

public void setMaterialComponentList(List<MaterialComponent> materialComponentList) {
    this.materialComponentList = materialComponentList;
}

@OneToMany(mappedBy="testProduct", cascade={CascadeType.MERGE, CascadeType.REFRESH, CascadeType.REMOVE}, targetEntity=MachineHour.class, orphanRemoval = true)
@LazyCollection(LazyCollectionOption.FALSE)
public List<MachineHour> getMachineHourList() {
    return machineHourList;
}

public void setMachineHourList(List<MachineHour> machineHourList) {
    this.machineHourList = machineHourList;
}

public String returnUpdateDate() {
    if (this.getUpdateDate() != null) {
        return (new SimpleDateFormat("MM/dd/yyyy").format(this.getUpdateDate()));
    } else {
        return "";
    }
}

@Override
public int hashCode() {
    int hash = 0;
    hash += (id != null ? id.hashCode() : 0);
    return hash;
}

@Override
public boolean equals(Object object) {
    // TODO: Warning - this method won't work in the case the id fields are not set
    if (!(object instanceof Product)) {
        return false;
    }
    Product other = (Product) object;
    if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
        return false;
    }
    return true;
}

@Override
public String toString() {
    return "Product{" + "id=" + id + ", pCost=" + pCost + ", product=" + product + ", selected=" + selected
            + ", subtotal=" + subtotal + ", tCost=" + tCost + ", wCost=" + wCost
            + ", sellingPrice=" + sellingPrice + ", waste=" + waste
            + ", wibCost=" + wipCost + ", finishedCost=" + finishedCost + ", inactive=" + inactive + ", created=" + creationDate
            + ", updated=" + updateDate + '}';
}

}

1 个答案:

答案 0 :(得分:5)

没有&#34; 32位jar&#34;。所有纯java文件都是(意味着)独立于它们构建的体系结构 - 这是什么&#34;写入一次运行的任何地方&#34;就是这样。 32位和64位之间的差异仅取决于运行代码的VM。

如果您没有明确调整堆栈大小,则32位-Vm更有可能遇到StackOverflowError,因为每个线程的默认堆栈大小要小得多(请参阅here):

  

在Java SE 6中,Sparc上的默认值在32位VM中为512k,在64位VM中为1024k。在x86 Solaris / Linux上,32位VM为320k,64位VM为1024k。

     

在Windows上,从二进制文件(java.exe)中读取默认的线程堆栈大小。从Java SE 6开始,这个值在32位VM中为320k,在64位VM中为1024k。

您可以在异常堆栈跟踪中看到,调用层次结构非常深,因为您似乎正在反序列化复杂的对象树,并且320k堆栈似乎无法处理此问题。要解决您的问题,您可以尝试将-Xss参数设置为更高的值。