Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why i canot deploy cd.jar using JBoss on linux

Status
Not open for further replies.

IPOz

Programmer
Jul 11, 2001
109
CN
Hi,friends
I have successfully deploy the interest.jar on my linux box.But when deploying cd.jar it tells me that "Could not deploy file:/usr/local/JBoss-2.4.3_Tomcat-3.2.3/jboss/tmp/deploy/Default/cd.jar,
Cause:eek:rg.jboss.ejb.DeploymentException: Bean com.web_tomorrow.cd.CDBean not found within this application."
The source directory is described as below:
src
|_com
| |_web_tomorrow
| |_cd
| | (CD.class,CDBean.class,CDHome.class,
| | CDCollection.class,
| | CDCollectionBean.class,
| | CDCollectionHome.class,
| | CDExistsException.class)
| |_jspcd
| |_utils()
|_MATA-INF
| (ejb-jar.xml,jboss.xml)
|_WEB_INF
On src directory
#jar -cvf cd.jar com/web_tomorrow/cd/*.class com/web_tomorrow/utils/*.class META-INF/
When i cp the cd.jar to deploy directory jboss automatically begin deploying the cd.jar and echo the above message and stop deploying.
Here is my configuration file:
[ejb-jar.xml]
<?xml version=&quot;1.0&quot; encoding=&quot;Cp1252&quot;?>

<ejb-jar>
<display-name>MusicCDs</display-name>
<enterprise-beans>
<entity>
<description>Models a music CD</description>
<ejb-name>CDBean</ejb-name>
<home>com.web_tomorrow.cd.CDHome</home>
<remote>com.web_tomorrow.cd.CD</remote>
<ejb-class>com.web_tomorrow.cd.CDBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.String</prim-key-class>
<reentrant>False</reentrant>
<cmp-field><field-name>id</field-name></cmp-field>
<cmp-field><field-name>title</field-name></cmp-field>
<cmp-field><field-name>artist</field-name></cmp-field>
<cmp-field><field-name>type</field-name></cmp-field>
<cmp-field><field-name>notes</field-name></cmp-field>
<primkey-field>id</primkey-field>
</entity>

<session>
<description>Models a music CD collection</description>
<ejb-name>CDCollectionBean</ejb-name>
<home>com.web_tomorrow.cd.CDCollectionHome</home>
<remote>com.web_tomorrow.cd.CDCollection</remote>
<ejb-class>com.web_tomorrow.cd.CDCollectionBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Bean</transaction-type>
<ejb-ref>
<ejb-ref-name>ejb/CD</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<home>com.web_tomorrow.cd.CDHome</home>
<remote>com.web_tomorrow.cd.CD</remote>
<ejb-link>com.web_tomorrow.cd.CDBean</ejb-link>
</ejb-ref>
</session>

</enterprise-beans>

<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>CDBean</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>

[jboss.xml]
<?xml version=&quot;1.0&quot; encoding=&quot;Cp1252&quot;?>

<jboss>
<secure>false</secure>
<container-configurations />
<resource-managers />

<enterprise-beans>
<session>
<ejb-name>CDCollectionBean</ejb-name>
<jndi-name>cd/CDCollection</jndi-name>
<configuration-name></configuration-name>
</session>

<entity>
<ejb-name>CDBean</ejb-name>
<jndi-name>cd/CD</jndi-name>
<configuration-name></configuration-name>
</entity>

</enterprise-beans>
</jboss>

I am frustrated now! Any help is greatly appreciated!

Best Regards! IPO_z@cmmail.com
Garbage in,Garbage out
 
$(jboss_home)/log/server.log told me that i should have a look at Container.java first.So i openned it and found the following code snippet:
......
Logger.debug(&quot;Binding an EJBReference &quot;+ref.getName());

if (ref.getLink() != null) {
// Internal link
Logger.debug(&quot;Binding &quot;+ref.getName()+&quot; to internal JNDI source: &quot;+ref.getLink());
Container refContainer = getApplication().getContainer(ref.getLink());
if (refContainer == null)
throw new DeploymentException (&quot;Bean &quot;+ref.getLink()+&quot; not found within this application.&quot;);
......
OK,the DeploymentException is thrown because the refContainer is null.
Have a look at getContainer method below:
public Container getContainer(String name)
{
return (Container)containers.get(name);
}
where,
containers is a HashMap which holds the mapping between ejbName and container.So the reason is the jboss cannot find corresponding container from the given parameter - name.Its value is ref.getLink()'s return value,com.web_tomorrow.cd.CDBean.
open the ejb-jar.xml,i found link is defined as below:
......
<ejb-ref>
<ejb-ref-name>ejb/CD</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<home>com.web_tomorrow.cd.CDHome</home>
<remote>com.web_tomorrow.cd.CD</remote>
<ejb-link>com.web_tomorrow.cd.CDBean</ejb-link> <- ´íÎóÖ®´¦
</ejb-ref>
......
After i changed it to <ejb-link>CDBean</ejb-link> the jboss can deploy cd.jar normally.

The problem itself isnot complicate but it demonstrated that the open source is good for you to fix the bug up!
BTW,in order to making it easy to fix the bug, the jboss binay version is built with debug infomation.So you can rebuid it without any debug infomation.
......
<target name=&quot;compile&quot; depends=&quot;prepare&quot;>
<mkdir dir=&quot;${build.classes.dir}&quot;/>
<javac srcdir=&quot;${src.dir}&quot;
destdir=&quot;${build.classes.dir}&quot;
debug=&quot;on&quot; <- ¸ÄΪ&quot;off&quot;,¾ÍÄܹصôµ÷ÊÔÐÅÏ¢????????????
deprecation=&quot;off&quot;
optimize=&quot;on&quot;
includes=&quot;org/**&quot;
excludes=&quot;**/activation/**, **/*BeanInfo.java&quot;
>
<classpath refid=&quot;classpath&quot;/>
</javac>
......
</target>

Best Regards! IPO_z@cmmail.com
Garbage in,Garbage out
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top