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

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
9 Replies
JavaBot
JavaBot9mo ago
This post has been reserved for your question.
Hey @Rag...JN 🌌 🦡 👽 💰! 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.
Rag...JN 🌌 🦡 👽 💰 🐊
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;
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();
}
@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;
}

}
@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);
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);
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);
Rag...JN 🌌 🦡 👽 💰 🐊
The error I am getting is
No description
Rag...JN 🌌 🦡 👽 💰 🐊
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
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
Rag...JN 🌌 🦡 👽 💰 🐊
GitHub
GitHub - ragujan/multi_module_java_iot_app_simulation: Getting help...
Getting help to fix some issues, it's mainly the servlet url - GitHub - ragujan/multi_module_java_iot_app_simulation: Getting help to fix some issues, it's mainly the servlet url
Rag...JN 🌌 🦡 👽 💰 🐊
how to do I change the description the description is old going to sleep now
JavaBot
JavaBot9mo ago
💤 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.
Rag...JN 🌌 🦡 👽 💰 🐊
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
JavaBot
JavaBot9mo ago
💤 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.
Want results from more Discord servers?
Add your server