5
I created a policy file that gives permission for my machine to run both the client and the server, I also passed the ports to them. Inside the server I prompt RMI Security (since if I remove it the policy does not work)
Started server works ok. Client starts working ok. I finish inserting the last field to create a new user in the database and comes these errors.
Client:
java.rmi.Unmarshalexception: Error unmarshaling Return; nested Exception is: java.lang.Classnotfoundexception: javax.persistence.Persistenceexception (no security manager: RMI class Loader disabled) at sun.rmi.transport.StreamRemoteCall.executeCall(Streamremotecall.java:247) at sun.rmi.server.UnicastRef.invoke(Unicastref.java:162) at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(Remoteobjectinvocationhandler.java:194) at java.rmi.server.RemoteObjectInvocationHandler.invoke(Remoteobjectinvocationhandler.java:148) at com.sun.proxy. $Proxy0.insert(Unknown Source) at rmi.cliente.Servicos.addirUsuario(Servicos.java:42) at rmi.cliente.Rmicliente.main(Rmicliente.java:16) Caused by: java.lang.Classnotfoundexception: javax.persistence.Persistenceexception (no security manager: RMI class Loader disabled) at sun.rmi.server.LoaderHandler.loadClass(Loaderhandler.java:396) at sun.rmi.server.LoaderHandler.loadClass(Loaderhandler.java:186) at java.rmi.server.Rmiclassloader$2.loadClass(Rmiclassloader.java:637) at java.rmi.server.RMIClassLoader.loadClass(Rmiclassloader.java:264) at sun.rmi.server.MarshalInputStream.resolveClass(Marshalinputstream.java:214) at java.io.Objectinputstream.readNonProxyDesc(Objectinputstream.java:1613) at java.io.Objectinputstream.readClassDesc(Objectinputstream.java:1518) at java.io.Objectinputstream.readOrdinaryObject(Objectinputstream.java:1774) at java.io.Objectinputstream.readObject0(Objectinputstream.java:1351) at java.io.Objectinputstream.readObject(Objectinputstream.java:371) at sun.rmi.transport.StreamRemoteCall.executeCall(Streamremotecall.java:245) ... 6 more
Note: The server stopped giving error, now it is only the client.
Victor, I put in the JAR, and then the mistake changed! Exception in thread "main" javax.persistence.Persistenceexception: No Persistence Provider for Entitymanager named Servidorpu at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:61) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:39)
– Joana
@Joana Esse is probably the error that happened on the server. This error is saying that the file
persistence.xml
was not found on the server side with a persistence-Unit called Servorpu.– Victor Stafusa
"Add the class javax.persistence.Persistenceexception separately in the client’s classpath." as I do this?
– Joana
Yeah, except he’s in the server code... rs
– Joana
@Joana, in the latter, create a JAR with only this class. However, I do not guarantee that it works. And it will only work if the first alternative also works (but the opposite is not necessarily true).
– Victor Stafusa
@Joana, maybe the
persistence.xml
is in the wrong folder.– Victor Stafusa
Strange is that when I give Grant all no policy everything works =( haha
– Joana
@Joana So this is probably the server error. There were two errors, one on the server and one on the client. The server error is this policy. Customer error was the problem of serialization of
PersistenceException
.– Victor Stafusa