• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3133
  • Last Modified:

Deploying ejb using local interfaces

Hi,
I have packaged the EJB code in a jar file in the way it should be for an EJB module.How will the ejb-jar.xml look like for a single EJB in a an EJB module and when I deploy the EJB it asks me for
1)Provide JNDI Names for Beans : what value has to be given over here.
2)Map EJB references to beans : What value has to be given over here.
There is only one EJB that I have written and it using local interfaces, there are no ejb's with remote interfaces as I dont require that.
Can someone Please help me with this because it is throwing an error on deployment.
Thanks in advance,
Sumit
0
SumitSinghRawat
Asked:
SumitSinghRawat
  • 4
  • 3
1 Solution
 
damonfCommented:
All EJBs have remote interfaces, regardless of how you use them ("locally" or "remotely").

When you say "deploy" are you saying it's blowing up when you generate the deploy and RMIC code?  Or when you deploy the EAR file on the server?

If you are using WSAD, add the jar to your project, then go to EJB perspective, use the "Add Enterprise Java Bean" wizard, and when it asks for the specific classes (Home, Remote) use the ones in your jar file.  This will create the ejb-jar.xml entries for you.

JNDI name can be anything you want (e.g. "ejb/myejb"), as long as that's what you refer to in your code.  You only have to map references if you HAVE references.  If you don't remember creating them, you don't have them.
0
 
SumitSinghRawatAuthor Commented:
Hi,
I am sorry for the delay in replying..,
It is blowing up when I deploy the ear file..this is the exception:


