This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

error when compiling Home interface  RSS feed

 
Shalu Ban
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to create my first EJB.
My remote interface is like this:
package com.ejb.session;
import javax.ejb.EJBObject;
import java.rmi.RemoteException;
public interface First extends EJBObject
{
public String getTime() throws RemoteException;
}
My home interface:
package com.ejb.session;
import javax.ejb.EJBHome;
import javax.ejb.CreateException;
import java.rmi.RemoteException;
public interface FirstHome extends EJBHome {
public First create() throws CreateException, RemoteException;
}

When i compile First.java i receive no errors but when i compile FirstHome.java i receive an error. I have included the classpath for j2ee jar while compiling . i am using JBoss.
javac -verbose -classpath %CLASSPATH%;"D:\Program Files\jboss-3.2.3\client\jboss-j2ee.jar" -d "D:\Program Files\Projects\TomcatJBoss\EJB\FirstEJB\src\com\ejb\session\FirstHome.java"
Error: cannot resolve symbol
symbol: class First
location: interface com.ejb.session.FirstHome
public First create() throws CreateException, RemoteException;
Any ideas??
 
Shalu Ban
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No one knows what could be wrong??
 
Aju Josep
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi shalu,
i tried copy/pasting u'r code and compiling them. and both the files compiled. i had also kept the directory hierarchy as required in the package listing. cant figure out what is the problem with u
Aju
 
Ade Barkah
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's a simple classpath problem when you're compiling the 2nd file; Try compiling all the classes at once, something like:
> cd EJB\FirstEJB
> mkdir build
> cd src
> javac -classpath "D:\Program Files\jboss-3.2.3\client\jboss-j2ee.jar" -d ..\build src\com\ejb\session\*.java
Hopefully you get the idea. All the files should now be compiled into a class-hierarchy within "build". Repeat with any other directories as necessary.
-Ade Barkah
ps. You may want to learn "Ant" at some point... seems more complicated at first but it would greatly simplify your builds later on.
 
Ade Barkah
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry that last line should probably be:
> javac -classpath "D:\Program Files\jboss-3.2.3\client\jboss-j2ee.jar" -d ..\build com\ejb\session\*.java
-Ade Barkah
 
Shalu Ban
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried compiling all the files at once but had received 6 errors . the errors were refering to code (like datalib or something) which wasnt there in my 3 java classes. so i tried compiling files individually.
U r rite, i am going to learn Ant soon. but was wondering why this is causing an error.
thank u guys!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!