Nargzul
asked on
Get a jar for my heavy container connecting to EJB in Netbeans
Hi!
I've done a small program that connect to my EJB server, It works on debugging under Netbeans but now I want to test it on a serveur that hasn't netbeans.
I've viewed that netbeans generate two jar for this container. I've deployed the one that doesn't have a -client.
After this I've try to launch the program but it appears it don't know which class he must start. But in the netbeans properties it's specified.
So my question is simple:
What is the good way to create a .jar(or the two jars) that will connect to my EJB server.
Thank you!
I've done a small program that connect to my EJB server, It works on debugging under Netbeans but now I want to test it on a serveur that hasn't netbeans.
I've viewed that netbeans generate two jar for this container. I've deployed the one that doesn't have a -client.
After this I've try to launch the program but it appears it don't know which class he must start. But in the netbeans properties it's specified.
So my question is simple:
What is the good way to create a .jar(or the two jars) that will connect to my EJB server.
Thank you!
I am not to sure if you need to deploy the second jar at all. When you deploy the jar containing the the beans all you need is a stand alone client to do the lookup of that bean and that functions independently. So I am not sure why you need the second jar.
ASKER
Okay, so how I generate this stand alone client?
No need to generate it. You can write a java bean/pojo as a client and use that. Do the lookup and access the ejb.
ASKER
So how I run it?? I've tried to make a javac, etc, but I've missing library(javax.ejb by exemple).
You can run it through the javac but make sure you include the right libs in the class path by using the javac flags.
ASKER
I've watched in my Netbeans project, the only imported lib is my EJB project.
If we do a javac, are you sure it use J2EE and not J2SE? Because I think this missing lib is in the J2EE and not J2SE.
If we do a javac, are you sure it use J2EE and not J2SE? Because I think this missing lib is in the J2EE and not J2SE.
Yes I am sure..........the netbeans lib link the required libs internally and generate the classpath.
ASKER
Okay, so what is this library? Where can I found it?
What webserver are yo using?
ASKER
Glassfish V2U2
Check in the lib directory, it should be there.
ASKER
which lib directory? Of glassfish? Of the project? What is its name?
The only lib directory I've found in this client container application is the jar of my EJB project
The only lib directory I've found in this client container application is the jar of my EJB project
Open the directory where glassfish is installed, there should be a lib directory inside the server dir. Place the entire directory in the classpath.
ASKER
Okay, the lib folder has something like 75Mo of libraries.
I've try this:
"C:\Program Files\Java\jdk1.6.0_14\bin \javac" -classpath "C:\Program Files\glassfish-v2ur2\lib; C:\Users\J 4N\Desktop \TrustBN-e jb.jar" MatchBot.java
But I always got same error:
C:\Users\J4N\Documents\My Dropbox\WorkSpaces\J2EE\Tr ustBN\Trus tBN-app-cl ient\src\j ava\MatchB ot>"C:\Pro gram Files\Java\jdk1.6.0_14\bin \javac" -classpath "C:\Program Files\glassfish-v2ur2\lib; C:\Users\J 4N\Desktop
\TrustBN-ejb.jar" MatchBot.java
MatchBot.java:14: package javax.ejb does not exist
import javax.ejb.EJB;
^
datamodel\Exchange.class(d atamodel:E xchange.cl ass): warning: Cannot find annotation method 'name()' in type 'javax.persistence.Table': class file for javax.persistence.Table not found
datamodel\Exchange.class(d atamodel:E xchange.cl ass): warning: Cannot find annotation method 'value()' in type 'javax.persistence.NamedQu eries': class file for javax.persistence.NamedQue ries not found
datamodel\Exchange.class(d atamodel:E xchange.cl ass): warning: Cannot find annotation method 'name()' in type 'javax.persistence.NamedQu ery': class file for javax.persistence.NamedQue ry not found
datamodel\Exchange.class(d atamodel:E xchange.cl ass): warning: Cannot find annotation method 'query()' in type 'javax.persistence.NamedQu ery'
datamodel\Exchange.class(d atamodel:E xchange.cl ass): warning: Cannot find annotation method 'name()' in type 'javax.persistence.NamedQu ery'
datamodel\Exchange.class(d atamodel:E xchange.cl ass): warning: Cannot find annotation method 'query()' in type 'javax.persistence.NamedQu ery'
datamodel\Exchange.class(d atamodel:E xchange.cl ass): warning: Cannot find annotation method 'strategy()' in type 'javax.persistence.Generat edValue': class file for javax.persistence.Generate dValue not found
I've try this:
"C:\Program Files\Java\jdk1.6.0_14\bin
But I always got same error:
C:\Users\J4N\Documents\My Dropbox\WorkSpaces\J2EE\Tr
\TrustBN-ejb.jar" MatchBot.java
MatchBot.java:14: package javax.ejb does not exist
import javax.ejb.EJB;
^
datamodel\Exchange.class(d
datamodel\Exchange.class(d
datamodel\Exchange.class(d
datamodel\Exchange.class(d
datamodel\Exchange.class(d
datamodel\Exchange.class(d
datamodel\Exchange.class(d
search for some ejb specific lib inside the folder.........can you list those out. Do a searcg *ejb*.jar in the lib folder and post the results.
ASKER
I've some DTD and XSD about ejb, but no jar with the ejb in the name.
ASKER
In facts the javaee was missing, now the compilation is ok, but I've always this problem:
C:\Users\J4N\Documents\My Dropbox\WorkSpaces\J2EE\Tr ustBN\Trus tBN-app-cl ient\src\j ava>"C:\Pr ogram Files\Java\jdk1.6.0_14\bin \javac" -classpath "appserv-rt.jar;javaee.jar ;TrustBN-e jb.jar" MatchBot/MatchBot.java
C:\Users\J4N\Documents\My Dropbox\WorkSpaces\J2EE\Tr ustBN\Trus tBN-app-cl ient\src\j ava>java MatchBot
Exception in thread "main" java.lang.NoClassDefFoundE rror: MatchBot
Caused by: java.lang.ClassNotFoundExc eption: MatchBot
at java.net.URLClassLoader$1. run(Unknow n Source)
at java.security.AccessContro ller.doPri vileged(Na tive Method)
at java.net.URLClassLoader.fi ndClass(Un known Source)
at java.lang.ClassLoader.load Class(Unkn own Source)
at sun.misc.Launcher$AppClass Loader.loa dClass(Unk nown Source)
at java.lang.ClassLoader.load Class(Unkn own Source)
at java.lang.ClassLoader.load ClassInter nal(Unknow n Source)
Could not find the main class: MatchBot. Program will exit.
but I've a main in my class:
public static void main(String[] args) throws NamingException {
new MatchBot().start();
System.out.println("Job successfully finished");
}
C:\Users\J4N\Documents\My Dropbox\WorkSpaces\J2EE\Tr
C:\Users\J4N\Documents\My Dropbox\WorkSpaces\J2EE\Tr
Exception in thread "main" java.lang.NoClassDefFoundE
Caused by: java.lang.ClassNotFoundExc
at java.net.URLClassLoader$1.
at java.security.AccessContro
at java.net.URLClassLoader.fi
at java.lang.ClassLoader.load
at sun.misc.Launcher$AppClass
at java.lang.ClassLoader.load
at java.lang.ClassLoader.load
Could not find the main class: MatchBot. Program will exit.
but I've a main in my class:
public static void main(String[] args) throws NamingException {
new MatchBot().start();
System.out.println("Job successfully finished");
}
Any progress on the issue as yet?
What is the pacakge name that you have specified and how to do you invoke in from the command line? You need to be at the right package level.
What is the pacakge name that you have specified and how to do you invoke in from the command line? You need to be at the right package level.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.