Home » Eclipse Projects » Remote Application Platform (RAP) » Unable to find file in classpath
| |
Re: Unable to find file in classpath [message #370262 is a reply to message #348348] |
Wed, 29 July 2009 01:15 |
Christoph Messages: 55 Registered: July 2009 |
Member |
|
|
Ben-
Thanks for your response. I included two META-INF directories because it
appears to be necessary that the persistence.xml be placed in
src/META-INF (rather than /META-INF, as stated in the final message in
this thread http://forums.java.net/jive/thread.jspa?threadID=26058).
That structure works when the persistence.xml is accessed as part of an
RCP application, and also works for a test class that uses the JPA
entity manager and is located in the myapp.client.rap package, when the
test class is run as a local java application.
I have attempted changing the project structure to the following:
+ Project_folder
+ src
- myapp.client.rap
- [various other source packages]
+ META-INF
- MANIFEST.MF
- persistence.xml
but the error persists.
Adding "Bundle-ClassPath: src/" to the MANIFEST.MF does not fix the
error for the original structure. Nor does adding "Bundle-ClassPath:
Bundle-ClassPath: src/, META-INF/" fix the issue using the alternate
structure (above).
I'd be interested in any other thoughts that you'd have, as well has how
other people have set up RAP applications with a JPA backend.
Thanks!
Christoph
On 07/28/2009 01:25 AM Benjamin Muskalla wrote:
> Hi Christoph,
>
> I'm a little confused with your layout. Why are there two META-INF
> folders and two MANIFEST.MF? Should the persistence.xml not be a file
> inside the top-level META-INF folder?
>
> Greets
> Ben
>
> Christoph Hoashi-Erhardt wrote:
>> Hello,
>>
>> I have a RAP application that uses JPA for persistence. The project is
>> structured as follows:
>>
>> + Project_folder
>> + src
>> - myapp.client.rap
>> - [various other source packages]
>> + META-INF
>> - MANIFEST.MF
>> - persistence.xml
>> + META-INF
>> - MANIFEST.MF
>>
>> When I launch my application, I receive the following error:
>>
>> javax.persistence.PersistenceException: No Persistence provider for
>> EntityManager named myapp_remote: No META-INF/persistence.xml was
>> found in classpath.
>>
>> at
>> javax.persistence.Persistence.createEntityManagerFactory(Per sistence.java:154)
>>
>> at
>> javax.persistence.Persistence.createEntityManagerFactory(Per sistence.java:83)
>>
>> at com.myapp.manager.backend.JpaBackend.<init>(JpaBackend.java:31)
>> at
>> myapp.client.rap.View$ViewContentProvider.getElements(View.j ava:42)
>> at
>> […]
>>
>> I don’t get this problem with a similarly structured RCP application.
>>
>> The RAP application’s MANIFEST.MF is:
>>
>> Manifest-Version: 1.0
>> Bundle-ManifestVersion: 2
>> Bundle-Name: Myapp_client_rap
>> Bundle-SymbolicName: myapp_client_rap; singleton:=true
>> Bundle-Version: 1.0.0.qualifier
>> Bundle-Activator: myapp.client.rap.Activator
>> Require-Bundle: org.eclipse.rap.ui,
>> myapp.manager.database;bundle-version="0.2.0"
>> Bundle-RequiredExecutionEnvironment: JavaSE-1.6
>> Import-Package: javax.servlet;version="2.4.0",
>> javax.servlet.http;version="2.4.0"
>> Bundle-ActivationPolicy: lazy
>>
>> If I insert “Bundle-ClassPath: myapp_client_rap.jar” after
>> Bundle-Version, there are all manner of errors related to the program
>> not being able to find the Activator class.
>>
>> Any tips on where I am going wrong would be much appreciated.
>>
>> Thanks,
>>
>> Christoph
>
>
|
|
|
Re: Unable to find file in classpath [message #371636 is a reply to message #370262] |
Wed, 29 July 2009 06:24 |
Eclipse User |
|
|
|
Originally posted by: bjoern.bjoernfischer.de
Hi Christoph,
as far as I know the META-INF/persistence.xml should be in project root
and must not be in src. I would rather suspect some kind of classloading
issue (or better: file-visibility-issue of the persistence.xml). Which
OR-Mapper do you use?
Regards,
Björn
> Ben-
>
> Thanks for your response. I included two META-INF directories because it
> appears to be necessary that the persistence.xml be placed in
> src/META-INF (rather than /META-INF, as stated in the final message in
> this thread http://forums.java.net/jive/thread.jspa?threadID=26058).
> That structure works when the persistence.xml is accessed as part of an
> RCP application, and also works for a test class that uses the JPA
> entity manager and is located in the myapp.client.rap package, when the
> test class is run as a local java application.
>
> I have attempted changing the project structure to the following:
>
> + Project_folder
> + src
> - myapp.client.rap
> - [various other source packages]
> + META-INF
> - MANIFEST.MF
> - persistence.xml
>
> but the error persists.
>
> Adding "Bundle-ClassPath: src/" to the MANIFEST.MF does not fix the
> error for the original structure. Nor does adding "Bundle-ClassPath:
> Bundle-ClassPath: src/, META-INF/" fix the issue using the alternate
> structure (above).
>
> I'd be interested in any other thoughts that you'd have, as well has how
> other people have set up RAP applications with a JPA backend.
>
> Thanks!
>
> Christoph
>
> On 07/28/2009 01:25 AM Benjamin Muskalla wrote:
>> Hi Christoph,
>>
>> I'm a little confused with your layout. Why are there two META-INF
>> folders and two MANIFEST.MF? Should the persistence.xml not be a file
>> inside the top-level META-INF folder?
>>
>> Greets
>> Ben
>>
>> Christoph Hoashi-Erhardt wrote:
>>> Hello,
>>>
>>> I have a RAP application that uses JPA for persistence. The project
>>> is structured as follows:
>>>
>>> + Project_folder
>>> + src
>>> - myapp.client.rap
>>> - [various other source packages]
>>> + META-INF
>>> - MANIFEST.MF
>>> - persistence.xml
>>> + META-INF
>>> - MANIFEST.MF
>>>
>>> When I launch my application, I receive the following error:
>>>
>>> javax.persistence.PersistenceException: No Persistence provider for
>>> EntityManager named myapp_remote: No META-INF/persistence.xml was
>>> found in classpath.
>>>
>>> at
>>> javax.persistence.Persistence.createEntityManagerFactory(Per sistence.java:154)
>>>
>>> at
>>> javax.persistence.Persistence.createEntityManagerFactory(Per sistence.java:83)
>>>
>>> at com.myapp.manager.backend.JpaBackend.<init>(JpaBackend.java:31)
>>> at
>>> myapp.client.rap.View$ViewContentProvider.getElements(View.j ava:42)
>>> at
>>> […]
>>>
>>> I don’t get this problem with a similarly structured RCP application.
>>>
>>> The RAP application’s MANIFEST.MF is:
>>>
>>> Manifest-Version: 1.0
>>> Bundle-ManifestVersion: 2
>>> Bundle-Name: Myapp_client_rap
>>> Bundle-SymbolicName: myapp_client_rap; singleton:=true
>>> Bundle-Version: 1.0.0.qualifier
>>> Bundle-Activator: myapp.client.rap.Activator
>>> Require-Bundle: org.eclipse.rap.ui,
>>> myapp.manager.database;bundle-version="0.2.0"
>>> Bundle-RequiredExecutionEnvironment: JavaSE-1.6
>>> Import-Package: javax.servlet;version="2.4.0",
>>> javax.servlet.http;version="2.4.0"
>>> Bundle-ActivationPolicy: lazy
>>>
>>> If I insert “Bundle-ClassPath: myapp_client_rap.jar” after
>>> Bundle-Version, there are all manner of errors related to the program
>>> not being able to find the Activator class.
>>>
>>> Any tips on where I am going wrong would be much appreciated.
>>>
>>> Thanks,
>>>
>>> Christoph
>>
>>
|
|
|
Re: Unable to find file in classpath [message #401095 is a reply to message #371636] |
Thu, 30 July 2009 04:58 |
Christoph Messages: 55 Registered: July 2009 |
Member |
|
|
Hi Björn,
I agree with your file visibility diagnosis, though I'm rather at a loss
for the fix. I'm using TopLink Essentials (v 2.0). I haven't tried
substituting eclipselink yet, but will likely do that next.
-Christoph
On 07/28/2009 11:24 PM Björn Fischer wrote:
> Hi Christoph,
> as far as I know the META-INF/persistence.xml should be in project root
> and must not be in src. I would rather suspect some kind of classloading
> issue (or better: file-visibility-issue of the persistence.xml). Which
> OR-Mapper do you use?
>
> Regards,
> Björn
>
>> Ben-
>>
>> Thanks for your response. I included two META-INF directories because it
>> appears to be necessary that the persistence.xml be placed in
>> src/META-INF (rather than /META-INF, as stated in the final message in
>> this thread http://forums.java.net/jive/thread.jspa?threadID=26058).
>> That structure works when the persistence.xml is accessed as part of an
>> RCP application, and also works for a test class that uses the JPA
>> entity manager and is located in the myapp.client.rap package, when the
>> test class is run as a local java application.
>>
>> I have attempted changing the project structure to the following:
>>
>> + Project_folder
>> + src
>> - myapp.client.rap
>> - [various other source packages]
>> + META-INF
>> - MANIFEST.MF
>> - persistence.xml
>>
>> but the error persists.
>>
>> Adding "Bundle-ClassPath: src/" to the MANIFEST.MF does not fix the
>> error for the original structure. Nor does adding "Bundle-ClassPath:
>> Bundle-ClassPath: src/, META-INF/" fix the issue using the alternate
>> structure (above).
>>
>> I'd be interested in any other thoughts that you'd have, as well has how
>> other people have set up RAP applications with a JPA backend.
>>
>> Thanks!
>>
>> Christoph
>>
>> On 07/28/2009 01:25 AM Benjamin Muskalla wrote:
>>> Hi Christoph,
>>>
>>> I'm a little confused with your layout. Why are there two META-INF
>>> folders and two MANIFEST.MF? Should the persistence.xml not be a file
>>> inside the top-level META-INF folder?
>>>
>>> Greets
>>> Ben
>>>
>>> Christoph Hoashi-Erhardt wrote:
>>>> Hello,
>>>>
>>>> I have a RAP application that uses JPA for persistence. The project
>>>> is structured as follows:
>>>>
>>>> + Project_folder
>>>> + src
>>>> - myapp.client.rap
>>>> - [various other source packages]
>>>> + META-INF
>>>> - MANIFEST.MF
>>>> - persistence.xml
>>>> + META-INF
>>>> - MANIFEST.MF
>>>>
>>>> When I launch my application, I receive the following error:
>>>>
>>>> javax.persistence.PersistenceException: No Persistence provider for
>>>> EntityManager named myapp_remote: No META-INF/persistence.xml was
>>>> found in classpath.
>>>>
>>>> at
>>>> javax.persistence.Persistence.createEntityManagerFactory(Per sistence.java:154)
>>>>
>>>> at
>>>> javax.persistence.Persistence.createEntityManagerFactory(Per sistence.java:83)
>>>>
>>>> at com.myapp.manager.backend.JpaBackend.<init>(JpaBackend.java:31)
>>>> at
>>>> myapp.client.rap.View$ViewContentProvider.getElements(View.j ava:42)
>>>> at
>>>> […]
>>>>
>>>> I don’t get this problem with a similarly structured RCP application.
>>>>
>>>> The RAP application’s MANIFEST.MF is:
>>>>
>>>> Manifest-Version: 1.0
>>>> Bundle-ManifestVersion: 2
>>>> Bundle-Name: Myapp_client_rap
>>>> Bundle-SymbolicName: myapp_client_rap; singleton:=true
>>>> Bundle-Version: 1.0.0.qualifier
>>>> Bundle-Activator: myapp.client.rap.Activator
>>>> Require-Bundle: org.eclipse.rap.ui,
>>>> myapp.manager.database;bundle-version="0.2.0"
>>>> Bundle-RequiredExecutionEnvironment: JavaSE-1.6
>>>> Import-Package: javax.servlet;version="2.4.0",
>>>> javax.servlet.http;version="2.4.0"
>>>> Bundle-ActivationPolicy: lazy
>>>>
>>>> If I insert “Bundle-ClassPath: myapp_client_rap.jar” after
>>>> Bundle-Version, there are all manner of errors related to the program
>>>> not being able to find the Activator class.
>>>>
>>>> Any tips on where I am going wrong would be much appreciated.
>>>>
>>>> Thanks,
>>>>
>>>> Christoph
>>>
|
|
|
Re: Unable to find file in classpath [message #406564 is a reply to message #401095] |
Thu, 30 July 2009 06:39 |
bjoern Messages: 19 Registered: July 2009 |
Junior Member |
|
|
Hi Christoph,
I guess your problem is that you do not use a OSGi-Bundle'fied TopLink.
I don't know if there is an OSGi-Fied Version of TopLink Essentials
available, but if you have TopLink as a jar you can create one by
yourself: Use the new project wizard "Plug-In from existing jar
archives". I recommend not to unzip the contents in the bundle. This
fixes the usual classloading problem with libraries that load classes at
runtime e.g. by Class.forName().
Another option is of course to use eclipselink. It comes as bundles
already. You will at least need the bundles org.eclipse.persistence.core
and org.[...].jpa and probalby also org.[...].antlr.
When you have your OR-Mapper as one or more bundles you might still
experience classloading problems, if so you could try the buddy class
loading mechanism of equinox. But you should try without it in the first
place :)
I hope this helps you a little bit. Let me know if you have any more
problems.
Regards,
Björn
Christoph Hoashi-Erhardt schrieb:
> Hi Björn,
>
> I agree with your file visibility diagnosis, though I'm rather at a loss
> for the fix. I'm using TopLink Essentials (v 2.0). I haven't tried
> substituting eclipselink yet, but will likely do that next.
>
> -Christoph
>
> On 07/28/2009 11:24 PM Björn Fischer wrote:
>> Hi Christoph,
>> as far as I know the META-INF/persistence.xml should be in project root
>> and must not be in src. I would rather suspect some kind of classloading
>> issue (or better: file-visibility-issue of the persistence.xml). Which
>> OR-Mapper do you use?
>>
>> Regards,
>> Björn
>>
>>> Ben-
>>>
>>> Thanks for your response. I included two META-INF directories because it
>>> appears to be necessary that the persistence.xml be placed in
>>> src/META-INF (rather than /META-INF, as stated in the final message in
>>> this thread http://forums.java.net/jive/thread.jspa?threadID=26058).
>>> That structure works when the persistence.xml is accessed as part of an
>>> RCP application, and also works for a test class that uses the JPA
>>> entity manager and is located in the myapp.client.rap package, when the
>>> test class is run as a local java application.
>>>
>>> I have attempted changing the project structure to the following:
>>>
>>> + Project_folder
>>> + src
>>> - myapp.client.rap
>>> - [various other source packages]
>>> + META-INF
>>> - MANIFEST.MF
>>> - persistence.xml
>>>
>>> but the error persists.
>>>
>>> Adding "Bundle-ClassPath: src/" to the MANIFEST.MF does not fix the
>>> error for the original structure. Nor does adding "Bundle-ClassPath:
>>> Bundle-ClassPath: src/, META-INF/" fix the issue using the alternate
>>> structure (above).
>>>
>>> I'd be interested in any other thoughts that you'd have, as well has how
>>> other people have set up RAP applications with a JPA backend.
>>>
>>> Thanks!
>>>
>>> Christoph
>>>
>>> On 07/28/2009 01:25 AM Benjamin Muskalla wrote:
>>>> Hi Christoph,
>>>>
>>>> I'm a little confused with your layout. Why are there two META-INF
>>>> folders and two MANIFEST.MF? Should the persistence.xml not be a file
>>>> inside the top-level META-INF folder?
>>>>
>>>> Greets
>>>> Ben
>>>>
>>>> Christoph Hoashi-Erhardt wrote:
>>>>> Hello,
>>>>>
>>>>> I have a RAP application that uses JPA for persistence. The project
>>>>> is structured as follows:
>>>>>
>>>>> + Project_folder
>>>>> + src
>>>>> - myapp.client.rap
>>>>> - [various other source packages]
>>>>> + META-INF
>>>>> - MANIFEST.MF
>>>>> - persistence.xml
>>>>> + META-INF
>>>>> - MANIFEST.MF
>>>>>
>>>>> When I launch my application, I receive the following error:
>>>>>
>>>>> javax.persistence.PersistenceException: No Persistence provider for
>>>>> EntityManager named myapp_remote: No META-INF/persistence.xml was
>>>>> found in classpath.
>>>>>
>>>>> at
>>>>> javax.persistence.Persistence.createEntityManagerFactory(Per sistence.java:154)
>>>>>
>>>>>
>>>>> at
>>>>> javax.persistence.Persistence.createEntityManagerFactory(Per sistence.java:83)
>>>>>
>>>>>
>>>>> at com.myapp.manager.backend.JpaBackend.<init>(JpaBackend.java:31)
>>>>> at
>>>>> myapp.client.rap.View$ViewContentProvider.getElements(View.j ava:42)
>>>>> at
>>>>> […]
>>>>>
>>>>> I don’t get this problem with a similarly structured RCP application.
>>>>>
>>>>> The RAP application’s MANIFEST.MF is:
>>>>>
>>>>> Manifest-Version: 1.0
>>>>> Bundle-ManifestVersion: 2
>>>>> Bundle-Name: Myapp_client_rap
>>>>> Bundle-SymbolicName: myapp_client_rap; singleton:=true
>>>>> Bundle-Version: 1.0.0.qualifier
>>>>> Bundle-Activator: myapp.client.rap.Activator
>>>>> Require-Bundle: org.eclipse.rap.ui,
>>>>> myapp.manager.database;bundle-version="0.2.0"
>>>>> Bundle-RequiredExecutionEnvironment: JavaSE-1.6
>>>>> Import-Package: javax.servlet;version="2.4.0",
>>>>> javax.servlet.http;version="2.4.0"
>>>>> Bundle-ActivationPolicy: lazy
>>>>>
>>>>> If I insert “Bundle-ClassPath: myapp_client_rap.jar” after
>>>>> Bundle-Version, there are all manner of errors related to the program
>>>>> not being able to find the Activator class.
>>>>>
>>>>> Any tips on where I am going wrong would be much appreciated.
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Christoph
>>>>
|
|
| |
Re: Unable to find file in classpath [message #437896 is a reply to message #426251] |
Fri, 31 July 2009 02:54 |
Christoph Messages: 55 Registered: July 2009 |
Member |
|
|
Björn, Tom -
Thanks for your help. It's working!
I made a bundle out of the Toplink jars and I did end up needing to add
"Eclipse-RegisterBuddy: [...toplink_bundle...]" to my Manifest.MF. That
did the trick.
Incidentally, I still had to retain my initial file structure:
+ Project_folder
+ src
- myapp.client.rap
- [various other source packages]
+ META-INF
- MANIFEST.MF
- persistence.xml
+ META-INF
- MANIFEST.MF
At some point I'll try and see if using eclipselink would allow me to
put persistence.xml into the top level META-INF.
Thanks again for your help. Particularly as this problem is, I see now,
only tangentially RAP-related.
-Christoph
On 07/30/2009 06:51 AM Thomas Haskes wrote:
> Hi Christoph,
>
> it could also help to provide Toplink with the right classloader:
>
> You just have to add these lines while creating the entityManagerFactory:
>
> HashMap props = new HashMap();
> props.put(PersistenceUnitProperties.CLASSLOADER,
> SomeClassInYourBundle.getClass().getClassLoader());
>
> If it's finding the persistence.xml then, but complaining about "No
> Peristence Provider found for "somePU" you can add this line to the
> manifest.mf
>
> JPA-PersistenceUnits: tup_pu
>
> I'm not sure if this line is only neccessary when using eclipselink-osgi.
>
> HTH,
>
> Tom
>
>
>>>> Hi Christoph,
>>>> as far as I know the META-INF/persistence.xml should be in project root
>>>> and must not be in src. I would rather suspect some kind of classloading
>>>> issue (or better: file-visibility-issue of the persistence.xml). Which
>>>> OR-Mapper do you use?
>>>>
>>>> Regards,
>>>> Björn
>>>>
|
|
|
Goto Forum:
Current Time: Fri Apr 26 08:36:58 GMT 2024
Powered by FUDForum. Page generated in 0.03285 seconds
|