#Trying to set an object into a EJB Bean array from a remote app.

18 messages · Page 1 of 1 (latest)

crystal elk
#

I am trying to set a object to an stateful EJB which has an array.

If I do this in the Web container in a servlet it works fine but when I try do the same in the remote application I am getting an marshalling error

Let me put the codes
and more details

ancient kilnBOT
#

This post has been reserved for your question.

Hey @crystal elk! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

crystal elk
#

This is the object I am trying to insert into the Bean's List, this in a module called "core"

public class IoTDeviceReadingState implements Serializable {
    int capturedVehicleSpeed = 0;
    String capturedTrafficLightStatus = null;
    Coordinate capturedGPSCoordinates = null;
#

This is the Bean interface

@Remote
public interface IoTDeviceReadingStore extends Serializable {

    void configureBean();

    void setReading(IoTDeviceReadingState reading);

    List<IoTDeviceReadingState> getReadings();
}

#

Bean Implementation

@Stateful
public class IoTDeviceReadingStoreBean implements IoTDeviceReadingStore {
    private List<IoTDeviceReadingState> readings = new LinkedList<>();

    @PostConstruct
    public void configureBean(){
        this.readings = new LinkedList<>();
    }

    public void setReading(IoTDeviceReadingState reading){
        this.readings.add(reading);
    }
    public List<IoTDeviceReadingState> getReadings(){
        return readings;
    }

}

#

Testing it in Servlet


            IoTDeviceReadingState state = new IoTDeviceReadingState();
            String lightStatus = "green";
            int speed = 100;
            state.captureTrafficLightStatus(lightStatus);
            state.captureVehicleSpeed(speed);

            IoTDeviceReadingStore readingStoreBean = (IoTDeviceReadingStore) context.lookup("java:global/ear/app/IoTDeviceReadingStoreBean");
            readingStoreBean.setReading(state);
#

No errors worked fine

#

Trying to do this in another app

        IoTDeviceReadingState state = new IoTDeviceReadingState();
        String lightStatus = IoTDataGenerator.randomStatus();
        int speed = IoTDataGenerator.randomSpeed();
        state.captureTrafficLightStatus(lightStatus);
        state.captureVehicleSpeed(speed);

        IoTDeviceReadingStore readingStoreBean = (IoTDeviceReadingStore) context.lookup("java:global/ear/app/IoTDeviceReadingStoreBean");

        readingStoreBean.setReading(state);
#

The error I am getting is

#
Exception in thread "main" jakarta.ejb.EJBException: java.rmi.MarshalException: CORBA MARSHAL 1330446347 Maybe; nested exception is: 
    org.omg.CORBA.MARSHAL: ----------BEGIN server-side stack trace----------
org.omg.CORBA.MARSHAL: WARNING: 00810011: Exception from readValue on ValueHandler in CDRInputStream  vmcid: OMG  minor code: 11 completed: Maybe
    at com.sun.proxy.$Proxy270.valuehandlerReadException(Unknown Source)
    at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.readRMIIIOPValueType(CDRInputStream_1_0.java:804)
    at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:899)
    at com.sun.corba.ee.impl.encoding.CDRInputObject.read_value
#

how to do I change the description

#

the description is old

crystal elk
#

going to sleep now

ancient kilnBOT
#

💤 Post marked as dormant

This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping.
Warning: abusing this will result in moderative actions taken against you.

crystal elk
#

Update Update
Hey for some reason after I turned on my laptop

I started the server in the web app (ear), then re run the remote and it didn't throw any exceptions

#

boohoo hidethepain boohoo hidethepain
skill issue