• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Not accessing ejb remote interface when use hibernate jpa 2 provider

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am learning JPA 2 and Hibernate 3.5.4 with Glassfish 3.0.1 in Netbeans 6.9.
I have two databases one of them is only contain one table. When I wrote an application everthing was fine.
When I trying the second database where there are two tables in one-to-many relation cars (autok) and owners (Ember).

Here is the error

2010.07.23. 13:16:26 com.sun.enterprise.transaction.JavaEETransactionManagerSimplified initDelegates
INFO: Using com.sun.enterprise.transaction.jts.JavaEETransactionManagerJTSDelegate as the delegate
2010.07.23. 13:16:40 com.sun.corba.ee.impl.encoding.CDRInputStream_1_0 read_value
WARNING: "IOP00810257: (MARSHAL) Could not load class org.hibernate.exception.SQLGrammarException"
org.omg.CORBA.MARSHAL: vmcid: SUN minor code: 257 completed: Maybe
at com.sun.corba.ee.impl.logging.ORBUtilSystemException.couldNotFindClass(ORBUtilSystemException.java:10144)
at com.sun.corba.ee.impl.logging.ORBUtilSystemException.couldNotFindClass(ORBUtilSystemException.java:10159)
at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:1163)
at com.sun.corba.ee.impl.encoding.CDRInputObject.read_value(CDRInputObject.java:655)
at com.sun.corba.ee.impl.io.IIOPInputStream.inputObjectField(IIOPInputStream.java:2298)
at com.sun.corba.ee.impl.io.IIOPInputStream.inputClassFields(IIOPInputStream.java:2552)
at com.sun.corba.ee.impl.io.IIOPInputStream.inputObject(IIOPInputStream.java:1310)
at com.sun.corba.ee.impl.io.IIOPInputStream.simpleReadObject(IIOPInputStream.java:449)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValueInternal(ValueHandlerImpl.java:364)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValue(ValueHandlerImpl.java:320)
at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.readRMIIIOPValueType(CDRInputStream_1_0.java:1066)
at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:1175)
at com.sun.corba.ee.impl.encoding.CDRInputObject.read_value(CDRInputObject.java:655)
at com.sun.corba.ee.impl.io.IIOPInputStream.inputObjectField(IIOPInputStream.java:2298)
at com.sun.corba.ee.impl.io.IIOPInputStream.inputClassFields(IIOPInputStream.java:2552)
at com.sun.corba.ee.impl.io.IIOPInputStream.inputObject(IIOPInputStream.java:1310)
at com.sun.corba.ee.impl.io.IIOPInputStream.simpleReadObject(IIOPInputStream.java:449)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValueInternal(ValueHandlerImpl.java:364)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValue(ValueHandlerImpl.java:320)
at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.readRMIIIOPValueType(CDRInputStream_1_0.java:1066)
at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:1175)
at com.sun.corba.ee.impl.encoding.CDRInputObject.read_value(CDRInputObject.java:655)
at com.sun.corba.ee.impl.io.IIOPInputStream.inputObjectField(IIOPInputStream.java:2298)
at com.sun.corba.ee.impl.io.IIOPInputStream.inputClassFields(IIOPInputStream.java:2552)
at com.sun.corba.ee.impl.io.IIOPInputStream.inputObject(IIOPInputStream.java:1310)
at com.sun.corba.ee.impl.io.IIOPInputStream.simpleReadObject(IIOPInputStream.java:449)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValueInternal(ValueHandlerImpl.java:364)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValue(ValueHandlerImpl.java:320)
at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.readRMIIIOPValueType(CDRInputStream_1_0.java:1066)
at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:1175)
at com.sun.corba.ee.impl.encoding.CDRInputObject.read_value(CDRInputObject.java:655)
at com.sun.corba.ee.impl.presentation.rmi.ExceptionHandlerImpl$ExceptionRWRMIImpl.read(ExceptionHandlerImpl.java:183)
at com.sun.corba.ee.impl.presentation.rmi.ExceptionHandlerImpl.readException(ExceptionHandlerImpl.java:295)
at com.sun.corba.ee.impl.presentation.rmi.DynamicMethodMarshallerImpl.readException(DynamicMethodMarshallerImpl.java:505)
at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:192)
at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:147)
at com.sun.corba.ee.impl.presentation.rmi.codegen.CodegenStubBase.invoke(CodegenStubBase.java:225)
at ejbs.__EmberkezRemote_Remote_DynamicStub.egyidker(ejbs/__EmberkezRemote_Remote_DynamicStub.java)
at ejbs._EmberkezRemote_Wrapper.egyidker(ejbs/_EmberkezRemote_Wrapper.java)
at rel2p.Rel2pfo.run(Rel2pfo.java:31)
at rel2p.Rel2pfo.main(Rel2pfo.java:24)
Exception occured java.rmi.MarshalException: CORBA MARSHAL 1398079745 Maybe; nested exception is:
org.omg.CORBA.MARSHAL: vmcid: SUN minor code: 257 completed: Maybe
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.appclient.client.acc.AppClientContainer.launch(AppClientContainer.java:424)
at org.glassfish.appclient.client.AppClientFacade.launch(AppClientFacade.java:151)
at org.glassfish.appclient.client.AppClientGroupFacade.main(AppClientGroupFacade.java:64)
run:


