M
mflll
I am having trouble preparing my Container-Managed Bean for deployment
(my first work with J2EE). I am using the J2EE 1.4 from Sun.
I get the following error messages from the verifier:
--------------
FAILED TESTS :
--------------
Test Name : tests.ejb.MethodPermissionComponentInterface
Test Assertion : All methods of all interfaces must have an
associated security pemission.
Test Description : The test generated the following exception [ null
].
Test Name : tests.ejb.elements.UncheckedMethodsExist
Test Assertion : Methods used in [unchecked] must be methods defined
in the enterprise bean's remote and/or home interface test
Test Description : For [ RegistrationSystem#Course.jar#CourseBean ]
Exception: [ java.lang.RuntimeException ]
Test Name : tests.ejb.EjbHasLocalorRemoteorBothInterfaces
Test Assertion : Bean type test
Test Description : For [ RegistrationSystem#Course.jar#CourseBean ]
Ejb [ RS.CourseBean ] does not have local or remote interfaces
Test Name : tests.ejb.elements.ExcludeListMethodsExist
Test Assertion : Methods used in exclude-list must be methods defined
in the enterprise bean's remote and/or home interface test
Test Description : For [ RegistrationSystem#Course.jar#CourseBean ]
Exception: [ java.lang.RuntimeException ]
Here is my ejb-jar.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"
version="2.1">
<enterprise-beans>
<entity>
<description>Course</description>
<display-name>CourseBean</display-name>
<ejb-name>CourseBean</ejb-name>
<home>RS.CourseHome</home>
<ejb-class>RS.CourseBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>RS.CoursePK</prim-key-class>
<reentrant>false</reentrant>
<abstract-schema-name>Course</abstract-schema-name>
<cmp-field><field-name>number</field-name></cmp-field>
<cmp-field><field-name>name</field-name></cmp-field>
</entity>
</enterprise-beans>
<assembly-descriptor>
<security-role>
<description>Everyone</description>
<role-name>everyone</role-name>
</security-role>
<method-permission>
<unchecked/>
<method>
<ejb-name>CourseBean</ejb-name>
<method-name>*</method-name>
</method>
</method-permission>
<container-transaction>
<method>
<ejb-name>CourseBean</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
(I also put in a Sun-ejb-jar.xml but that does not seem to be related.)
Here are the relevant java files:
Course.java
package RS;
import java.rmi.RemoteException;
public interface Course extends javax.ejb.EJBObject {
public String getName() throws RemoteException;
public void setName (String Str) throws RemoteException;
public int getNumber() throws RemoteException;
public void setNumber (int n) throws RemoteException;
}
CourseHome.java
package RS;
import java.rmi.RemoteException;
import javax.ejb.CreateException;
import javax.ejb.FinderException;
public interface CourseHome extends javax.ejb.EJBHome {
public Course create(int id) throws
CreateException,RemoteException;
public Course findByPrimaryKey(CoursePK pk)
throws FinderException,RemoteException;
}
CourseBean.java
package RS;
import javax.ejb.EntityContext;
public abstract class CourseBean implements javax.ejb.EntityBean {
public CoursePK ejbCreate (int number){
this.setNumber(number);
return null;
}
public void ejbPostCreate (int number) {
}
public abstract String getName();
public abstract void setName (String str);
public abstract int getNumber ();
public abstract void setNumber (int number);
public void setEntityContext (EntityContext ctx) {}
public void unsetEntityContext() {}
public void ejbActivate () {}
public void ejbPassivate () {}
public void ejbLoad () {}
public void ejbStore () {}
public void ejbRemove() {}
And, here is the jar listing of the Course.ear file I submit to the
verifier:
0 Fri Jun 02 11:30:14 CDT 2006 META-INF/
71 Fri Jun 02 11:30:14 CDT 2006 META-INF/MANIFEST.MF
2280 Fri Jun 02 11:30:14 CDT 2006 D.war
523 Fri Jun 02 11:30:14 CDT 2006 META-INF/application.xml
3115 Fri Jun 02 11:30:14 CDT 2006 Course.jar
And here is the listing of the embedded Course.jar:
0 Fri Jun 02 11:30:14 CDT 2006 META-INF/
71 Fri Jun 02 11:30:14 CDT 2006 META-INF/MANIFEST.MF
912 Fri Jun 02 11:30:14 CDT 2006 RS/CourseBean.class
342 Fri Jun 02 11:30:14 CDT 2006 RS/Course.class
348 Fri Jun 02 11:30:14 CDT 2006 RS/CourseHome.class
409 Fri Jun 02 11:30:14 CDT 2006 RS/CoursePK.class
1469 Sat May 27 14:11:16 CDT 2006 META-INF/ejb-jar.xml
652 Fri Jun 02 11:26:46 CDT 2006 META-INF/Sun-ejb-jar.xml
And here is the META-INF/application.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<application
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/application_1_4.xsd"
version="1.4"<display-name>RegistrationSystem</display-name>
<module>
<ejb>Course.jar</ejb>
</module>
<module>
<web>
<web-uri>D.war</web-uri>
<context-root>D</context-root>
</web>
</module>
</application>
Dr. Laurence Leff, Associate Professor of Computer Science
Western Illinois University, 1 University Circle Macomb IL 61455
Pager: 309 367 0787 Fax: 309 298 2302
(my first work with J2EE). I am using the J2EE 1.4 from Sun.
I get the following error messages from the verifier:
--------------
FAILED TESTS :
--------------
Test Name : tests.ejb.MethodPermissionComponentInterface
Test Assertion : All methods of all interfaces must have an
associated security pemission.
Test Description : The test generated the following exception [ null
].
Test Name : tests.ejb.elements.UncheckedMethodsExist
Test Assertion : Methods used in [unchecked] must be methods defined
in the enterprise bean's remote and/or home interface test
Test Description : For [ RegistrationSystem#Course.jar#CourseBean ]
Exception: [ java.lang.RuntimeException ]
Test Name : tests.ejb.EjbHasLocalorRemoteorBothInterfaces
Test Assertion : Bean type test
Test Description : For [ RegistrationSystem#Course.jar#CourseBean ]
Ejb [ RS.CourseBean ] does not have local or remote interfaces
Test Name : tests.ejb.elements.ExcludeListMethodsExist
Test Assertion : Methods used in exclude-list must be methods defined
in the enterprise bean's remote and/or home interface test
Test Description : For [ RegistrationSystem#Course.jar#CourseBean ]
Exception: [ java.lang.RuntimeException ]
Here is my ejb-jar.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"
version="2.1">
<enterprise-beans>
<entity>
<description>Course</description>
<display-name>CourseBean</display-name>
<ejb-name>CourseBean</ejb-name>
<home>RS.CourseHome</home>
<ejb-class>RS.CourseBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>RS.CoursePK</prim-key-class>
<reentrant>false</reentrant>
<abstract-schema-name>Course</abstract-schema-name>
<cmp-field><field-name>number</field-name></cmp-field>
<cmp-field><field-name>name</field-name></cmp-field>
</entity>
</enterprise-beans>
<assembly-descriptor>
<security-role>
<description>Everyone</description>
<role-name>everyone</role-name>
</security-role>
<method-permission>
<unchecked/>
<method>
<ejb-name>CourseBean</ejb-name>
<method-name>*</method-name>
</method>
</method-permission>
<container-transaction>
<method>
<ejb-name>CourseBean</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
(I also put in a Sun-ejb-jar.xml but that does not seem to be related.)
Here are the relevant java files:
Course.java
package RS;
import java.rmi.RemoteException;
public interface Course extends javax.ejb.EJBObject {
public String getName() throws RemoteException;
public void setName (String Str) throws RemoteException;
public int getNumber() throws RemoteException;
public void setNumber (int n) throws RemoteException;
}
CourseHome.java
package RS;
import java.rmi.RemoteException;
import javax.ejb.CreateException;
import javax.ejb.FinderException;
public interface CourseHome extends javax.ejb.EJBHome {
public Course create(int id) throws
CreateException,RemoteException;
public Course findByPrimaryKey(CoursePK pk)
throws FinderException,RemoteException;
}
CourseBean.java
package RS;
import javax.ejb.EntityContext;
public abstract class CourseBean implements javax.ejb.EntityBean {
public CoursePK ejbCreate (int number){
this.setNumber(number);
return null;
}
public void ejbPostCreate (int number) {
}
public abstract String getName();
public abstract void setName (String str);
public abstract int getNumber ();
public abstract void setNumber (int number);
public void setEntityContext (EntityContext ctx) {}
public void unsetEntityContext() {}
public void ejbActivate () {}
public void ejbPassivate () {}
public void ejbLoad () {}
public void ejbStore () {}
public void ejbRemove() {}
And, here is the jar listing of the Course.ear file I submit to the
verifier:
0 Fri Jun 02 11:30:14 CDT 2006 META-INF/
71 Fri Jun 02 11:30:14 CDT 2006 META-INF/MANIFEST.MF
2280 Fri Jun 02 11:30:14 CDT 2006 D.war
523 Fri Jun 02 11:30:14 CDT 2006 META-INF/application.xml
3115 Fri Jun 02 11:30:14 CDT 2006 Course.jar
And here is the listing of the embedded Course.jar:
0 Fri Jun 02 11:30:14 CDT 2006 META-INF/
71 Fri Jun 02 11:30:14 CDT 2006 META-INF/MANIFEST.MF
912 Fri Jun 02 11:30:14 CDT 2006 RS/CourseBean.class
342 Fri Jun 02 11:30:14 CDT 2006 RS/Course.class
348 Fri Jun 02 11:30:14 CDT 2006 RS/CourseHome.class
409 Fri Jun 02 11:30:14 CDT 2006 RS/CoursePK.class
1469 Sat May 27 14:11:16 CDT 2006 META-INF/ejb-jar.xml
652 Fri Jun 02 11:26:46 CDT 2006 META-INF/Sun-ejb-jar.xml
And here is the META-INF/application.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<application
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/application_1_4.xsd"
version="1.4"<display-name>RegistrationSystem</display-name>
<module>
<ejb>Course.jar</ejb>
</module>
<module>
<web>
<web-uri>D.war</web-uri>
<context-root>D</context-root>
</web>
</module>
</application>
Dr. Laurence Leff, Associate Professor of Computer Science
Western Illinois University, 1 University Circle Macomb IL 61455
Pager: 309 367 0787 Fax: 309 298 2302