[3/24/05 11:28:04:604 EST] 27fbea3c SystemOut     O       [EJBDeploy] An unexpected exception was thrown.  Halting execution. [Severity 2]
[3/24/05 11:28:04:604 EST] 27fbea3c DeployEJBTask E ADMA0086E: Error from EJBDeploy: An unexpected exception was thrown.  Halting execution. [severity 2]
[3/24/05 11:28:04:614 EST] 27fbea3c SystemOut     O       [EJBDeploy] An unexpected exception was thrown.  Halting execution. [Severity 2]
[3/24/05 11:28:04:614 EST] 27fbea3c DeployEJBTask W ADMA0087W: Warning from EJBDeploy: An unexpected exception was thrown.  Halting execution. [severity 2]
[3/24/05 11:28:04:674 EST] 27fbea3c SystemOut     O       [EJBDeploy] An unexpected exception was thrown.  Halting execution. [Severity 2]
[3/24/05 11:28:04:674 EST] 27fbea3c DeployEJBTask W ADMA0087W: Warning from EJBDeploy: An unexpected exception was thrown.  Halting execution. [severity 2]
[3/24/05 11:28:04:684 EST] 27fbea3c SystemOut     O       [EJBDeploy] Shutting down workbench.
[3/24/05 11:28:05:696 EST] 27fbea3c SystemOut     O       [EJBDeploy] 0
[3/24/05 11:28:05:706 EST] 27fbea3c SystemOut     O       [EJBDeploy] >com.ibm.etools.ejbdeploy.EJBDeploymentException (0)
[3/24/05 11:28:05:706 EST] 27fbea3c SystemOut     O       [EJBDeploy] java.lang.ArrayIndexOutOfBoundsException: 0
[3/24/05 11:28:05:706 EST] 27fbea3c SystemOut     O       [EJBDeploy]       at com.ibm.etools.ejbdeploy.generators.mb.RemoteMBGenerator.getExceptionCodeSnip(RemoteMBGenerator.java:156)
[3/24/05 11:28:05:706 EST] 27fbea3c SystemOut     O       [EJBDeploy]       at com.ibm.etools.ejbdeploy.gen20.cnr.LocalMBGenerator.getExceptionCodeSnip(LocalMBGenerator.java:42)
[3/24/05 11:28:05:706 EST] 27fbea3c SystemOut     O       [EJBDeploy]       at com.ibm.etools.ejbdeploy.gen20.cnr.LocalWrapperMBGenerator.run(LocalWrapperMBGenerator.java:37)
[3/24/05 11:28:05:706 EST] 27fbea3c SystemOut     O       [EJBDeploy]       at com.ibm.etools.ejbdeploy.codegen.BaseGenerator.runDependents(BaseGenerator.java:301)
[3/24/05 11:28:05:706 EST] 27fbea3c SystemOut     O       [EJBDeploy]       at com.ibm.etools.ejbdeploy.java.codegen.JavaMethodGenerator.getBody(JavaMethodGenerator.java:141)
[3/24/05 11:28:05:706 EST] 27fbea3c SystemOut     O       [EJBDeploy]       at com.ibm.etools.ejbdeploy.java.codegen.JavaMethodGenerator.generateMethod(JavaMethodGenerator.java:116)
[3/24/05 11:28:05:706 EST] 27fbea3c SystemOut     O       [EJBDeploy]       at com.ibm.etools.ejbdeploy.java.codegen.JavaMethodGenerator.generateMember(JavaMethodGenerator.java:214)
[3/24/05 11:28:05:706 EST] 27fbea3c SystemOut     O       [EJBDeploy]       at com.ibm.etools.ejbdeploy.java.codegen.JavaMemberGenerator.run(JavaMemberGenerator.java:206)
[3/24/05 11:28:05:706 EST] 27fbea3c SystemOut     O       [EJBDeploy]       at com.ibm.etools.ejbdeploy.codegen.BaseGenerator.runChildren(BaseGenerator.java:292)
[3/24/05 11:28:05:706 EST] 27fbea3c SystemOut     O       [EJBDeploy]       at com.ibm.etools.ejbdeploy.java.codegen.JavaTypeGenerator.getBody(JavaTypeGenerator.java:102)
[3/24/05 11:28:05:706 EST] 27fbea3c SystemOut     O       [EJBDeploy]       at com.ibm.etools.ejbdeploy.java.codegen.JavaTypeGenerator.generateType(JavaTypeGenerator.java:74)
[3/24/05 11:28:05:706 EST] 27fbea3c SystemOut     O       [EJBDeploy]       at com.ibm.etools.ejbdeploy.java.codegen.JavaTypeGenerator.generateMember(JavaTypeGenerator.java:220)
[3/24/05 11:28:05:706 EST] 27fbea3c SystemOut     O       [EJBDeploy]       at com.ibm.etools.ejbdeploy.java.codegen.JavaMemberGenerator.run(JavaMemberGenerator.java:206)
[3/24/05 11:28:05:706 EST] 27fbea3c SystemOut     O       [EJBDeploy]       at com.ibm.etools.ejbdeploy.codegen.BaseGenerator.runChildren(BaseGenerator.java:292)
[3/24/05 11:28:05:706 EST] 27fbea3c SystemOut     O       [EJBDeploy]       at com.ibm.etools.ejbdeploy.java.codegen.JavaCompilationUnitGenerator.run(JavaCompilationUnitGenerator.java:272)
[3/24/05 11:28:05:706 EST] 27fbea3c SystemOut     O       [EJBDeploy]       at com.ibm.etools.ejbdeploy.gen20.cnr.LocalWrapper.run(LocalWrapper.java:52)
[3/24/05 11:28:05:706 EST] 27fbea3c SystemOut     O       [EJBDeploy]       at com.ibm.etools.ejbdeploy.codegen.BaseGenerator.runChildren(BaseGenerator.java:292)
[3/24/05 11:28:05:706 EST] 27fbea3c SystemOut     O       [EJBDeploy]       at com.ibm.etools.ejbdeploy.codegen.BaseGenerator.run(BaseGenerator.java:283)
[3/24/05 11:28:05:706 EST] 27fbea3c SystemOut     O       [EJBDeploy]       at com.ibm.etools.ejbdeploy.plugin.EJBDeployOperation.deploySession2_0(EJBDeployOperation.java:874)
[3/24/05 11:28:05:706 EST] 27fbea3c SystemOut     O       [EJBDeploy]       at com.ibm.etools.ejbdeploy.plugin.EJBDeployOperation.deploySession(EJBDeployOperation.java:790)
[3/24/05 11:28:05:706 EST] 27fbea3c SystemOut     O       [EJBDeploy]       at com.ibm.etools.ejbdeploy.plugin.EJBDeployOperation.doRun(EJBDeployOperation.java:1431)
[3/24/05 11:28:05:706 EST] 27fbea3c SystemOut     O       [EJBDeploy]       at com.ibm.etools.ejbdeploy.plugin.EJBDeployOperation.run(EJBDeployOperation.java:1239)
[3/24/05 11:28:05:706 EST] 27fbea3c SystemOut     O       [EJBDeploy]       at com.ibm.etools.ejbdeploy.plugin.EJBDeployOperation.doit(EJBDeployOperation.java:910)
[3/24/05 11:28:05:706 EST] 27fbea3c SystemOut     O       [EJBDeploy]       at com.ibm.etools.ejbdeploy.batch.plugin.BatchExtension.invokeDeploymentCodegen(BatchExtension.java:1479)
[3/24/05 11:28:05:706 EST] 27fbea3c SystemOut     O       [EJBDeploy]       at com.ibm.etools.ejbdeploy.batch.plugin.BatchExtension.internalJarProcess(BatchExtension.java:496)
[3/24/05 11:28:05:706 EST] 27fbea3c SystemOut     O       [EJBDeploy]       at com.ibm.etools.ejbdeploy.batch.plugin.BatchExtension.runEarDeploy(BatchExtension.java:338)
[3/24/05 11:28:05:706 EST] 27fbea3c SystemOut     O       [EJBDeploy]       at com.ibm.etools.ejbdeploy.batch.plugin.BatchExtension.access$0(BatchExtension.java:255)
[3/24/05 11:28:05:706 EST] 27fbea3c SystemOut     O       [EJBDeploy]       at com.ibm.etools.ejbdeploy.batch.plugin.BatchExtension$RunDeploy.run(BatchExtension.java:238)
[3/24/05 11:28:05:706 EST] 27fbea3c SystemOut     O       [EJBDeploy]       at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1595)
[3/24/05 11:28:05:706 EST] 27fbea3c SystemOut     O       [EJBDeploy]       at com.ibm.etools.ejbdeploy.batch.plugin.BatchExtension$RunDeploy.execute(BatchExtension.java:222)
[3/24/05 11:28:05:706 EST] 27fbea3c SystemOut     O       [EJBDeploy]       at com.ibm.etools.ejbdeploy.batch.plugin.BatchExtension.run(BatchExtension.java:185)
[3/24/05 11:28:05:706 EST] 27fbea3c SystemOut     O       [EJBDeploy]       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[3/24/05 11:28:05:706 EST] 27fbea3c SystemOut     O       [EJBDeploy]       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
[3/24/05 11:28:05:706 EST] 27fbea3c SystemOut     O       [EJBDeploy]       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:41)
[3/24/05 11:28:05:706 EST] 27fbea3c SystemOut     O       [EJBDeploy]       at java.lang.reflect.Method.invoke(Method.java:386)
[3/24/05 11:28:05:706 EST] 27fbea3c SystemOut     O       [EJBDeploy]       at com.ibm.etools.ejbdeploy.batch.impl.BootLoaderLoader.run(BootLoaderLoader.java:255)
[3/24/05 11:28:05:706 EST] 27fbea3c SystemOut     O       [EJBDeploy]       at com.ibm.etools.ejbdeploy.batch.impl.BatchDeploy.execute(BatchDeploy.java:133)
[3/24/05 11:28:05:726 EST] 27fbea3c SystemOut     O       [EJBDeploy]       at com.ibm.etools.ejbdeploy.EJBDeploy.execute(EJBDeploy.java:80)
[3/24/05 11:28:05:736 EST] 27fbea3c SystemOut     O       [EJBDeploy]       at com.ibm.etools.ejbdeploy.EJBDeploy.main(EJBDeploy.java:307)
[3/24/05 11:28:05:746 EST] 27fbea3c SystemOut     O       [EJBDeploy] EJBDeploy level: 20031007_1915-WB212-AD-V511D-W5
[3/24/05 11:28:05:756 EST] 27fe6a3c SystemOut     O Exception in EJBDeploy : com.ibm.websphere.management.exception.AdminException: ADMA0063E: Error in EJB deploy - [An unexpected exception was thrown.  Halting execution.]
[3/24/05 11:28:05:756 EST] 27fe6a3c SystemOut     O ADMA6012I: Exception in run com.ibm.websphere.management.exception.AdminException: ADMA0063E: Error in EJB deploy - [An unexpected exception was thrown.  Halting execution.]
[3/24/05 11:28:05:756 EST] 27fe6a3c SystemOut     O Exception: com.ibm.websphere.management.exception.AdminException: ADMA0063E: Error in EJB deploy - [An unexpected exception was thrown.  Halting execution.]
[3/24/05 11:28:05:756 EST] 27fe6a3c SystemOut     O ADMA6011I: Deleting directory tree C:\DOCUME~1\fn049\LOCALS~1\Temp\app_102d5641ecc
0
 
damonfCommented:
this log is from WSAD or from WAS?  It certainly does seem that your ejb-jar.xml is not properly configured.  WSAD should help you with that, but if you are deploye and EAR file to WAS and just check the "generate deployment code" or "deploy EJBs" option, it's not going to work unless everything is configured perfectliy.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
SumitSinghRawatAuthor Commented:
This log is from WAS and I dont have WSAD with me, I am using eclipse and the ejb-jar.xml is being manually written. I am pasting the ejb-jar.xml file for your references. I have written a sample ejb with the idea of learning how to deploy an EJB on WAS. I have packaged everything in an EAR file and I am trying to deploy this on WAS.

<?xml version="1.0" encoding="Cp1252"?>
<!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN' 'http://java.sun.com/dtd/ejb-jar_2_0.dtd'>

<!-- Copyright 2002 Sun Microsystems, Inc. All rights reserved. -->

<ejb-jar>
  <display-name>MYEJB</display-name>
  <enterprise-beans>
 
    <session>
      <display-name>User</display-name>
      <ejb-name>User</ejb-name>
      <local-home>package.ejb.UserHome</local-home>
      <local>package.ejb.UserLocal</local>
      <ejb-class>package.ejb.UserBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>
      <ejb-local-ref>
            <ejb-ref-name>UserHomeEJB</ejb-ref-name>
            <ejb-ref-type>Session</ejb-ref-type>
              <local-home>package.ejb.UserHome</local-home>
              <local>package.ejb.UserLocal</local>
            <ejb-link>User</ejb-link>
  </ejb-local-ref>
    </session>
       </enterprise-beans>
  <assembly-descriptor>
   
      <container-transaction>
      <method>
            <ejb-name>User</ejb-name>
            <method-name>*</method-name>
      </method>
      <trans-attribute>Required</trans-attribute>
      </container-transaction>
      </assembly-descriptor>
</ejb-jar>

0
 
damonfCommented:
Now I see what you're trying to do.  If you are new to EJB, might I suggest going with a more standard approach (Home & Remote) rather than trying to fancy with the local stuff.

You'll a Bean Class, a Remote Interface, and a Home Interface.

Here's what a simple ejb-jar would look like for that:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar id="ejb-jar_ID">
    <display-name>MyEJB</display-name>
    <enterprise-beans>
        <session id="MyFunc">
            <description>MyFunc Stateless Session Bean</description>
            <display-name>MyFunc</display-name>
            <ejb-name>MyFunc</ejb-name>
            <home>com.mycompany.MyFuncHome</home>
            <remote>com.mycompany.MyFunc</remote>
            <ejb-class>com.mycompany.MyFuncBean</ejb-class>
            <session-type>Stateless</session-type>
            <transaction-type>Container</transaction-type>
        </session>
    </enterprise-beans>
    <assembly-descriptor>
          <container-transaction>
                <method>
                      <ejb-name>MyFunc</ejb-name>
                      <method-name>*</method-name>
                </method>
                <trans-attribute>Required</trans-attribute>
          </container-transaction>
    </assembly-descriptor>
</ejb-jar>
0
 
SumitSinghRawatAuthor Commented:
Hi,
I absolutely agree with you, I have already done what you have mentioned above and I was trying that fancy stuff where I wanted to use the ejb locally. That is where I got stuck, I was able to do what you have written, that goes smooth no problems at all.But when I try to deploy an ejb so that I can use it locally, it is bombing during the deployment process. The bean, home and local interfaces have been been written appropriately and the same deploys on Iplanet application server but when I try deploying it on WAS, it is throwing an error.
I have made changes to the ear file so that it what WAS requires but its not working..Please Help!!!
Thanks,
Sumit
0
 
SumitSinghRawatAuthor Commented:
Hi,
I have found the problem, there seems to be a classpath path problem when the RMIC code is being generated. I was looking all over the place and I must have changed the ejb-jar.xml in different ways. It is working now, anyways Thank you so much for your inputs, they were enlightening on other fronts.
Thanks,
Sumit
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now