IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

OGSi Java Discussion :

Eclipse RCP et serveur OSGI avec spring DM


Sujet :

OGSi Java

  1. #1
    Membre à l'essai
    Profil pro
    Inscrit en
    Mars 2009
    Messages
    20
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2009
    Messages : 20
    Points : 13
    Points
    13
    Par défaut Eclipse RCP et serveur OSGI avec spring DM
    Bonjour à tous,

    J'ai suivi, comme beaucoup apparemment, l'excellentissime blog d'Angelo Zerr intitulé "Conception d’un client Eclipse RCP et serveur OSGI avec Spring DM" qui (selon moi) constitue une excellente base de travail pour débuter et essayer de comprendre la programmation par modules.

    J'ai choisi de ne développer qu'une fonctionnalité simple comme sur le blog d'Angelo (Customer en lieu et place de User).

    J'ai développé les plugins domain, dao, dao.impl, services et services.impl en suivant les billets à priori jusqu'au billet 17 (avec un bout du billet 18 avec l'utilisation de la factory LocalContainerEntityManagerFactoryBean mais sans LTW).

    J'ai choisi une implémentation JPA avec EclipseLink avec la base de données H2.

    J'ai validé ces plugins avec une application Java qui me permet de créer et afficher des "Customers". Dans ce projet Java, j'ai déclaré dans le classpath tous les plugins qui sont dans la Target Platform de mes autres plugins et mes deux applications Java CreateCustomerTest et FindAllCustomersTest, qui sont des applications clientes de mes services osgi, fonctionnent :

    Je joins le code de l'application "CreateCustomerTest "

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
     
    package com.perdigal.client.test;
     
    import com.perdigal.server.services.ICustomerService;
     
    import org.springframework.context.ApplicationContext;
    import org.springframework.context.support.ClassPathXmlApplicationContext;
     
    public class CreateCustomerTest {
    	public static void main(String[] args) {
     
    		// 1. Load XML Spring file
    		ApplicationContext applicationContext = new ClassPathXmlApplicationContext("com/perdigal/client/applicationContext-jpa.xml");
     
    		// 2. Get service from Spring container
    		ICustomerService l_customerService = (ICustomerService) applicationContext.getBean("CustomerService");
     
    		try	{
    			// 3. Create customer
     
    			if(! l_customerService.isRegistered("Frédéric", "TOTO"))	{
    				l_customerService.addCustomer("Frédéric", "TOTO");
    			} else {
    				System.err.println("Customer TOTO already registered");
    			}
     
    			if(! l_customerService.isRegistered("Hervé", "TATA"))	{
    				l_customerService.addCustomer("Hervé", "TATA");
    			} else {
    				System.err.println("Customer TATA already registered");
    			}
     
    			if(! l_customerService.isRegistered("Eric", "TITI"))	{
    				l_customerService.addCustomer("Eric", "TITI");
    			} else {
    				System.err.println("Customer TITI already registered");
    			}
     
    			if(! l_customerService.isRegistered("Guilhem", "TUTU"))	{
    				l_customerService.addCustomer("Guilhem", "TUTU");
    			} else {
    				System.err.println("Customer TUTU already registered");
    			}
    		} catch(Exception e)	{
    			System.err.println(e.getLocalizedMessage());
    		}
    	}
    }
    Ensuite, j'ai voulu tester mes plugins avec une application RCP qui affiche la liste des "Customers" dans une View, et c'est là que je suis bloqué (depuis un bon mois) avec l'erreur suivante :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
     
     
    osgi> Start bundle [com.perdigal.server.dao.impl]
    0    [Start Level Event Dispatcher] INFO  org.springframework.osgi.extender.internal.activator.ContextLoaderListener  - Starting 
     
    [org.springframework.osgi.extender] bundle v.[1.2.0]
    131  [Start Level Event Dispatcher] INFO  org.springframework.osgi.extender.internal.support.ExtenderConfiguration  - No custom extender 
     
    configuration detected; using defaults...
    136  [Start Level Event Dispatcher] INFO  org.springframework.scheduling.timer.TimerTaskExecutor  - Initializing Timer
    194  [Start Level Event Dispatcher] INFO  org.springframework.osgi.extender.support.DefaultOsgiApplicationContextCreator  - Discovered 
     
    configurations {osgibundle:/META-INF/spring/*.xml} in bundle [Plugin d'implémentation des DAO (com.perdigal.server.dao.impl)]
    229  [SpringOsgiExtenderThread-1] INFO  org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext  - Refreshing 
     
    org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext@1342ba4: display name [OsgiBundleXmlApplicationContext
     
    (bundle=com.perdigal.server.dao.impl, config=osgibundle:/META-INF/spring/*.xml)]; startup date [Sun Sep 05 13:07:49 CEST 2010]; root of context 
     
    hierarchy
    229  [SpringOsgiExtenderThread-1] INFO  org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext  - Unpublishing application 
     
    context OSGi service for bundle Plugin d'implémentation des DAO (com.perdigal.server.dao.impl)
    300  [SpringOsgiExtenderThread-1] INFO  org.springframework.beans.factory.xml.XmlBeanDefinitionReader  - Loading XML bean definitions from URL 
     
    [bundleentry://13.fwk31843011/META-INF/spring/module-context.xml]
    492  [SpringOsgiExtenderThread-1] INFO  org.springframework.beans.factory.xml.XmlBeanDefinitionReader  - Loading XML bean definitions from URL 
     
    [bundleentry://13.fwk31843011/META-INF/spring/module-osgi-context.xml]
    Start bundle [com.perdigal.server.services.impl]
    516  [Start Level Event Dispatcher] INFO  org.springframework.osgi.extender.support.DefaultOsgiApplicationContextCreator  - Discovered 
     
    configurations {osgibundle:/META-INF/spring/*.xml} in bundle [OSGI Plugin Services (com.perdigal.server.services.impl)]
    528  [SpringOsgiExtenderThread-2] INFO  org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext  - Refreshing 
     
    org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext@47a0d4: display name [OsgiBundleXmlApplicationContext
     
    (bundle=com.perdigal.server.services.impl, config=osgibundle:/META-INF/spring/*.xml)]; startup date [Sun Sep 05 13:07:49 CEST 2010]; root of 
     
    context hierarchy
    528  [SpringOsgiExtenderThread-2] INFO  org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext  - Unpublishing application 
     
    context OSGi service for bundle OSGI Plugin Services (com.perdigal.server.services.impl)
    531  [SpringOsgiExtenderThread-2] INFO  org.springframework.beans.factory.xml.XmlBeanDefinitionReader  - Loading XML bean definitions from URL 
     
    [bundleentry://53.fwk31843011/META-INF/spring/module-context.xml]
    547  [SpringOsgiExtenderThread-2] INFO  org.springframework.beans.factory.xml.XmlBeanDefinitionReader  - Loading XML bean definitions from URL 
     
    [bundleentry://53.fwk31843011/META-INF/spring/module-osgi-context.xml]
    618  [SpringOsgiExtenderThread-2] INFO  org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext  - Bean factory for 
     
    application context [org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext@47a0d4]: 
     
    org.springframework.beans.factory.support.DefaultListableBeanFactory@1e2afb2
    639  [SpringOsgiExtenderThread-2] INFO  
     
    org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor  - No outstanding OSGi service 
     
    dependencies, completing initialization for OsgiBundleXmlApplicationContext(bundle=com.perdigal.server.services.impl, config=osgibundle:/META-
     
    INF/spring/*.xml)
    640  [SpringOsgiExtenderThread-1] INFO  org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext  - Bean factory for 
     
    application context [org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext@1342ba4]: 
     
    org.springframework.beans.factory.support.DefaultListableBeanFactory@16d835f
    644  [SpringOsgiExtenderThread-1] INFO  
     
    org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor  - No outstanding OSGi service 
     
    dependencies, completing initialization for OsgiBundleXmlApplicationContext(bundle=com.perdigal.server.dao.impl, config=osgibundle:/META-
     
    INF/spring/*.xml)
    647  [SpringOsgiExtenderThread-4] INFO  org.springframework.beans.factory.support.DefaultListableBeanFactory  - Pre-instantiating singletons in 
     
    org.springframework.beans.factory.support.DefaultListableBeanFactory@16d835f: defining beans 
     
    [CustomerDAO,org.springframework.osgi.service.exporter.support.OsgiServiceFactoryBean#0]; root of factory hierarchy
    665  [SpringOsgiExtenderThread-3] INFO  org.springframework.beans.factory.support.DefaultListableBeanFactory  - Pre-instantiating singletons in 
     
    org.springframework.beans.factory.support.DefaultListableBeanFactory@1e2afb2: defining beans 
     
    [CustomerService,org.springframework.osgi.service.exporter.support.OsgiServiceFactoryBean#0]; root of factory hierarchy
    Start bundle [com.perdigal.client.rcp.test]
    691  [main] INFO  org.springframework.osgi.extender.support.DefaultOsgiApplicationContextCreator  - Discovered configurations 
     
    {osgibundle:/META-INF/spring/*.xml} in bundle [RCP client application (com.perdigal.client.rcp.test;singleton:=true)]
    713  [SpringOsgiExtenderThread-3] INFO  org.springframework.osgi.service.exporter.support.OsgiServiceFactoryBean  - Publishing service under 
     
    classes [{com.perdigal.server.services.ICustomerService}]
    716  [SpringOsgiExtenderThread-3] INFO  org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext  - Publishing application 
     
    context as OSGi service with properties {org.springframework.context.service.name=com.perdigal.server.services.impl, Bundle-
     
    SymbolicName=com.perdigal.server.services.impl, Bundle-Version=1.0.0}
    723  [SpringOsgiExtenderThread-3] INFO  org.springframework.osgi.extender.internal.activator.ContextLoaderListener  - Application context 
     
    successfully refreshed (OsgiBundleXmlApplicationContext(bundle=com.perdigal.server.services.impl, config=osgibundle:/META-INF/spring/*.xml))
    726  [SpringOsgiExtenderThread-4] INFO  org.springframework.osgi.service.exporter.support.OsgiServiceFactoryBean  - Publishing service under 
     
    classes [{com.perdigal.server.dao.ICustomerDAO}]
    727  [SpringOsgiExtenderThread-4] INFO  org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext  - Publishing application 
     
    context as OSGi service with properties {org.springframework.context.service.name=com.perdigal.server.dao.impl, Bundle-
     
    SymbolicName=com.perdigal.server.dao.impl, Bundle-Version=1.0.0}
    728  [SpringOsgiExtenderThread-4] INFO  org.springframework.osgi.extender.internal.activator.ContextLoaderListener  - Application context 
     
    successfully refreshed (OsgiBundleXmlApplicationContext(bundle=com.perdigal.server.dao.impl, config=osgibundle:/META-INF/spring/*.xml))
    729  [SpringOsgiExtenderThread-5] INFO  org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext  - Refreshing 
     
    org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext@38fff7: display name [OsgiBundleXmlApplicationContext
     
    (bundle=com.perdigal.client.rcp.test, config=osgibundle:/META-INF/spring/*.xml)]; startup date [Sun Sep 05 13:07:49 CEST 2010]; root of context 
     
    hierarchy
    729  [SpringOsgiExtenderThread-5] INFO  org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext  - Unpublishing application 
     
    context OSGi service for bundle RCP client application (com.perdigal.client.rcp.test;singleton:=true)
    Start RCP Application Test
    739  [SpringOsgiExtenderThread-5] INFO  org.springframework.beans.factory.xml.XmlBeanDefinitionReader  - Loading XML bean definitions from URL 
     
    [bundleentry://36.fwk31843011/META-INF/spring/module-context.xml]
    758  [SpringOsgiExtenderThread-5] INFO  org.springframework.beans.factory.xml.XmlBeanDefinitionReader  - Loading XML bean definitions from URL 
     
    [bundleentry://36.fwk31843011/META-INF/spring/module-osgi-context.xml]
    801  [SpringOsgiExtenderThread-5] INFO  org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext  - Bean factory for 
     
    application context [org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext@38fff7]: 
     
    org.springframework.beans.factory.support.DefaultListableBeanFactory@13829d5
    820  [SpringOsgiExtenderThread-5] INFO  
     
    org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor  - No outstanding OSGi service 
     
    dependencies, completing initialization for OsgiBundleXmlApplicationContext(bundle=com.perdigal.client.rcp.test, config=osgibundle:/META-
     
    INF/spring/*.xml)
    Start bundle [com.perdigal.server.domain]
    847  [SpringOsgiExtenderThread-6] INFO  org.springframework.beans.factory.support.DefaultListableBeanFactory  - Pre-instantiating singletons in 
     
    org.springframework.beans.factory.support.DefaultListableBeanFactory@13829d5: defining beans 
     
    [com.perdigal.client.rcp.test.view,CustomerService]; root of factory hierarchy
    880  [SpringOsgiExtenderThread-6] INFO  org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext  - Publishing application 
     
    context as OSGi service with properties {org.springframework.context.service.name=com.perdigal.client.rcp.test, Bundle-
     
    SymbolicName=com.perdigal.client.rcp.test, Bundle-Version=1.0.0}
    881  [SpringOsgiExtenderThread-6] INFO  org.springframework.osgi.extender.internal.activator.ContextLoaderListener  - Application context 
     
    successfully refreshed (OsgiBundleXmlApplicationContext(bundle=com.perdigal.client.rcp.test, config=osgibundle:/META-INF/spring/*.xml))
    java.lang.NullPointerException
    	at com.perdigal.server.services.impl.CustomerServiceImpl.getCustomers(CustomerServiceImpl.java:22)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:597)
    	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
    	at org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:58)
    	at org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:62)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    	at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
    	at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    	at org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:56)
    	at org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:39)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    	at org.springframework.osgi.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:59)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    	at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
    	at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
    	at $Proxy3.getCustomers(Unknown Source)
    	at com.perdigal.client.rcp.test.View.refresh(View.java:103)
    	at com.perdigal.client.rcp.test.View.createPartControl(View.java:95)
    	at org.eclipse.ui.internal.ViewReference.createPartHelper(ViewReference.java:367)
    	at org.eclipse.ui.internal.ViewReference.createPart(ViewReference.java:226)
    	at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)
    	at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:313)
    	at org.eclipse.ui.internal.ViewPane.setVisible(ViewPane.java:529)
    	at org.eclipse.ui.internal.presentations.PresentablePart.setVisible(PresentablePart.java:180)
    	at org.eclipse.ui.internal.presentations.util.PresentablePartFolder.select(PresentablePartFolder.java:270)
    	at org.eclipse.ui.internal.presentations.util.LeftToRightTabOrder.select(LeftToRightTabOrder.java:65)
    	at org.eclipse.ui.internal.presentations.util.TabbedStackPresentation.selectPart(TabbedStackPresentation.java:473)
    	at org.eclipse.ui.internal.PartStack.refreshPresentationSelection(PartStack.java:1256)
    	at org.eclipse.ui.internal.PartStack.setSelection(PartStack.java:1209)
    	at org.eclipse.ui.internal.PartStack.showPart(PartStack.java:1608)
    	at org.eclipse.ui.internal.PartStack.createControl(PartStack.java:649)
    	at org.eclipse.ui.internal.PartStack.createControl(PartStack.java:576)
    	at org.eclipse.ui.internal.PartSashContainer.createControl(PartSashContainer.java:568)
    	at org.eclipse.ui.internal.PerspectiveHelper.activate(PerspectiveHelper.java:272)
    	at org.eclipse.ui.internal.Perspective.onActivate(Perspective.java:982)
    	at org.eclipse.ui.internal.WorkbenchPage.onActivate(WorkbenchPage.java:2626)
    	at org.eclipse.ui.internal.WorkbenchWindow$27.run(WorkbenchWindow.java:2965)
    	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
    	at org.eclipse.ui.internal.WorkbenchWindow.setActivePage(WorkbenchWindow.java:2946)
    	at org.eclipse.ui.internal.WorkbenchWindow.busyOpenPage(WorkbenchWindow.java:761)
    	at org.eclipse.ui.internal.Workbench$21.runWithException(Workbench.java:1045)
    	at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
    	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
    	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
    	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3855)
    	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3476)
    	at org.eclipse.ui.application.WorkbenchAdvisor.openWindows(WorkbenchAdvisor.java:803)
    	at org.eclipse.ui.internal.Workbench$28.runWithException(Workbench.java:1384)
    	at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
    	at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:179)
    	at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:150)
    	at org.eclipse.swt.widgets.Display.syncExec(Display.java:4312)
    	at org.eclipse.ui.internal.StartupThreading.runWithoutExceptions(StartupThreading.java:94)
    	at org.eclipse.ui.internal.Workbench.init(Workbench.java:1379)
    	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2335)
    	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
    	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
    	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
    	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    	at com.perdigal.client.rcp.test.Application.start(Application.java:22)
    	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
    	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
    	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
    	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)
    	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:597)
    	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
    	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
    	at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
    	at org.eclipse.equinox.launcher.Main.main(Main.java:1287)
    7780 [main] INFO  org.springframework.osgi.extender.internal.activator.ContextLoaderListener  - Stopping [org.springframework.osgi.extender] 
     
    bundle v.[1.2.0]
    7789 [Timer-1] INFO  org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext  - Application Context service already 
     
    unpublished
    7789 [Timer-1] INFO  org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext  - Closing 
     
    org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext@1342ba4: display name [OsgiBundleXmlApplicationContext
     
    (bundle=com.perdigal.server.dao.impl, config=osgibundle:/META-INF/spring/*.xml)]; startup date [Sun Sep 05 13:07:49 CEST 2010]; root of context 
     
    hierarchy
    7789 [Timer-1] INFO  org.springframework.beans.factory.support.DefaultListableBeanFactory  - Destroying singletons in 
     
    org.springframework.beans.factory.support.DefaultListableBeanFactory@16d835f: defining beans 
     
    [CustomerDAO,org.springframework.osgi.service.exporter.support.OsgiServiceFactoryBean#0]; root of factory hierarchy
    7790 [Timer-1] INFO  org.springframework.osgi.service.exporter.support.OsgiServiceFactoryBean  - Unregistered service 
     
    [ServiceRegistrationWrapper for {com.perdigal.server.dao.ICustomerDAO}={org.springframework.osgi.bean.name=CustomerDAO, Bundle-
     
    SymbolicName=com.perdigal.server.dao.impl, Bundle-Version=1.0.0, service.id=45}]
    7790 [Timer-1] INFO  org.springframework.osgi.extender.internal.activator.ContextLoaderListener  - Application context succesfully closed 
     
    (OsgiBundleXmlApplicationContext(bundle=com.perdigal.server.dao.impl, config=osgibundle:/META-INF/spring/*.xml))
    7791 [Timer-1] INFO  org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext  - Application Context service already 
     
    unpublished
    7791 [Timer-1] INFO  org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext  - Closing 
     
    org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext@38fff7: display name [OsgiBundleXmlApplicationContext
     
    (bundle=com.perdigal.client.rcp.test, config=osgibundle:/META-INF/spring/*.xml)]; startup date [Sun Sep 05 13:07:49 CEST 2010]; root of context 
     
    hierarchy
    7791 [Timer-1] INFO  org.springframework.beans.factory.support.DefaultListableBeanFactory  - Destroying singletons in 
     
    org.springframework.beans.factory.support.DefaultListableBeanFactory@13829d5: defining beans 
     
    [com.perdigal.client.rcp.test.view,CustomerService]; root of factory hierarchy
    7792 [Timer-1] INFO  org.springframework.osgi.extender.internal.activator.ContextLoaderListener  - Application context succesfully closed 
     
    (OsgiBundleXmlApplicationContext(bundle=com.perdigal.client.rcp.test, config=osgibundle:/META-INF/spring/*.xml))
    7793 [Timer-1] INFO  org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext  - Application Context service already 
     
    unpublished
    7793 [Timer-1] INFO  org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext  - Closing 
     
    org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext@47a0d4: display name [OsgiBundleXmlApplicationContext
     
    (bundle=com.perdigal.server.services.impl, config=osgibundle:/META-INF/spring/*.xml)]; startup date [Sun Sep 05 13:07:49 CEST 2010]; root of 
     
    context hierarchy
    7793 [Timer-1] INFO  org.springframework.beans.factory.support.DefaultListableBeanFactory  - Destroying singletons in 
     
    org.springframework.beans.factory.support.DefaultListableBeanFactory@1e2afb2: defining beans 
     
    [CustomerService,org.springframework.osgi.service.exporter.support.OsgiServiceFactoryBean#0]; root of factory hierarchy
    7794 [Timer-1] INFO  org.springframework.osgi.service.exporter.support.OsgiServiceFactoryBean  - Unregistered service 
     
    [ServiceRegistrationWrapper for {com.perdigal.server.services.ICustomerService}={org.springframework.osgi.bean.name=CustomerService, Bundle-
     
    SymbolicName=com.perdigal.server.services.impl, Bundle-Version=1.0.0, service.id=43}]
    7794 [Timer-1] INFO  org.springframework.osgi.extender.internal.activator.ContextLoaderListener  - Application context succesfully closed 
     
    (OsgiBundleXmlApplicationContext(bundle=com.perdigal.server.services.impl, config=osgibundle:/META-INF/spring/*.xml))
    7795 [main] INFO  org.springframework.scheduling.timer.TimerTaskExecutor  - Cancelling Timer
    Stop bundle [com.perdigal.server.dao.impl]
    Stop bundle [com.perdigal.client.rcp.test]
    Stop bundle [com.perdigal.server.services.impl]
    Stop bundle [com.perdigal.server.domain]
    On dirait que le service CustomerService n'est pas enregistré dans le registre osgi mais lorsque je remplace la classe d'implémentation du service "com.perdigal.server.services.impl.CustomerServiceImpl" par une implémentation bouchonnée non JPA du service, la liste des "Customers" s'affiche.

    Est-ce que quelqu'un peut m'aider à debugger parce que je ne sais plus par quel bout prendre le problème ;-)

    D'avance merci pour votre aide.

    Hervé

  2. #2
    Membre à l'essai

    Profil pro
    Inscrit en
    Juillet 2009
    Messages
    3
    Détails du profil
    Informations personnelles :
    Âge : 50
    Localisation : France, Nord (Nord Pas de Calais)

    Informations forums :
    Inscription : Juillet 2009
    Messages : 3
    Points : 10
    Points
    10
    Par défaut DynaResume
    Bonjour,

    au vue de ta stack Trace, je penche pour un NullPointerException dans CustomerServiceImpl.

    Penses tu que le DAO soit bien injecté dans ton bean "CustomerServiceImpl" ?

    Tu trouveras des exemples de code (basé sur hibernate et pas sur EclipseLink) dans l'appli DynaResume (http://code.google.com/p/dynaresume/) qui a servi de base à Angelo pour ses billets.

    Tes commentaires sur le groupe correspondant sont les bienvenus (http://groups.google.fr/group/dynaresume?pli=1)

  3. #3
    Membre à l'essai
    Profil pro
    Inscrit en
    Mars 2009
    Messages
    20
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2009
    Messages : 20
    Points : 13
    Points
    13
    Par défaut
    Bonjour,
    Je ne sais pas si le problème vient du code du service car avec un bouchon (sans la DAO) le code fonctionne. Même s'il ressort au niveau du service, je penche plutôt pour un problème entre le service et la DAO.

    Voici le code de CustomerServiceImpl
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
     
    package com.perdigal.server.services.impl;
     
    import java.util.Collection;
     
    import org.springframework.transaction.annotation.Transactional;
     
    import com.perdigal.server.dao.ICustomerDAO;
    import com.perdigal.server.domain.Customer;
    import com.perdigal.server.services.ICustomerService;
     
     
    @Transactional(readOnly=true)
    public class CustomerServiceImpl implements ICustomerService	{
     
    	private ICustomerDAO customerDAO;
     
    	public void setICustomerDAO(ICustomerDAO p_customerDAO) {
    		this.customerDAO = p_customerDAO;
    	}
     
    	public Collection<Customer> getCustomers() {
    		return customerDAO.getCustomers();
    	}
     
    	public boolean isRegistered(String p_lname, String p_fname)	{
    		Customer l_customer = new Customer(p_lname, p_fname);
    		return customerDAO.isRegistered(l_customer);
    	}
     
    	@Transactional
    	public Customer addCustomer(String p_lname, String p_fname)	{
    		Customer l_customer = new Customer(p_lname, p_fname);
    		return customerDAO.addCustomer(l_customer);
    	}
    }
    et les fichiers spring du plugin com.perdigal.server.services.impl

    Fichier module-context.xml
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
     
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans
    	http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
     
    	<bean id="CustomerService" class="com.perdigal.server.services.impl.CustomerServiceImpl"></bean>
    </beans>
    et le fichier module-osgi-context.xml
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
     
    <?xml version="1.0" encoding="UTF-8"?>
     
    <beans xmlns="http://www.springframework.org/schema/beans"
     
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xmlns:osgi="http://www.springframework.org/schema/osgi"
     
    	xsi:schemaLocation="http://www.springframework.org/schema/osgi
    	http://www.springframework.org/schema/osgi/spring-osgi-1.0.xsd
    	http://www.springframework.org/schema/beans
    	http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
     
     
    	<osgi:service ref="CustomerService" interface="com.perdigal.server.services.ICustomerService" />
     
    </beans>
    Le code de la dao (plugin com.perdigal.server.dao.impl)
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
     
    package com.perdigal.server.dao.impl;
     
    import java.util.Collection;
     
    import javax.persistence.EntityManager;
    import javax.persistence.PersistenceContext;
    import javax.persistence.Query;
     
    import com.perdigal.server.dao.ICustomerDAO;
    import com.perdigal.server.domain.Customer;
     
    public class CustomerDAOImpl implements ICustomerDAO
    {
    	@PersistenceContext
    	private EntityManager entityManager;
     
    	public Customer addCustomer(Customer p_customer)	{
    		entityManager.persist(p_customer);
    		return p_customer;
    	}
     
    	public boolean isRegistered(Customer p_customer)	{
    		Query l_query = entityManager.createQuery("SELECT customer FROM Customer AS customer WHERE customer.firstname = :p_firstname AND customer.lastname = :p_lastname");
    		l_query = l_query.setParameter("p_firstname", p_customer.getFirstname()).setParameter("p_lastname", p_customer.getLastname());
    		return (l_query.getResultList().size() == 0) ? false : true;
    	}
     
    	@SuppressWarnings("unchecked")
    	public Collection<Customer> getCustomers()	{
    		Query l_query = entityManager.createQuery("SELECT customer FROM Customer AS customer");
    		return l_query.getResultList();
    	}
    }
    et les fichiers spring du plugin com.perdigal.server.dao.impl

    module-context.xml
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
     
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans
    	http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
     
    	<bean id="CustomerDAO" class="com.perdigal.server.dao.impl.CustomerDAOImpl"></bean>
    </beans>
    et module-osgi-context.xml
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
     
    <?xml version="1.0" encoding="UTF-8"?>
     
    <beans xmlns="http://www.springframework.org/schema/beans"
     
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xmlns:osgi="http://www.springframework.org/schema/osgi"
     
    	xsi:schemaLocation="http://www.springframework.org/schema/osgi
    	http://www.springframework.org/schema/osgi/spring-osgi-1.0.xsd
     
    	http://www.springframework.org/schema/beans
    	http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
     
     
    	<osgi:service ref="CustomerDAO" interface="com.perdigal.server.dao.ICustomerDAO" />
     
    </beans>
    et pour finir les fichiers spring du plugin com.perdigal.client.rcp.test

    module-context.xml
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
     
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans
    	http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
     
    	<bean id="com.perdigal.client.rcp.test.view" class="com.perdigal.client.rcp.test.View" scope="prototype">
    		<property name="customerService" ref="CustomerService"></property>
    	</bean>
    </beans>
    et module-osgi-context.xml
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
     
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xmlns:osgi="http://www.springframework.org/schema/osgi"
    	xsi:schemaLocation="http://www.springframework.org/schema/osgi  
    	http://www.springframework.org/schema/osgi/spring-osgi-1.0.xsd
    	http://www.springframework.org/schema/beans   
    	http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
     
    	<osgi:reference id="CustomerService" interface="com.perdigal.server.services.ICustomerService" cardinality="0..1" timeout="1000" />
    </beans>
    et le fichier plugin.xml du plugin com.perdigal.client.rcp.test
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
     
    <?xml version="1.0" encoding="UTF-8"?>
    <?eclipse version="3.4"?>
    <plugin>
       <extension
             id="application"
             point="org.eclipse.core.runtime.applications">
          <application>
             <run
                   class="com.perdigal.client.rcp.test.Application">
             </run>
          </application>
       </extension>
       <extension
             point="org.eclipse.ui.perspectives">
          <perspective
                name="Perspective"
                class="com.perdigal.client.rcp.test.Perspective"
                id="com.perdigal.client.rcp.test.perspective">
          </perspective>
       </extension>
       <extension
             point="org.eclipse.ui.views">
          <view
                name="View"
                class="org.eclipse.springframework.util.SpringExtensionFactory"
                id="com.perdigal.client.rcp.test.view">
          </view>
       </extension>
    </plugin>

Discussions similaires

  1. Réponses: 3
    Dernier message: 03/10/2009, 15h26
  2. Etude Eclipse RCP client/serveur
    Par azerr dans le forum Eclipse Platform
    Réponses: 2
    Dernier message: 28/09/2009, 15h44
  3. problème avec tuto sur eclipse RCP
    Par henpower dans le forum Eclipse Platform
    Réponses: 1
    Dernier message: 18/03/2008, 17h14
  4. spring RCP ou eclipse RCP
    Par noussa1982 dans le forum Eclipse Platform
    Réponses: 3
    Dernier message: 22/01/2007, 11h22

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo