Skip to main content

Can't return Entity EJBs from a Remote EJB

7 replies [Last post]
rsoika
Offline
Joined: 2006-12-09
Points: 0

Hi,
I am using Glassfish 3.1 (build 43) and I have a problem with a webapp working with an Remote EJB. The lookup for the Remote EJB works fine. The WebApp and the Remote EJBs are living in the same server. My webapp ceates the remote bean like this

<pre>
InitialContext ic = new InitialContext();
entityService = (EntityServiceRemote) ic.lookup(ejbName);
Collection col = entityService.findAllEntityIndices();

But the call of the method findAllEntityIndicies() which should return a collection of my entity EJbs fails. The method looks like this:

<pre><span class="Apple-tab-span"> </span>public Collection&lt;EntityIndex&gt; findAllEntityIndices() {
<span class="Apple-tab-span"> </span>Query q = manager
<span class="Apple-tab-span"> </span>.createQuery(&quot;SELECT entityindex FROM EntityIndex entityindex&quot;);
<span class="Apple-tab-span"> </span>return q.getResultList();
<span class="Apple-tab-span"> </span>}

The Method seems to work as I saw in the debugger. But when my EJB returns the collection I got the following exception:

SCHWERWIEGEND: javax.ejb.EJBException: java.rmi.MarshalException: CORBA MARSHAL 1398079496 No; nested exception is: 
<span class="Apple-tab-span"> </span>org.omg.CORBA.MARSHAL: FEIN: IOP00800008: Not enough space left in current chunk  vmcid: SUN  minor code: 8  completed: No
<span class="Apple-tab-span"> </span>at org.imixs.workflow.jee.ejb._EntityServiceRemote_Wrapper.findAllEntityIndices(org/imixs/workflow/jee/ejb/_EntityServiceRemote_Wrapper.java)
<span class="Apple-tab-span"> </span>at org.imixs.workflow.jee.adminclient.EntityServiceFacade.getIndexList(EntityServiceFacade.java:521)
<span class="Apple-tab-span"> </span>at org.imixs.workflow.jee.adminclient.EntityServiceFacade.setEjbEntityPersistenceManagerName(EntityServiceFacade.java:476)
<span class="Apple-tab-span"> </span>at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
<span class="Apple-tab-span"> </span>at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
<span class="Apple-tab-span"> </span>at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
<span class="Apple-tab-span"> </span>at java.lang.reflect.Method.invoke(Method.java:597)
<span class="Apple-tab-span"> </span>at javax.el.BeanELResolver.setValue(BeanELResolver.java:381)
<span class="Apple-tab-span"> </span>at com.sun.faces.el.DemuxCompositeELResolver._setValue(DemuxCompositeELResolver.java:255)
<span class="Apple-tab-span"> </span>at com.sun.faces.el.DemuxCompositeELResolver.setValue(DemuxCompositeELResolver.java:281)
<span class="Apple-tab-span"> </span>at com.sun.el.parser.AstValue.setValue(AstValue.java:197)
<span class="Apple-tab-span"> </span>at com.sun.el.ValueExpressionImpl.setValue(ValueExpressionImpl.java:286)
<span class="Apple-tab-span"> </span>at com.sun.facelets.el.TagValueExpression.setValue(TagValueExpression.java:93)
<span class="Apple-tab-span"> </span>at javax.faces.component.UIInput.updateModel(UIInput.java:818)
<span class="Apple-tab-span"> </span>at javax.faces.component.UIInput.processUpdates(UIInput.java:735)
<span class="Apple-tab-span"> </span>at javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:1242)
<span class="Apple-tab-span"> </span>at javax.faces.component.UIForm.processUpdates(UIForm.java:281)
<span class="Apple-tab-span"> </span>at org.ajax4jsf.component.AjaxViewRoot$2.invokeContextCallback(AjaxViewRoot.java:424)
<span class="Apple-tab-span"> </span>at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:240)
<span class="Apple-tab-span"> </span>at org.ajax4jsf.component.AjaxViewRoot.processUpdates(AjaxViewRoot.java:440)
<span class="Apple-tab-span"> </span>at com.sun.faces.lifecycle.UpdateModelValuesPhase.execute(UpdateModelValuesPhase.java:78)
<span class="Apple-tab-span"> </span>at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
<span class="Apple-tab-span"> </span>at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
<span class="Apple-tab-span"> </span>at javax.faces.webapp.FacesServlet.service(FacesServlet.java:409)
<span class="Apple-tab-span"> </span>at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1534)
<span class="Apple-tab-span"> </span>at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
<span class="Apple-tab-span"> </span>at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
<span class="Apple-tab-span"> </span>at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)
<span class="Apple-tab-span"> </span>at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
<span class="Apple-tab-span"> </span>at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
<span class="Apple-tab-span"> </span>at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
<span class="Apple-tab-span"> </span>at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
<span class="Apple-tab-span"> </span>at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
<span class="Apple-tab-span"> </span>at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
<span class="Apple-tab-span"> </span>at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
<span class="Apple-tab-span"> </span>at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
<span class="Apple-tab-span"> </span>at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
<span class="Apple-tab-span"> </span>at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)
<span class="Apple-tab-span"> </span>at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91)
<span class="Apple-tab-span"> </span>at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)
<span class="Apple-tab-span"> </span>at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:326)
<span class="Apple-tab-span"> </span>at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:227)
<span class="Apple-tab-span"> </span>at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:170)
<span class="Apple-tab-span"> </span>at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:822)
<span class="Apple-tab-span"> </span>at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:719)
<span class="Apple-tab-span"> </span>at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1013)
<span class="Apple-tab-span"> </span>at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
<span class="Apple-tab-span"> </span>at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
<span class="Apple-tab-span"> </span>at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
<span class="Apple-tab-span"> </span>at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
<span class="Apple-tab-span"> </span>at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
<span class="Apple-tab-span"> </span>at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
<span class="Apple-tab-span"> </span>at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
<span class="Apple-tab-span"> </span>at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
<span class="Apple-tab-span"> </span>at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
<span class="Apple-tab-span"> </span>at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
<span class="Apple-tab-span"> </span>at java.lang.Thread.run(Thread.java:662)
Caused by: java.rmi.MarshalException: CORBA MARSHAL 1398079496 No; nested exception is:
<span class="Apple-tab-span"> </span>org.omg.CORBA.MARSHAL: FEIN: IOP00800008: Not enough space left in current chunk  vmcid: SUN  minor code: 8  completed: No
<span class="Apple-tab-span"> </span>at com.sun.corba.ee.impl.javax.rmi.CORBA.Util.mapSystemException(Util.java:267)
<span class="Apple-tab-span"> </span>at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:213)
<span class="Apple-tab-span"> </span>at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:152)
<span class="Apple-tab-span"> </span>at com.sun.corba.ee.impl.presentation.rmi.codegen.CodegenStubBase.invoke(CodegenStubBase.java:227)
<span class="Apple-tab-span"> </span>at org.imixs.workflow.jee.ejb.__EntityServiceRemote_Remote_DynamicStub.findAllEntityIndices(org/imixs/workflow/jee/ejb/__EntityServiceRemote_Remote_DynamicStub.java)
<span class="Apple-tab-span"> </span>... 57 more
Caused by: org.omg.CORBA.MARSHAL: FEIN: IOP00800008: Not enough space left in current chunk  vmcid: SUN  minor code: 8  completed: No
<span class="Apple-tab-span"> </span>at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
<span class="Apple-tab-span"> </span>at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
<span class="Apple-tab-span"> </span>at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
<span class="Apple-tab-span"> </span>at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
<span class="Apple-tab-span"> </span>at com.sun.corba.ee.spi.orbutil.logex.corba.CorbaExtension.makeException(CorbaExtension.java:248)
<span class="Apple-tab-span"> </span>at com.sun.corba.ee.spi.orbutil.logex.corba.CorbaExtension.makeException(CorbaExtension.java:95)
<span class="Apple-tab-span"> </span>at com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator.handleFullLogging(WrapperGenerator.java:387)
<span class="Apple-tab-span"> </span>at com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator.access$400(WrapperGenerator.java:107)
<span class="Apple-tab-span"> </span>at com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator$2.invoke(WrapperGenerator.java:511)
<span class="Apple-tab-span"> </span>at com.sun.corba.ee.spi.orbutil.proxy.CompositeInvocationHandlerImpl.invoke(CompositeInvocationHandlerImpl.java:99)
<span class="Apple-tab-span"> </span>at $Proxy155.rmiiiopOptionalDataIncompatible2(Unknown Source)
<span class="Apple-tab-span"> </span>at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.checkBlockLength(CDRInputStream_1_0.java:363)
<span class="Apple-tab-span"> </span>at com.sun.corba.ee.impl.encoding.CDRInputStream_1_2.alignAndCheck(CDRInputStream_1_2.java:105)
<span class="Apple-tab-span"> </span>at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_long(CDRInputStream_1_0.java:496)
<span class="Apple-tab-span"> </span>at com.sun.corba.ee.impl.encoding.CDRInputObject.read_long(CDRInputObject.java:372)
<span class="Apple-tab-span"> </span>at com.sun.corba.ee.impl.encoding.WrapperInputStream.read_long(WrapperInputStream.java:90)
<span class="Apple-tab-span"> </span>at com.sun.corba.ee.impl.corba.TypeCodeImpl.read_value_kind(TypeCodeImpl.java:1346)
<span class="Apple-tab-span"> </span>at com.sun.corba.ee.impl.corba.TypeCodeImpl.read_value(TypeCodeImpl.java:1328)
<span class="Apple-tab-span"> </span>at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_any(CDRInputStream_1_0.java:766)
<span class="Apple-tab-span"> </span>at com.sun.corba.ee.impl.encoding.CDRInputObject.read_any(CDRInputObject.java:482)
<span class="Apple-tab-span"> </span>at com.sun.corba.ee.impl.javax.rmi.CORBA.Util.readAny(Util.java:452)
<span class="Apple-tab-span"> </span>at com.sun.corba.ee.impl.io.ValueHandlerImpl.read_Array(ValueHandlerImpl.java:639)
<span class="Apple-tab-span"> </span>at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValueInternal(ValueHandlerImpl.java:305)
<span class="Apple-tab-span"> </span>at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValue(ValueHandlerImpl.java:274)
<span class="Apple-tab-span"> </span>at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.readRMIIIOPValueType(CDRInputStream_1_0.java:1015)
<span class="Apple-tab-span"> </span>at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:1123)
<span class="Apple-tab-span"> </span>at com.sun.corba.ee.impl.encoding.CDRInputObject.read_value(CDR
SCHWERWIEGEND: InputObject.java:531)
<span class="Apple-tab-span"> </span>at com.sun.corba.ee.impl.io.IIOPInputStream.inputObjectField(IIOPInputStream.java:2162)
<span class="Apple-tab-span"> </span>at com.sun.corba.ee.impl.io.IIOPInputStream.inputClassFields(IIOPInputStream.java:2404)
<span class="Apple-tab-span"> </span>at com.sun.corba.ee.impl.io.IIOPInputStream.inputObject(IIOPInputStream.java:1224)
<span class="Apple-tab-span"> </span>at com.sun.corba.ee.impl.io.IIOPInputStream.simpleReadObject(IIOPInputStream.java:425)
<span class="Apple-tab-span"> </span>at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValueInternal(ValueHandlerImpl.java:308)
<span class="Apple-tab-span"> </span>at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValue(ValueHandlerImpl.java:274)
<span class="Apple-tab-span"> </span>at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.readRMIIIOPValueType(CDRInputStream_1_0.java:1015)
<span class="Apple-tab-span"> </span>at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:1123)
<span class="Apple-tab-span"> </span>at com.sun.corba.ee.impl.encoding.CDRInputObject.read_value(CDRInputObject.java:531)
<span class="Apple-tab-span"> </span>at com.sun.corba.ee.impl.presentation.rmi.DynamicMethodMarshallerImpl$14.read(DynamicMethodMarshallerImpl.java:384)
<span class="Apple-tab-span"> </span>at com.sun.corba.ee.impl.presentation.rmi.DynamicMethodMarshallerImpl.readResult(DynamicMethodMarshallerImpl.java:483)
<span class="Apple-tab-span"> </span>at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:203)

