Hi Ashish -

"java hellojpa.Main" will not work.

To run the test you need all the jars in the OpenJPA.1.2.1 lib directory and the openjpa-1.2.1.jar.

Ant build.xml puts all of them in the classpath for you.

- Paul



On 4/22/2009 8:09 AM, Michael Dick wrote:
Hi Ashish,

Javax.persistence.Persistence isn't part of the OpenJPA source tree, instead
we get the class from Geronimo.

An implementation of Persistence.java is included in the binary distribution
of OpenJPA in the lib directory. For trunk it's contained in
apache-openjpa-2.0.0-SNAPSHOT/lib/geronimo-jpa_2.0_spec-1.0-EA2-SNAPSHOT.jar.

If you've just downloaded the source (which is likely the case for you) the
jar will be automatically downloaded by maven  (after you execute a build)
and put in your local repository at
${HOME}/.m2/repository/org/apache/geronimo/specs/geronimo-jpa_2.0_spec/1.0-EA2-SNAPSHOT/geronimo-jpa_2.0_spec-1.0-EA2-SNAPSHOT.jar.


I suspect this is only the first jar that you'll need though. There are
several included in the binary dist of OpenJPA. You might have better luck
if you run the samples through maven with this command (taken from the
building openjpa page [1])

mvn -DskipTests -Pexamples-profile integration-test


[1] http://openjpa.apache.org/building-openjpa.html

HTH

-mike

On Wed, Apr 22, 2009 at 2:29 AM, ashish paliwal <[email protected]
wrote:

Hi,

Oks I got it. Ant is already running my program. It was specified in
build.xml. But still from where it is finding Persistence.java. It is
not in my Java distribution. So, is it included in the jars of Openjpa
?

thanks

On Wed, Apr 22, 2009 at 12:40 PM, rpalache <[email protected]>
wrote:
Hi Ashish,

The first thing I will check is your classpath.

Looks like you are trying to run "java hellojpa.Main " but this is
already
part of "ant" that you run and the output from ant command
"run:
    [java] 4782  hellojpa  TRACE  [main] openjpa.jdbc.SQL - <t 16322634,
conn 2
7041558> executing prepstmnt 26426059 INSERT INTO Message (id, created,
message)
....
"

is part of running hellojpa.Main from with in ant.

Regards,
Ravi.


ashishpaliwal wrote:
Hi,

Thanks guys, I got my build succesful with ant but now I am stuck with
another (silly) problem. After build succesful when I am trying to run
the program it is not able to find the Persistence class file. Is
there some specific way in which I got to run the file. The error that
I received is as follows:

E:\apache-openjpa-1.2.1\examples>cd hellojpa

E:\apache-openjpa-1.2.1\examples\hellojpa>ant
Buildfile: build.xml

pre-compile:

compile:

run:
     [java] 4782  hellojpa  TRACE  [main] openjpa.jdbc.SQL - <t
16322634,
conn 2
7041558> executing prepstmnt 26426059 INSERT INTO Message (id, created,
message)
 VALUES (?, ?, ?) [params=(long) 1240383110078, (Timestamp) 2009-04-22
12:21:50.
078, (String) Hello Persistence!]
     [java] 4844  hellojpa  TRACE  [main] openjpa.jdbc.SQL - <t
16322634,
conn 2
7041558> [62 ms] spent
     [java] 5578  hellojpa  TRACE  [main] openjpa.jdbc.SQL - <t
16322634,
conn 2
7695009> executing prepstmnt 19407197 SELECT t0.id, t0.created,
t0.message
FROM
Message t0
     [java] 5578  hellojpa  TRACE  [main] openjpa.jdbc.SQL - <t
16322634,
conn 2
7695009> [0 ms] spent
     [java] Hello Persistence! (created on: Wed Apr 22 12:14:29 IST
2009)
     [java] Hello Persistence! (created on: Wed Apr 22 12:18:38 IST
2009)
     [java] Hello Persistence! (created on: Wed Apr 22 12:21:50 IST
2009)
BUILD SUCCESSFUL
Total time: 7 seconds
E:\apache-openjpa-1.2.1\examples\hellojpa>cd..

E:\apache-openjpa-1.2.1\examples>java hellojpa.Main
Exception in thread "main" java.lang.NoClassDefFoundError:
javax/persistence/Per
sistence
        at hellojpa.Main.main(Main.java:36)

E:\apache-openjpa-1.2.1\examples>


Can someone please tell me what is the problem and where I am going
wrong
?


thanks




On Wed, Apr 22, 2009 at 12:53 AM, Michael Dick <
[email protected]>
wrote:
Hi Ashish,

It looks like the Apache parent pom is corrupted. Could you try
removing
the
C:\Documents and Settings\ashish\.m2\reposi
tory\org\apache\apache\4\ directory and re-running your maven build?

Here's what I'm keying off of :

Caused by: org.apache.maven.project.
InvalidProjectModelException: Not a v4.0.0 POM. for project
org.apache:apache at C:\Documents and
Settings\ashish\.m2\repository\org\apache\apache\4\apache-4.pom


I've never used conf.xml though, have you tried running the build
without
it?

Just my two cents. Paul's suggestion of running the samples will also
help
to determine the root cause.

-mike


On Tue, Apr 21, 2009 at 12:56 PM, Paul Copeland <[email protected]>
wrote:

Can you get it to work without Maven and without Eclipse first?  You
should
be able to (1) download OpenJPA 1.2.1, (2) cd to examples/hellojpa,
(3)
type
"ant"

That should be all you have to do.  If that does not end in "BUILD
SUCCESSFUL" please send the output to this list.

