Hi,
I keep on getting the following error when i try to execute the "Product"
ejb example which is shipped with Orion on dos prompt .
Communication error: Cannot instantiate class:
ormi://localhost:30/ejbsamples Web based applications run successfully . using url
http://localhost:20/ejpexp.ear Do i have to relax security restrictions using policy tool if so how ???
d:\orion\demo\ejb\product>
java ProductClient
I have orion.jar,admin.jar,ejb.jar on classpath. Settings for the same has been done in TaskManager of Windows2000 .Any help in this regards will be highly appreciated .
My classpaths in the enviroment
--------------------------------
.;e:\oracle\ora91\jdbc\lib\classes12.zip;c:\Tomcat\lib\servlet.jar;d:\struts\lib
\struts.jar;d:\struts\lib\jakarta-oro.jar;d:\struts\*.jar;d:\struts\contrib\stru
ts-el\lib\*.jar;c:\j2sdkee1.3\lib\j2ee.jar;c:\j2sdkee1.3\lib\ejbdeployment10.jar
;c:\j2sdkee1.3\lib\jhall.jar;d:\orion\orion.jar;d:\orion\jndi.jar;d:\orion\admin
.jar;d:\orion\ejb.jar
Principal.xml
-----------------
<principals>
<groups>
<group name="administrators">
<description>administrators</description>
<permission name="administration" />
</group>
<group name="guests">
<description>guests</description>
</group>
<group name="users">
<description>users</description>
<permission name="rmi:login" />
</group>
</groups>
<users>
<user username="admin" password="orion">
<description>The default administrator</description>
<group-membership group="administrators" />
<group-membership group="guests" />
<group-membership group="users" />
</user>
<user username="user" password="456">
<description>The default user</description>
<group-membership group="guests" />
<group-membership group="users" />
</user>
<user username="anonymous" password="">
<description>The default guest/anonyomous user</description>
<group-membership group="guests" />
</user>
</users>
</principals>
Server.xml
-------------
below is the path for application .
<application name="ejbsamples" path="../demo/ejb" />
below is the path for rmi.xml.
<rmi-config path="./rmi.xml" />
rmi.xml
-----------------
<rmi-server host="localhost" port="30">
<log><file path="../log/rmi.log" /></log>
</rmi-server>
Given below is code fragment of ProductClient.
----------------------------------------------
public class ProductClient
{
public static void main(
String[] args)
{
try
{
Properties prop = new Properties();
prop.put(Context.INITIAL_CONTEXT_FACTORY,"com.evermind.server.ApplicationClientInitialContextFactory");
prop.put(Context.INITIAL_CONTEXT_FACTORY,"ormi://localhost:30/ejbsamples");
prop.put(Context.SECURITY_PRINCIPAL,"admin");
prop.put(Context.SECURITY_CREDENTIALS,"orion");
Context context = new InitialContext(prop);
Object homeObject = context.lookup("java:comp/env/MyProduct");
ProductHome home = (ProductHome)PortableRemoteObject.narrow(homeObject, ProductHome.class);
application-client.xml
---------------------------
<?xml version="1.0"?>
<!DOCTYPE application-client PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application Client 1.2//EN" "http://java.sun.com/j2ee/dtds/application-client_1_2.dtd">
<application-client>
<ejb-ref>
<ejb-ref-name>MyProduct</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<home>ProductHome</home>
<remote>Product</remote>
</ejb-ref>
</application-client>
ejb-jar.xml
---------------
<ejb-jar>
<description>
</description>
<enterprise-beans>
<entity>
<description>
</description>
<ejb-name>MyProduct</ejb-name>
<home>ProductHome</home>
<remote>Product</remote>
<ejb-class>ProductEJB</ejb-class>
<primkey-class>java.lang.Integer</primkey-class>
<reentrant>True</reentrant>
<persistence-type>Container</persistence-type>
<cmp-field><field-name>id</field-name></cmp-field>
<cmp-field><field-name>name</field-name></cmp-field>
<cmp-field><field-name>description</field-name></cmp-field>
<cmp-field><field-name>price</field-name></cmp-field>
<primkey-field>id</primkey-field>
</entity>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>Product</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>NotSupported</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>