The same Application works on Glassfish 2.1 and also Glassfish 3.0.1. Only on Glassfih 3.1 running with JDK 1.6 (24) shows this problem.
Can anybody help what this exception means. I can not find any helpfull links for this problem :-(

Thanks for help
====
Ralph

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
fleroy41
Offline
Joined: 2011-04-01
Points: 0

Hi,
I think this is a known unmarshalling bug with Corba IIOP when using two different version of the JDK (5 and 6 for example). Try replacing your JDK 6 by JDK 5.

Regards,
Fabien Leroy.

rsoika
Offline
Joined: 2006-12-09
Points: 0

Thanks for your reply.
Changing to JDK 5 was not possibly because glasfish 3.1 will not start using jdk 1.5
So I ensure that all components which I deployed are JDK 1.6. But nothing changed. I still got the same error message.

di5s
Offline
Joined: 2011-04-25
Points: 0

hi,
sorry, i also can't help you, but I've got the same exception.
Which Frameworks / Add-ons do you use? Are you also using Seam Faces Module?
My Java Version is the same es yours:
# java -version
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02, mixed mode)

MohamzJava
Offline
Joined: 2011-05-05
Points: 0

Hi,

I'm having the same problem here. This is my setup:
The SessionBean:

    @Stateless
    @TransactionAttribute(TransactionAttributeType.REQUIRED)
    public class CalculateBean implements CalculateBeanRemote {
      @PersistenceContext(unitName = &quot;CalculationJPA&quot;)&acute;
      private EntityManager em;
       @Override
      public Result getResult(Integer id) {
        Result result= em.find(Result.class, id);
        //Checked here:   result has an resultId and a resultName, they are not null        
        return result;
      }
    }

The RemoteInterface:
 @Remote
public interface CalculateBeanRemote {
    public Result getResult(Integer id);
}

The Entity:
@Entity
@Table(name = &quot;Result&quot;)
public class Result implements Serializable{
    @Id
    private Integer resultId;
  
    @Column(nullable = false, length = 800)
    private String resultName;
  
    public Result() {
    }
    public Result(Integer id, String name) {
        super();
        this.resultId= id;
        this.resultName= name;
    }
    //getters and setters
}

In my Servlet:
    Context context = new InitialContext();
    CalculateBeanRemote calculator = (CalculateBeanRemote)
    context.lookup(&quot;java:global/TestEjbEnterpriseApplication/TestEjbEnterpriseApplication-ejb/CalculateBean!com.mycompany.jee.ejb.CalculateBeanRemote&quot;);
    Result result = calculator.getResult(new Integer(9)); //Here I receive a Result with null resultId and null resultName

My persistence.xml
  &lt;persistence-unit name=&quot;CalculationJPA&quot; transaction-type=&quot;JTA&quot;&gt;
    &lt;provider&gt;org.eclipse.persistence.jpa.PersistenceProvider&lt;/provider&gt;
    &lt;class&gt;com.mycompany.jee.ejb.model.Result&lt;/class&gt;
    &lt;properties&gt;
      &lt;property name=&quot;javax.persistence.jdbc.url&quot; value=&quot;jdbc:derby://localhost:1527/sample&quot;/&gt;
      &lt;property name=&quot;javax.persistence.jdbc.password&quot; value=&quot;app&quot;/&gt;
      &lt;property name=&quot;javax.persistence.jdbc.driver&quot; value=&quot;org.apache.derby.jdbc.ClientDriver&quot;/&gt;
      &lt;property name=&quot;javax.persistence.jdbc.user&quot; value=&quot;app&quot;/&gt;
    &lt;/properties&gt;
   &lt;/persistence-unit&gt;

