• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

EJB classpath issues

 
Ranch Hand
Posts: 608
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I was trying to compile some EJBs but it tells me :

UserBean.java
HelloUserBean.java:2: package javax.ejb does not exist
import javax.ejb.Stateless;
^
HelloUserBean.java:4: cannot find symbol
symbol: class HelloUser
public class HelloUserBean implements HelloUser {
^
HelloUserBean.java:3: cannot find symbol
symbol: class Stateless
@Stateless
^
3 errors


I have both JAVA_HOME ,J2EE_HOME and ANT_HOME set.
The following are residing in my path env variable:
{j2ee.home}\bin
{j2ee.home}\lib\ant\bin

The following are in my classpath:
{j2ee.home}\lib
{j2ee.home}\lib\ant\lib

I am using glassfish and have set the admin password for the password file correctly.I can login to the admin console,ue ant to deploy applications and can use asadmin from the command prompt.I only run into problems trying to compile the classes.....
Please advise!
 
Ranch Hand
Posts: 959
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I believe the javaee.jar isn't in your classpath.

Can you paste your ant script?
 
Duran Harris
Ranch Hand
Posts: 608
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Freddy,

I have tried adding j2ee.jar AND/OR javaee.jar to the classpath..This didnt help.
I am not sure whether ant build scripts are necessary...I thought that the DDs and build scripts were optional ie.
I thought could just have a bunch of POJOs/POJIs with annotations,compile them,jar them and deploy/run the jar.....

If this is not the case does that mean I will need to learn how to use ant build scripts before I can compile/run my own ejbs???
I am now downloading Netbeans/glassfish/JEE bundle,hopefully this will help.
 
Freddy Wong
Ranch Hand
Posts: 959
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How did you compile your EJB? Using javac, ant, or maven? If you compile them using javac, can you please paste the command? If you use ant, please provide the ant script so that we can help?

From the compilation error, "package javax.ejb does not exist", it shows that the javax.ejb classes, which are in the javaee.jar isn't present in the classpath.
 
Duran Harris
Ranch Hand
Posts: 608
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
EDIT:Removed double post
 
Duran Harris
Ranch Hand
Posts: 608
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
javac -cp \Sun\SDK\lib\j2ee.jar CountBean.java
OR
javac -cp \Sun\SDK\lib\javaee.jar CountBean.java
OR
javac -cp \Sun\SDK\lib\j2ee.jar *.java(Thought maybe it would help compiling it all one shot )

And I have confirmed that j2ee.jar exists.Have downloaded the glassfish+javaEE bundle from Sun instead of the javaEE+glassfish+appServer bundle.Maybe this will help.Have given up on Netbeans though,I don't like the idea of it generating build scripts for everything considering that I can't write a build script myself.
 
Duran Harris
Ranch Hand
Posts: 608
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay so now I've managed to get this stuff to compile..The next step is to stick the package structure in a jar isn't it?I created the jar but when I try to execute it,I get the error:

Failed to load Main-Class manifest attribute from mine.jar

Should my bean classes and interfaces go into a jar and then I run the client from the cmd with this jar on the classpath?Or should the client be included in the jar??
 
Aaaaaand ... we're on the march. Stylin. Get with it tiny ad.
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic