?
Solved

Deploying ejb using local interfaces

Posted on 2005-03-22
7
Medium Priority
?
3,121 Views
Last Modified: 2013-12-10
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
Comment
Question by:SumitSinghRawat
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 7

Accepted Solution

by:
damonf earned 2000 total points
ID: 13611424
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
 

Author Comment

by:SumitSinghRawat
ID: 13623444
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
 
LVL 7

Expert Comment

by:damonf
ID: 13623569
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:SumitSinghRawat
ID: 13624393
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
 
LVL 7

Expert Comment

by:damonf
ID: 13624737
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
 

Author Comment

by:SumitSinghRawat
ID: 13624795
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
 

Author Comment

by:SumitSinghRawat
ID: 13625273
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

Plug and play, no additional software required!

The ATEN UE3310 USB3.1 Gen1 Extender Cable allows users to extend the distance between the computer and USB devices up to 10 m (33 ft). The UE3310 is a high-quality, cost-effective solution for professional environments such as hospitals, factories and business facilities.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Upgrading Tomcat – There are a couple of methods to upgrade Tomcat is to use The Apache Installer is to download and unzip and run the services.bat remove|install Tomcat6 Because of the App that we are working with, we can only use Tomcat 6.…
There are numerous questions about how to setup an IBM HTTP Server to be administered from WebSphere Application Server administrative console. I do hope this article will wrap things up and become a reference for this task. You need three things…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question