So, the fields in the result are set in CalculateBean, but in my servlet I receive null-fields.

I have done the same example but without setting my Result class to being an Entity, and there it works normally.

So the problem seems that the Entity is not returned correctly to the client.

Can anybody help?

Thank you in advance!

Regards

mm110999
Offline
Joined: 2005-03-29
Points: 0

You seem to be hitting http://java.net/jira/browse/GLASSFISH-16164.
Try using as a possible workaround.

On 5/18/2011 8:12 AM, forums@java.net wrote:
> Hi,
>
> I'm having the same problem here. This is my setup:
> The SessionBean:
> @Stateless
> @TransactionAttribute(TransactionAttributeType.REQUIRED)
> publicclass CalculateBean implements CalculateBeanRemote {
>
> @PersistenceContext(unitName = "CalculationJPA")
> private EntityManager em;
>
> @Override
> public Result getResult(Integer id) {
> Result result= em.find(Result.class, id);
> //Checked here: result has an resultId and a resultName,
> they are not null
> return result;
> }
> }
> The RemoteInterface:
> @Remote
> public interface CalculateBeanRemote {
> public Result getResult(Integer id);
> }
> The Entity:
> @Entity
> @Table(name = "Result")
> public class Result implements Serializable{
>
> @Id
> private Integer resultId;
>
> @Column(nullable = false, length = 800)
> private String resultName;
>
> public Result() {
> }
> public Result(Integer id, String name) {
> super();
> this.resultId= id;
> this.resultName= name;
> }
> //getters and setters
> }
> In my Servlet:
> Context context = getInitialContext();
> CalculateBeanRemote calculator = (CalculateBeanRemote)
>
> context.lookup("java:global/TestEjbEnterpriseApplication/TestEjbEnterpriseApplication-ejb/CalculateBean!com.mycompany.jee.ejb.CalculateBeanRemote");
>
> Result result = calculator.getResult(new Integer(9)); //Here I
> receive
> a Result with null resultId and null resultName
>
> My persistence.xml
>
> org.eclipse.persistence.jpa.PersistenceProvider
> com.itcan.jee.ejb.model.Insurance
>
> value="jdbc:derby://localhost:1527/sample"/>
>
> value="org.apache.derby.jdbc.ClientDriver"/>
>
>
>
>
> So, the fields in the result are set in CalculateBean, but in my
> servlet I
> receive null-fields.
>
> I have done the same example but without setting my Result class to
> being an
> Entity, and there it works normally.
>
> So the problem seems that the Entity is not returned correctly to the
> client.
>
> Can anybody help?
>
> Thank you in advance!
>
> Regards
>
>
> --
>
> [Message sent by forum member 'MohamzJava']
>
> View Post: http://forums.java.net/node/794504
>
>

