public class Client
{
public static void main(String [] args)
{
try
{
Context jndiContext = getInitialContext();
run.client:
[java] javax.naming.NamingException: Cannot unmarshall service ref meta data [Root exception is java.io.IOException: unknown protocol: vfs]
[java] at org.jboss.ws.core.jaxrpc.client.ServiceObjectFactoryJAXRPC.getObjectInstance(ServiceObjectFactoryJAXRPC.java:120)
[java] at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
[java] at org.jnp.interfaces.NamingContext.getObjectInstance(NamingContext.java:1483)
[java] at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1500)
[java] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:824)
[java] at org.jboss.naming.client.java.javaURLContextFactory$EncContextProxy.invoke(javaURLContextFactory.java:153)
[java] at $Proxy0.lookup(Unknown Source)
[java] at javax.naming.InitialContext.lookup(InitialContext.java:392)
[java] at com.titan.clients.Client.main(Client.java:19)
[java] Caused by: java.io.IOException: unknown protocol: vfs
[java] at java.net.URL.readObject(URL.java:1220)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:597)
[java] at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:974)
[java] at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1848)
[java] at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1752)
[java] at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
[java] at java.io.ObjectInputStream.access$300(ObjectInputStream.java:187)
[java] at java.io.ObjectInputStream$GetFieldImpl.readFields(ObjectInputStream.java:2108)
[java] at java.io.ObjectInputStream.readFields(ObjectInputStream.java:518)
[java] at org.jboss.metadata.serviceref.VirtualFileAdaptor.readObject(VirtualFileAdaptor.java:217)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:597)
[java] at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:974)
[java] at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1848)
[java] at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1752)
[java] at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
[java] at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
[java] at org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedServiceRefMetaData.readObject(UnifiedServiceRefMetaData.java:477)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:597)
[java] at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:974)
[java] at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1848)
[java] at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1752)
[java] at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
[java] at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
[java] at org.jboss.ws.core.jaxrpc.client.ServiceObjectFactoryJAXRPC.getObjectInstance(ServiceObjectFactoryJAXRPC.java:115)
[java] ... 8 more
BUILD SUCCESSFUL
Total time: 2 seconds
TravelAgentService service = (TravelAgentService) jndiContext.lookup("java:comp/env/service/TravelAgentService");
TravelAgent agent = service.getTravelAgentPort();
Cabin cabin_1 = new Cabin();
cabin_1.setId(1);
cabin_1.setName("Master Suite");
cabin_1.setDeckLevel(1);
cabin_1.setShipId(1);
cabin_1.setBedCount(3);
agent.createCabin(cabin_1);
Cabin cabin_2 = agent.findCabin(1);
System.out.println(cabin_2.getName());
System.out.println(cabin_2.getDeckLevel());
System.out.println(cabin_2.getShipId());
System.out.println(cabin_2.getBedCount());
}
catch (javax.naming.NamingException ne)
{
ne.printStackTrace();
}
catch (java.rmi.RemoteException re)
{
re.printStackTrace();
}
catch (javax.xml.rpc.ServiceException se)
{
se.printStackTrace();
}
}
public static Context getInitialContext()
throws javax.naming.NamingException
{
return new javax.naming.InitialContext();
}
}