The source of ejb:

package ejbs;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import pojo.Ember;

@Stateless
public class Emberkez implements EmberkezRemote {
@PersistenceContext
EntityManager em;

public Ember egyidker(Integer azon) {
return em.find(Ember.class, azon);
}

}


The source of remote interface:

package ejbs;

import javax.ejb.Remote;
import pojo.Ember;

@Remote
public interface EmberkezRemote {

Ember egyidker(Integer azon);

}


The source of the pojo:

package pojo;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

@Entity
@Table(name = "Ember")
@NamedQueries({
@NamedQuery(name = "Ember.findAll", query = "SELECT e FROM Ember e"),
@NamedQuery(name = "Ember.findByEmberazon", query = "SELECT e FROM Ember e WHERE e.emberazon = :emberazon"),
@NamedQuery(name = "Ember.findByEmbernev", query = "SELECT e FROM Ember e WHERE e.embernev = :embernev")})
public class Ember implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(generator="emberseq",strategy=GenerationType.SEQUENCE)
@SequenceGenerator(name="emberseq",allocationSize=1,sequenceName="Ember_emberazon_seq")
@Basic(optional = false)
@Column(name = "emberazon")
private Integer emberazon;
@Basic(optional = false)
@Column(name = "embernev")
private String embernev;
@OneToMany(mappedBy = "ember",fetch=FetchType.EAGER,cascade=CascadeType.ALL)
private Collection<Autok> autokCollection;

public Ember() {
}

public Ember(Integer emberazon) {
this.emberazon = emberazon;
}

public Ember(Integer emberazon, String embernev) {
this.emberazon = emberazon;
this.embernev = embernev;
}

public Integer getEmberazon() {
return emberazon;
}

public void setEmberazon(Integer emberazon) {
this.emberazon = emberazon;
}

public String getEmbernev() {
return embernev;
}

public void setEmbernev(String embernev) {
this.embernev = embernev;
}

public Collection<Autok> getAutokCollection() {
return autokCollection;
}

public void setAutokCollection(Collection<Autok> autokCollection) {
this.autokCollection = autokCollection;
}

@Override
public int hashCode() {
int hash = 0;
hash += (emberazon != null ? emberazon.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 Ember)) {
return false;
}
Ember other = (Ember) object;
if ((this.emberazon == null && other.emberazon != null) || (this.emberazon != null && !this.emberazon.equals(other.emberazon))) {
return false;
}
return true;
}

@Override
public String toString() {
return "pojo.Ember[emberazon=" + emberazon + "]";
}

}

And the remote caller application:

package rel2p;

import ejbs.EmberkezRemote;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import pojo.Ember;

public class Rel2pfo {

public static void main(String[] args) {
Rel2pfo rlp = new Rel2pfo();
rlp.run();
}

void run() {
try {
InitialContext ix = new InitialContext();
EmberkezRemote emejb = (EmberkezRemote) ix.lookup("ejbs.EmberkezRemote");
Ember e1 = emejb.egyidker(1);
System.out.println("Neve " + e1.getEmbernev());
}
catch (NamingException nex) {
System.out.println("Naming error " + nex.getLocalizedMessage());
}
catch (Exception ex) {
System.out.println("Exception occured " + ex.getMessage());
}
}

}

 
passwords must contain 14 characters, a number, punctuation, a small bird, a bit of cheese and a tiny ad.
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic