EJB project creation in Eclipse

Hi All,
i am using Eclipse 3.2 to create an EJB module.
i created a new EJB project......in it in ejbModule, i created a package and a JAVA class in it...........
when in the JAVA class, i wrote import javax.ejb.SessionBean; it gave error on javax.ejb saying "javax.ejb cant be resolved"............
Can anybody suggest how to rectify this error.
Thanks,
Rajeev Gupta

Hi All,
i created a jar file for my ejb project...........
Now i imported that jar file in a new java prj, then i am able to instantiate that ejb class in the main method of the new java prj.........
In the window i can also see all methods of the ejb class.........
My ejb-jar xml file is having the below content:
<ejb-jar id="ejb-jar_ID" version="2.1" 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">
     <description>Hello World EJB description</description>
     <display-name>prjHelloWorldEJB</display-name>
     <enterprise-beans>          
               <ejb-name>HelloWorldEJB</ejb-name>
               <ejb-class>pkgHelloWorldEJB.HelloWorldEJB</ejb-class>               
               <session-type>Stateless</session-type>
               <transaction-type>Container</transaction-type>          
     </enterprise-beans>
</ejb-jar>
Like i declared a function:
public String strReturn(){
          return "Hello JAVA EJB World";     
When i called this function by obj.strReturn() then no compilation error was there.
<b>But when i run this JAVA prj application, it gave error java.lang.NoClassDefFoundError: pkgEJB/ClassEJB
     at pkg.class.main of JAVA prj application</b>.
Can anybody suggest me what should i do to rectify this situation.
Thanks,
Rajeev Gupta

Similar Messages

  • EJB project in Eclipse 3.2

    Hi All,
    i am trying to develop a demo EJB project in Eclipse 3.2 so after it i can use it in some other demo project.....i am not developing a adapter module.....i am developing a simple EJB project by implementing SessionBean only.
    now i am facing a problem that     i am not able to see EJB Candidate   in  my EJB-Project, so i am not able to add my class file to ejb-jar xml file........i am also not able to see ejb-j2ee-engine.xml............
    So can anybody help me to rectify this situation.
    Thanks,
    Rajeev Gupta

    Hi Wang,
    i am not developing a adapter module......i am developing just a demo ejb project in Eclipse 3.2 for using it in another java prj.....well my above problem is resolved now...........
    now i am facing the below issue:
    i created a jar file for my ejb project...........then i imported that jar file in a new java prj, then i am able to instantiate that ejb class in the main method of the new java prj.........
    In the window i can also see all methods of the ejb class.........
    My ejb-jar xml file is having the below content:
    <ejb-jar id="ejb-jar_ID" version="2.1" 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">
    <description>Hello World EJB description</description>
    <display-name>prjHelloWorldEJB</display-name>
    <enterprise-beans>
    <ejb-name>HelloWorldEJB</ejb-name>
    <ejb-class>pkgHelloWorldEJB.HelloWorldEJB</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    </enterprise-beans>
    </ejb-jar>
    Like i declared a function:
    public String strReturn(){
    return "Hello JAVA EJB World";
    When i called this function by obj.strReturn() then no compilation error was there.
    <b>But when i run this JAVA prj application, it gave error java.lang.NoClassDefFoundError: pkgEJB/ClassEJB
    at pkg.class.main of JAVA prj application.</b>
    Can anybody suggest me what should i do to rectify this situation.
    Thanks,
    Rajeev Gupta

  • Problem building EJB jar file using Eclipse

    Hi,
    Here's my file sturcture.
    ejb\x\y\z\test\
    ejb\x\y\z\test1\
    'ejb' is the root directory.
    The java source files under 'test' have a package name x.y.z.test.
    The java source files under 'test1' have a package name x.y.z.test1.
    I want to build a EJB jar file for 'test' and 'test1' separately. In eclipse when I create an EJB project, I specify the root folder as the source in the java build path settings. So the project explorer in Eclipse shows both the packages since they are under the same root folder. When I try to do 'Export - EJB Jar File', it includes both the 'test' and 'test1' in the .jar. Is there a way to build them separately ?
    Thanks,

    As far as I know, there is no way in Eclipse to specify a package prefix for a source folder. Assuming that you are not using an operating system with support for symbolic links at FS-level, the only way I can think of solving your problem is via linked folders and includes/excludes.
    1. Create two ejb projects in your workspace. Specify locations somewhere independent of where the root of your source tree is located.
    2. Right click on proj1 and select Properties / Java Build Path / Source.
    3. Click Link Source and specify the location to your source root on disk. Click Next.
    4. In the inclusion patterns section, add a pattern that captures classes appropriate for that module. Click Finish.
    5. Delete the original source directory that was created during project creation before leaving Build Path configuration dialog.
    6. Repeat steps 2-5 on the second project, except specify a different inclusion pattern.
    This should produce a project structure that Eclipse will be happy with, but you have to be a little bit careful. Even though you filtered out classes from the view of the java compiler for a particular project, you will still see them listed in the various navigational views (such as Package Explorer or Project Explorer). Don't modify these filtered out files. The project that is supposed to be building them will not react to changes in the other project. You will have to manually refresh (right click on project and select refresh) the other project before the java compiler will see changes.
    Hope this will help you out.
    - Konstantin

  • EJB Project  couldnu00B4t be created

    Hello,
    I updated my NW Developer Studio to 2.0.15, Build id: 200511290548. Now the problem occurs that I cannot create a new EJB Project. Following error is shown up: New project couln´t be created.
    In the log the error starts with following message:
    !ENTRY com.sap.ide.metamodel.core 1 1 Jul 31, 2006 14:38:19.281
    !MESSAGE Updating metamodel archives from classpath for project MailAdapterModule
    !ENTRY com.tssap.util 4 0 Jul 31, 2006 14:38:20.804
    !MESSAGE Jul 31, 2006 2:38:20 PM  com.tssap.j2ee.ui.creation.internal.AbstractJ2eeProjectCr... [Thread[main,5,main]] Error: method: createNewProject -> problems with runnable for j2ee-project
    !STACK 0
    java.lang.reflect.InvocationTargetException
         at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:313)
    Any ideas?
    Regards
    Michael

    Hi Michael,
    I have heard of (and experienced) a number of different issues with NWDS SP15. Rather than trying to fight it, you could try installing SP16 or SP17 and see if that solves the problem.
    Regards,
    Thorsten

  • How to call external jar files in EJB project for CE

    Hi,
    I would be thankful if someone could help me with this -
    I need to call the external jar files into my EJB project - Here is what I have done and am getting runtime exception as  -
    java.lang.RuntimeException: java.lang.NoClassDefFoundError: com/glance/pdf/pt/PTDoc
    1. Created a EJB  project" HelloWorld "  using Java perspective in NWDS 7.1 called with client as HelloWorldClient and EAR project as HelloWorldEAR.
    2. Am working on HelloWorld project (1st one).
    3. In my code I am instantiating a class which is a class in one of  the external jar file that I need to refer in my project.
    4. I have set the Java Build path but it works only for the compile time and fails during runtime.
    5. Have read I need to create external library DC and refer in my project "HelloWorld".
    Can anyone help me with exact steps what needs to be done - during creation of external library project and then for my "HelloWorld" EJB project. How would I be able to reference or set the external library project in my EJB project?
    Looking forward to hear from experts.
    Thanks,
    Shiv
    Edited by: Shiv Khullar on Aug 30, 2010 9:39 PM

    Hi Edson,
    I tried it , but it still gives me runtime exception.
    javax.ejb.EJBException: nested exception is: java.lang.RuntimeException: java.lang.NoClassDefFoundError: com/glance/pdf/pt/PTDoc
    java.lang.RuntimeException: java.lang.NoClassDefFoundError: com/glance/pdf/pt/PTDoc
    Steps I performed are -
    1. Created a library project and created 2 Public parts "Compilation" and "Assembly"
    2. Build the library project.
    Now in my EJB project using Project Explorer - set the classpath and added both compilation jar and assembly jar files.
    This is how the classpath entries for external library looks like -
    <classpathentry kind="lib" path="/LocalDevelopmentLocalDevelopmentexternallibrarypdftoolsforwatermarkingdemo.sap.com/gen/default/public/WatermarkAssembly/lib/java/demo.sap.comexternallibrarypdftoolsforwatermarking~WatermarkAssembly.jar"/>
         <classpathentry kind="lib" path="/LocalDevelopmentLocalDevelopmentexternallibrarypdftoolsforwatermarkingdemo.sap.com/gen/default/public/WatermarkCompilation/lib/java/demo.sap.comexternallibrarypdftoolsforwatermarking~WatermarkCompilation.jar"/>
    I have also added the jar files I used in my external library project as "User Library" from Java Build Path . I dont do it , then the code fails during compilation itself.
    Regards,
    Shiv

  • "add and remove projects" problem in eclipse weblogic tool 1.1.3

    Hello,
    i installed eclipse weblogic tool 1.1.3. When i try to add a project to the server, it cannot even list my java projects. I found out that it only list those dynamic web projects.
    My question is: is it possible to add java project to server. My java project includes src and webRoot, which is deployed in weblogic 10.
    Also, when i set a breakpoint in jsp. I always have the source not found problem. Is there a way to get around this?
    Thanks

    Hi
    Java project cannot be deployed to the server standalone.
    One way to do is to create a ear project and add the web project and java project to it. If you create the web project and java project after EAR project creation then you can add to ear when creating web and java projects.
    But if you already have web and java projects, create a ear project and right click on ear project -> properties -> project reference -> check both projects. Also right click on ear project -> properties -> j2ee module dependencies -> check both projects.
    Now build the ear project and you will see the java project part of ear and the web project can refer to the java project classes.
    Vimala-

  • JPA facet in EJB project

    Hi!
    Trying to develop ejb 3 project. No problem creating ejb3 session beans.
    But I'm not able to enable JPA facet in ejb project. Only supported in web project.
    Can this be true? Is support for EJB 3/JPA still lacking even in 10.3 version?
    Very disapointing....
    Regards,
    Jesper

    To clarify...
    There is no support for JPA in EJB projects in Workshop. Workshop JPA tools can only be used in web projects.
    Base Eclipse, however, comes with a different set of JPA tools that can be used with EJB or Utility projects. Oracle Enterprise Pack for Eclipse (OEPE) works with this JPA toolset (unlike Workshop). Version 1.0 of OEPE is already available (see link that Danny provided). The next version of OEPE (available in Q1 of 2009) will include additional JPA functionality that is even better than similar functionality currently available in Workshop. All of the new JPA functionality coming in the next OEPE release will be supported for Web, EJB and Utility projects.
    Hope this helps.
    - Konstantin

  • Can't use JPA facet in a Workshop 10.3 EJB project

    Greetings,
    I'm using Oracle Workshop for WebLogic 10.3 to migrate an enterprise application from JBoss 5.0 to WebLogic 10.3. I'm a bit confused as, while I can add the JPA facet to a Dynamic Web project, I cannot do the same with an EJB project. I'd need to take advantage of the IDE automatic facets management instead to manually dealing with libraries and dependencies. I beleive that this is the reason these facets exist. However, after having created a EJB 3.0 project, it is impossible to add to it the JPA facet. I had to define the JPA entities in a Dynamic Web project as this is the only one to which I can add the JPA facet. This is not regular. Additionally, the SLSB facades may only be defined in an EJB project. They reference the JPA entities in the Dynamic Web project which, given the class loading hierarchy, is not possible. So my question is: how is one supposed to use JPA with WTP projects ?
    Many thanks in advance for any help,
    Nicolas

    This isn't supported in Workshop 10.3 and prior, the JPA tooling only works with Dynamic Web Projects in those releases to my knowledge.
    I think this changed in OEPE 11g. Check out this article that shows JPA being used in the context of a Utility Project:
    http://www.oracle.com/technology/pub/articles/cioroianu-eclipse-jpa.html
    OEPE 11g Download: http://www.oracle.com/technology/software/products/oepe/index.html

  • Portal Service Project creation in EP5 SP5 in java

    We have created on service(test) in eclipse but after build this project we are not getting testapi.jar and testcore.jar files under lib and lib\private folders.
    we don't what might be the problem. Please let us know if any documents for the portal sevice project creation.

    Hi Harsh
    Thanks for your quick reply......
    I agree with you that by flexible field mapping we can do but my concern is that service activity should have services also defined in MSP  because when this will come to SAP , it will ask for services & if services are not available then this will fail.
    Please suggest your opinion ..
    Regards,
    Ashok Sangal

  • How to run the ejb project in j2ee server

    How to run the EJB project.
    I give like
    java conveterClient converterClient.jar
    here conveterClient is class file name and converterClient.jar is deployed file
    like wise i give some exception is come
    give some help pls friends

    Navigate to the "DBOrders" module in the catalog, right click on the "ORDERS" database below and click "Export Schema Stucture". That will produce a file containing the DML needed to create the database

  • How can I create a new EJB project ?

    Hi,
    I downloaded the trial version and I don't know how to create an EJB project ?
    When I create a new project, I've only the web template to choose.
    Where can I find informations about that ?
    Thanks.
    jack

    Hi Jack,
    This version of the Creator allows you to build applications which access existing EJB's, but doesn't create new EJB's from scratch. We are looking into that for future releases.
    If you want to access an existing EJB, please see the tutorials:
    http://devservices.sun.com/premium/jscreator/standard/learning/tutorials/sessionEJBcomps.pdf
    I believe the Sun Java Studio Standard product can help you create EJB's today, if that's what you need:
    http://developers.sun.com/prodtech/javatools/jsstandard/index.html
    hth,
    Val

  • Validation of Enterprise Customer Fields in Project Creation Page

    I want to do the validation on the Enterprise Custom Fields of PWA site for Project center. A set of custom fields have been added on the Project Creation Page.
    Custom Business Validation (such as a field value should be unique or based on another field) is required for some custom fields. This validation is required on clicking Save button in Project Creation Page of Ms Project Server 2010. The validation ought
    to be done on clicking "Save" button.
    Any help in this regard would be apppreciated.

    The link mentioned by you ToonS is not acessible.
    Here is the link:
    http://msdn.microsoft.com/en-us/library/office/gg615466(v=office.14).aspx
    Hope this helps,
    Guillaume Rouyre, MBA, MVP, P-Seller |

  • Error in project creation using Netweaver studio

    Hi all,
    I am trying to create a new Composite Application Services project using Netweaver studio 7.011. When it came to the final step of the Project creation wizard, an error message pop-up saying "Problem when creating project".
    I have tried the methods posted in the forums, but its doesn't work for me.
    "Problem when creating project"
    Problem creating a composite applications project
    Can advise on how to resolve this?
    I am currently using Java 1.4.10 and NW2004s SP11.
    Thanks a lot.
    Regards,
    aiwei

    Yes, I can write to the folder.
    Any clue?
    I cannot proceed to create project with this error.
    Can advise?
    thank you.

  • Adapter module:: JAR file in the build path of EJB project

    Hi Experts,
    I have created one adapter module, for this I have created one EJB project and also associated one EAR project to that.
    I have completed my coding and changes in the xml files.
    I have followed this -
    http://www.sdn.sap.com/irj/scn/index;jsessionid=(J2EE3417500)ID1494558950DB01504425675464955468End?rid=/library/uuid/c0b39e65-981e-2b10-1c9c-fc3f8e6747fa&overridelayout=true
    while creating the module.
    but after finishing this , I can not see the ejb.jar file corresponding to the ejb project, I can see the class file generated in the build path.
    but I can not see the ejb.jar in the EJB project after build.
    When I checked the EAR project I found under Deployment descriptor there is a folder called module and there is  a jar file named as -
    EJB<my ejb project name>.jar
    when I am about to deploy this EAR  in the server it is showing  me to choose the file from EAR project and this EAR project contain the EJB Project .
    Request you to please let me know is everything ok with my project ? or please let me know how can I see the  ejb.jar  file corresponding to the ejb project below the build path.
    Thanks
    Vinny

    Hi Experts,
    I have created one adapter module, for this I have created one EJB project and also associated one EAR project to that.
    I have completed my coding and changes in the xml files.
    I have followed this -
    http://www.sdn.sap.com/irj/scn/index;jsessionid=(J2EE3417500)ID1494558950DB01504425675464955468End?rid=/library/uuid/c0b39e65-981e-2b10-1c9c-fc3f8e6747fa&overridelayout=true
    while creating the module.
    but after finishing this , I can not see the ejb.jar file corresponding to the ejb project, I can see the class file generated in the build path.
    but I can not see the ejb.jar in the EJB project after build.
    When I checked the EAR project I found under Deployment descriptor there is a folder called module and there is  a jar file named as -
    EJB<my ejb project name>.jar
    when I am about to deploy this EAR  in the server it is showing  me to choose the file from EAR project and this EAR project contain the EJB Project .
    Request you to please let me know is everything ok with my project ? or please let me know how can I see the  ejb.jar  file corresponding to the ejb project below the build path.
    Thanks
    Vinny

  • Ejb project

    Hi,
    i am doin java client proxy in XI.i ve imported the beans generated from XI into an EJB project in NDS and have changed the ejb-jar.xml accordingly.However the "BUILD EJB ARCHIVE" option is not enabled.Can anyone help?
    Regards,
    Divya

    HI
    GOOD
    GO THROUGH THESE LINKS
    http://help.sap.com/saphelp_nw04/helpdata/en/86/58cd3b11571962e10000000a11402f/content.htm
    http://www.sapgenie.com/xi/
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/f272165e-0401-0010-b4a1-e7eb8903501d
    THANKS
    MRUTYUN

Maybe you are looking for

  • Photoshop CC doesn't 'see' my scanner (Epson Perfection 3170 Photo). I'm on  Mac 10.8

    There is no 'Twain Acquire' option in menus, nor is there a suitable pluggin showing up in that menu option that would allow me to 'communicate' with my scanner.

  • Streaming  from Time Machine to Apple TV

    Hi Chaps, I am in a quandary, I have saved all my movies on to my time machine and currently streaming my movies to my Imac then using an HDMI cable to watch the films on my main Tv. I am thinking of buying an apple TV and want to know if I can strea

  • How to change the field name in SUS

    HI, In the section view all PO's, I want to change the field name  <b>document number</b> to <b>invoice number</b>.Please do let me know how to go about it. Thanks in advance , Manu

  • ITunes download error "Service "Apple Mobile Device Service"

    How do I get past the iTunes download error message: "Service "Apple Mobile Device Service" failed to start. Verify that you have sufficient privilege to start system services." ? I have tried ignoring, trying again, and canceling and reloading.  I m

  • Process the events in quee

    Hi , How to know the process quee(events quee) For Example : one table with many rows and two columns (name ,***(check box)) . when i selected first row check box it will run some process before completed the process if i select the other check box(o