Once you have that much working you can have "fun" with Maven and
Eclipse
;-)

- Paul


On 4/21/2009 10:32 AM, ashish paliwal wrote:

Hi,

Do I need to make any changes in my conf.xml file for maven. I have
already specified the proxy settings there. I am stuck with this
problem for a while now and not able to figure what is the problem.
Can anyone please suggest what is the problem or any changes that I
need to make in either Pom.xml or conf.xml to build my project.

thanks

On Tue, Apr 21, 2009 at 3:58 PM, ashish paliwal
<[email protected]> wrote:


Hi,

I downloaded the source code from the site and was trying to build
it.
While giving the command mvn install, my build fails because it says
that "might not be this projects POM". Do I need to change the
POM.xml
file or run mvn install from somewhere else first.
My stack trace is attached here with.



E:\gsoc\openjpa>mvn install
[INFO] Scanning for projects...
[INFO]

------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO]

------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).


Project ID: org.apache.openjpa:openjpa-parent:pom:2.0.0-SNAPSHOT

Reason: Cannot find parent: org.apache:apache for project:
org.apache.openjpa:op
enjpa-parent:pom:2.0.0-SNAPSHOT for project
org.apache.openjpa:openjpa-parent:po
m:2.0.0-SNAPSHOT


[INFO]

------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.reactor.MavenExecutionException: Cannot find
parent:
org.apache
:apache for project:
org.apache.openjpa:openjpa-parent:pom:2.0.0-SNAPSHOT
for pr
oject org.apache.openjpa:openjpa-parent:pom:2.0.0-SNAPSHOT
      at
org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:432)
      at
org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:300)
      at
org.apache.maven.DefaultMaven.execute(DefaultMaven.java:137)
      at org.apache.maven.cli.MavenCli.main(MavenCli.java:356)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
      at

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at
org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
      at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
      at

org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
      at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.project.ProjectBuildingException: Cannot
find
parent
: org.apache:apache for project:
org.apache.openjpa:openjpa-parent:pom:2.0.0-SNA
PSHOT for project
org.apache.openjpa:openjpa-parent:pom:2.0.0-SNAPSHOT
      at

org.apache.maven.project.DefaultMavenProjectBuilder.assembleLineage(D
efaultMavenProjectBuilder.java:1398)
      at

org.apache.maven.project.DefaultMavenProjectBuilder.buildInternal(Def
aultMavenProjectBuilder.java:823)
      at

org.apache.maven.project.DefaultMavenProjectBuilder.buildFromSourceFi
leInternal(DefaultMavenProjectBuilder.java:508)
      at

org.apache.maven.project.DefaultMavenProjectBuilder.build(DefaultMave
nProjectBuilder.java:200)
      at
org.apache.maven.DefaultMaven.getProject(DefaultMaven.java:632)
      at
org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:515)
      at
org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:419)
      ... 11 more
Caused by: org.apache.maven.project.InvalidProjectModelException:
Not
a
v4.0.0 P
OM. for project org.apache:apache at C:\Documents and
Settings\ashish\.m2\reposi
tory\org\apache\apache\4\apache-4.pom
      at

org.apache.maven.project.DefaultMavenProjectBuilder.readModel(Default
MavenProjectBuilder.java:1609)
      at

org.apache.maven.project.DefaultMavenProjectBuilder.readModel(Default
MavenProjectBuilder.java:1581)
      at

org.apache.maven.project.DefaultMavenProjectBuilder.findModelFromRepo
sitory(DefaultMavenProjectBuilder.java:562)
      at

org.apache.maven.project.DefaultMavenProjectBuilder.assembleLineage(D
efaultMavenProjectBuilder.java:1394)
      ... 17 more
[INFO]

------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Tue Apr 21 15:54:24 IST 2009
[INFO] Final Memory: 1M/2M
[INFO]

------------------------------------------------------------------------
E:\gsoc\openjpa>

On Tue, Apr 21, 2009 at 12:51 PM, Pinaki Poddar <[email protected]
wrote:


Hi,
 Check out the source code [1]
 Follow the instructions [2] to build.

 If you encounter difficulty, post with stack trace/build log

[1] http://openjpa.apache.org/source-code.html
[2] http://openjpa.apache.org/building-openjpa.html


ashishpaliwal wrote:


Hello,

I am new GSOC guy and I will be working on the Slice module. I was
trying to set up my development environment and downloaded the
1.2.1
release for the same. I was trying to compile the hellojpa program
given in example folder but it is not able to find
javax.persistence
package. Actually there is no persistence package in my standard
java
distribution.
Can someone please tell me how to sort out this problem. Also is
there
some eclipse plugin to work with OpenJPA.
Being new to this type of work environment, I might be asking lot
of
stupid questions at first, so please bear with me.

thanks and regards

--
Ashish Paliwal
Mobile : 9305128367
IIT Kanpur
India




-----
Pinaki Poddar                      http://ppoddar.blogspot.com/

http://www.linkedin.com/in/pinakipoddar
OpenJPA PMC Member/Committer
JPA Expert Group Member
--
View this message in context:

http://n2.nabble.com/Problems-in-setting-up-the-work-enviroment.-tp2668172p2668421.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.




thanks

--
Ashish Paliwal
Mobile : 9305128367
IIT Kanpur
India







--
Ashish Paliwal
Mobile : 9305128367
IIT Kanpur
India


--
View this message in context:
http://n2.nabble.com/Problems-in-setting-up-the-work-enviroment.-tp2668172p2674627.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.



--
Ashish Paliwal
Mobile : 9305128367
IIT Kanpur
India



Reply via email to