MohamzJava
Offline
Joined: 2011-05-05
Points: 0

Hi,
yes, this is what I found out late yesterday, but my "solution" was more radical I completely disabled weaving ;-) using property name="eclipselink.weaving" value="false".
I will try the suggested workaround, thank you very much...My God I love this community!

Thank you all!

emiddio
Offline
Joined: 2007-04-16
Points: 0

i have seen where (just yesterday) the jdbc url doesnt work with glassfish
as i would have expected,

if i use something similiar to
jdbc/__default
added to the persistence.xml instead -- then things work.

gary

----- Original Message -----
From:
To:
Sent: Wednesday, May 18, 2011 8:12 AM
Subject: Re: Can't return Entity EJBs from a Remote EJB

Hi,

I'm having the same problem here. This is my setup:
The SessionBean:
@Stateless
@TransactionAttribute(TransactionAttributeType.REQUIRED)
publicclass CalculateBean implements CalculateBeanRemote {

@PersistenceContext(unitName = "CalculationJPA")
private EntityManager em;

@Override
public Result getResult(Integer id) {
Result result= em.find(Result.class, id);
//Checked here: result has an resultId and a resultName,
they are not null
return result;
}
}
The RemoteInterface:
@Remote
public interface CalculateBeanRemote {
public Result getResult(Integer id);
}
The Entity:
@Entity
@Table(name = "Result")
public class Result implements Serializable{

@Id
private Integer resultId;

@Column(nullable = false, length = 800)
private String resultName;

public Result() {
}
public Result(Integer id, String name) {
super();
this.resultId= id;
this.resultName= name;
}
//getters and setters
}
In my Servlet:
Context context = getInitialContext();
CalculateBeanRemote calculator = (CalculateBeanRemote)

context.lookup("java:global/TestEjbEnterpriseApplication/TestEjbEnterpriseApplication-ejb/CalculateBean!com.mycompany.jee.ejb.CalculateBeanRemote");
Result result = calculator.getResult(new Integer(9)); //Here I receive
a Result with null resultId and null resultName

My persistence.xml

org.eclipse.persistence.jpa.PersistenceProvider
com.itcan.jee.ejb.model.Insurance

So, the fields in the result are set in CalculateBean, but in my servlet I
receive null-fields.

I have done the same example but without setting my Result class to being an
Entity, and there it works normally.

So the problem seems that the Entity is not returned correctly to the
client.

Can anybody help?

Thank you in advance!

Regards

--

[Message sent by forum member 'MohamzJava']

View Post: http://forums.java.net/node/794504