小编Pey*_*ian的帖子

RMI异常"错误编组参数"

我正在开发一个RMI项目,它有两个独立的Client和Server项目.我用了启动rmiregistry.当我尝试运行我的服务器应用程序时,我得到一个例外.

public class Runner extends UnicastRemoteObject {

    public Runner() throws RemoteException {
        try {
            ServerOperations so = new ServerSide();
            Naming.rebind("rmi://localhost:2000/MiveCoffeeService", so);
            System.out.println("Server is online.");

        } catch (RemoteException | MalformedURLException | FileNotFoundException ex) {
            Logger.getLogger(Runner.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public static void main(String[] args) throws RemoteException {
        new Runner();
    }

}
Run Code Online (Sandbox Code Playgroud)

例外情况是:

Sep 11, 2015 9:05:51 PM ir.nscogroup.coffeemive.Runner <init>
SEVERE: null
java.rmi.MarshalException: error marshalling arguments; nested exception is: 
    java.io.NotSerializableException: dataaccess.ServerSide
    at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
    at java.rmi.Naming.rebind(Naming.java:177)
    at ir.nscogroup.coffeemive.Runner.<init>(Runner.java:29)
    at ir.nscogroup.coffeemive.Runner.main(Runner.java:38)
Caused by: …
Run Code Online (Sandbox Code Playgroud)

java rmi

4
推荐指数
2
解决办法
8306
查看次数

ShallowWrapper::setState() 只能在类组件上调用

在我使用withSnackbar. 但现在它失败了,我真的不知道如何解决这个问题。所以任何帮助将不胜感激。谢谢。

这是我在组件中的导出:

export default withSnackbar(StoryApp)
Run Code Online (Sandbox Code Playgroud)

这是我的测试:

let story = {
  Title: "title 1",
  body: "body 1",
  UserEntityKey: "userEntityKey",
  Key: "storyKey"
}

afterEach(() => {
  // cleaning up the mess left behind the previous test
  MockAxios.reset();
});

test('Story deletes based on mocked backend response', async () => {
  window.confirm = jest.fn()
  window.confirm.mockReturnValue(1);

  let idToken = "asdf"

  MockAxios.delete.mockImplementationOnce(() =>
    Promise.resolve(story.Key)
  )

  const storyApp = shallow(<StoryApp />);

  storyApp.setState((prev) => {
    prev.data.push(story)
    return prev
  })

  // Test without idToken
  await storyApp.instance().deleteStory(story) …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs jestjs react-redux

4
推荐指数
1
解决办法
1万
查看次数

标签 统计

java ×1

javascript ×1

jestjs ×1

react-redux ×1

reactjs ×1

rmi ×1