• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB Programming Restriction

 
Subramanian Murali
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I was going through the EJB Programming Restrictions in the link http://www.conceptgo.com/gsejb/ov05.html.

One of the restrictions is

"The enterprise bean must not attempt to define a class in a package."

Can anybody help me out in finding out the reason for the above restriction?

Thanks.
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please check out the following discussion on this topic.
 
Subramanian Murali
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank U Very Much Valentin!
 
Subramanian Murali
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Valentin,

U r saying that we are not allowed to use the ClassLoader.defineClass() and ClassLoader.definePackage() methods within your bean classes

But the restriction is "

"The enterprise bean must not attempt to define a class in a <b> package <b>."

Can u please explain?
 
raghu vadranam
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I feel if you define a class in a package it may create problems in deploying that bean in other servers.
 
Subramanian Murali
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Still not clear valentin!
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you define a class you have to tell the classloader in which package you want to create it. This restriction is in place to avoid opening security holes by allowing people to define classes that the container could use in place of the container-specific ones it has generated. Don't bother too much about that, just know that you are not allowed to do that if you want your beans to be portable across application servers
 
Subramanian Murali
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Valentin!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic