Nuts, that's what I had figured out, but I'm still having problems. But I'm not sure what's causing it. I'd hoped that I missed something on the clientSideRequest portion of the process.
The call to the server is failing
Exception in thread "AWT-EventQueue-0" com.webobjects.foundation.NSForwardException for java.net.SocketException: Broken pipe at java.net.SocketOutputStream.socketWrite0(Native Method) at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92) at java.net.SocketOutputStream.write(SocketOutputStream.java:136) at java.io.ByteArrayOutputStream.writeTo(ByteArrayOutputStream.java:112) at com.webobjects.eodistribution.client.EOHTTPChannel._responseToMessage(EOHTTPChannel.java:519) at com.webobjects.eodistribution.client.EOHTTPChannel.responseToMessage(EOHTTPChannel.java:603) at com.webobjects.eodistribution.client.EODistributedObjectStore.invokeStatelessRemoteMethodWithKeyPath(EODistributedObjectStore.java:1099) at com.bestmaid.bakeryManagement.client.utility.RemoteMethodInvoker.invokeStatelessRemoteMethodWithKeyPath(RemoteMethodInvoker.java:83) at com.bestmaid.bakeryManagement.client.utility.RemoteMethodInvoker.invokeStatelessOnSession(RemoteMethodInvoker.java:99) at com.bestmaid.bakeryManagement.client.utility.BMRMI.getFetchSpecification(BMRMI.java:49) at com.bestmaid.bakeryManagement.client.nutrition._NutritionElementType.fetchUSDACalories(_NutritionElementType.java:68)
_NutritionElementType.java
67 public static NSArray fetchUSDACalories( EOEditingContext ec ) { 68 EOFetchSpecification fs = BMRMI.getFetchSpecification("USDACalories","NutritionElementType"); 69 return ec.objectsWithFetchSpecification(fs); 70 } 71
BMRMI.java
public static EOFetchSpecification getFetchSpecification( String spec, String entity) {
// invoke! return (EOFetchSpecification) invokeStatelessOnSession( "clientSideRequestGetFetchSpecification", new Class[] { String.class, String.class }, new String[] { spec, entity }); }
RemoteMethodInvoker.java
public static Object invokeStatelessRemoteMethodWithKeyPath( String keyPath, String methodName, Class[] argumentTypes, Object[] arguments) { if(dos == null){ throw new IllegalStateException("Distributed object store is null, can not perform RMI"); }
return dos.invokeStatelessRemoteMethodWithKeyPath( keyPath, methodName, argumentTypes, arguments); }
/** * Invokes {@link #invokeStatelessRemoteMethodWithKeyPath(String, String, Class[], Object[])} * with "session" as the key path argument. */ public static Object invokeStatelessOnSession( String methodName, Class[] argumentTypes, Object[] arguments){
return invokeStatelessRemoteMethodWithKeyPath( "session", methodName, argumentTypes, arguments); }
Session.java
public EOFetchSpecification clientSideRequestGetFetchSpecification(String spec, String entity) { return getFetchSpecification(spec, entity); }
/** * Loads and returns an <tt>EOFetchSpecification</tt> objects for the given * specification and entity name. * @param spec Name of the specification @param entity Name of the entity @return A fetch specification, or <tt>null</tt> if it is not found, or an error occurs */ public EOFetchSpecification getFetchSpecification(String spec, String entity){ try{ return EOFetchSpecification.fetchSpecificationNamed(spec, entity); }catch(Exception ex){ NSLog.out.appendln(ex); return null; } }
I put the BMRMI.setDistributedObjectStore((EODistributedObjectStore)EOEditingContext.defaultParentObjectStore()); call in my BMGenericRecord that all my client-side classes extend.
It seems like it's making the trip to the server, and making it as far as executing getFetchSpecification, but then fails and prints the exception above.
Any ideas?
Dave
On Feb 15, 2008, at 10:18 AM, Florijan Stamenkovic wrote: Ah, sorry Dave, just saw that I copied the same method twice... :)
Here's the server side:
public EOFetchSpecification clientSideRequestGetFetchSpecification(String spec, String entity){ try{ return EOFetchSpecification.fetchSpecificationNamed(spec, entity); }catch(Exception ex){ return null; } }
On Feb 15, 2008, at 07:44, David Avendasora wrote:
Hi Flor,
What does the clientSideRequestGetFetchSpecification method that goes along with this in the Session class look like?
Thanks,
Dave
On Jan 14, 2008, at 3:04 PM, Florijan Stamenkovic wrote:
Server code, in the Session class:
/** * Loads and returns an <tt>EOFetchSpecification</tt> objects for the given * specification and entity name. * @param spec Name of the specification @param entity Name of the entitiy @return A fetch specification, or <tt>null</tt> if it is not found, or an error occurs */ public EOFetchSpecification getFetchSpecification(String spec, String entity){ try{ return EOFetchSpecification.fetchSpecificationNamed(spec, entity); }catch(Exception ex){ return null; } }
|