Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / June 2006

Tip: Looking for answers? Try searching our database.

J2EE CMP Bean in Sun J2EE1.4 server Problem

Thread view: 
mflll@wiu.edu - 04 Jun 2006 02:48 GMT
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
Frank Langelage - 04 Jun 2006 09:56 GMT
> 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.
[quoted text clipped - 42 lines]
>        <ejb-name>CourseBean</ejb-name>
>        <home>RS.CourseHome</home>

    <remote>RS.Course</remote>

>        <ejb-class>RS.CourseBean</ejb-class>
>        <persistence-type>Container</persistence-type>
[quoted text clipped - 41 lines]
>   public void setNumber (int n) throws RemoteException;
> }

Add this class to the deployment descriptor ejb-jar.xml as shown above
and retry.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.