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

Wildfly/JBoss Java Discussion :

Erreur dans l'exécution du client Bean sur JBoss


Sujet :

Wildfly/JBoss Java

  1. #1
    Membre averti
    Étudiant
    Inscrit en
    Janvier 2011
    Messages
    35
    Détails du profil
    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Janvier 2011
    Messages : 35
    Par défaut Erreur dans l'exécution du client Bean sur JBoss
    Bonjour :
    J'ai problème lors du lancement du client EJB3, le serveur JBOOS démarre sans problème, j'utilise JBOSSE 5.1.0, Eclipse HELIOS et Postgresql 8.4
    Quand j'exécute la classe "stockage" j'aurai se problème :
    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
    Exception in thread "main" javax.naming.NameNotFoundException: FichiersPhotoBean not bound
    	at org.jnp.server.NamingServer.getBinding(NamingServer.java:771)
    	at org.jnp.server.NamingServer.getBinding(NamingServer.java:779)
    	at org.jnp.server.NamingServer.getObject(NamingServer.java:785)
    	at org.jnp.server.NamingServer.lookup(NamingServer.java:396)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    	at java.lang.reflect.Method.invoke(Unknown Source)
    	at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
    	at sun.rmi.transport.Transport$1.run(Unknown Source)
    	at sun.rmi.transport.Transport$1.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at sun.rmi.transport.Transport.serviceCall(Unknown Source)
    	at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
    	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source)
    	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    	at java.lang.Thread.run(Unknown Source)
    	at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
    	at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
    	at sun.rmi.server.UnicastRef.invoke(Unknown Source)
    	at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
    	at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:726)
    	at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:686)
    	at javax.naming.InitialContext.lookup(Unknown Source)
    	at photos.Stockage.main(Stockage.java:57)
    la console après lancement du serveur:
    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
     
    02:09:00,410 INFO  [ServerImpl] Starting JBoss (Microcontainer)...
    02:09:00,411 INFO  [ServerImpl] Release ID: JBoss [The Oracle] 5.1.0.GA (build: SVNTag=JBoss_5_1_0_GA date=200905221634)
    02:09:00,412 INFO  [ServerImpl] Bootstrap URL: null
    02:09:00,412 INFO  [ServerImpl] Home Dir: E:\Program Files\jboss-5.1.0.GA
    02:09:00,412 INFO  [ServerImpl] Home URL: file:/E:/Program%20Files/jboss-5.1.0.GA/
    02:09:00,412 INFO  [ServerImpl] Library URL: file:/E:/Program%20Files/jboss-5.1.0.GA/lib/
    02:09:00,413 INFO  [ServerImpl] Patch URL: null
    02:09:00,413 INFO  [ServerImpl] Common Base URL: file:/E:/Program%20Files/jboss-5.1.0.GA/common/
    02:09:00,413 INFO  [ServerImpl] Common Library URL: file:/E:/Program%20Files/jboss-5.1.0.GA/common/lib/
    02:09:00,414 INFO  [ServerImpl] Server Name: default
    02:09:00,414 INFO  [ServerImpl] Server Base Dir: E:\Program Files\jboss-5.1.0.GA\server
    02:09:00,414 INFO  [ServerImpl] Server Base URL: file:/E:/Program%20Files/jboss-5.1.0.GA/server/
    02:09:00,414 INFO  [ServerImpl] Server Config URL: file:/E:/Program%20Files/jboss-5.1.0.GA/server/default/conf/
    02:09:00,414 INFO  [ServerImpl] Server Home Dir: E:\Program Files\jboss-5.1.0.GA\server\default
    02:09:00,414 INFO  [ServerImpl] Server Home URL: file:/E:/Program%20Files/jboss-5.1.0.GA/server/default/
    02:09:00,414 INFO  [ServerImpl] Server Data Dir: E:\Program Files\jboss-5.1.0.GA\server\default\data
    02:09:00,414 INFO  [ServerImpl] Server Library URL: file:/E:/Program%20Files/jboss-5.1.0.GA/server/default/lib/
    02:09:00,414 INFO  [ServerImpl] Server Log Dir: E:\Program Files\jboss-5.1.0.GA\server\default\log
    02:09:00,421 INFO  [ServerImpl] Server Native Dir: E:\Program Files\jboss-5.1.0.GA\server\default\tmp\native
    02:09:00,421 INFO  [ServerImpl] Server Temp Dir: E:\Program Files\jboss-5.1.0.GA\server\default\tmp
    02:09:00,421 INFO  [ServerImpl] Server Temp Deploy Dir: E:\Program Files\jboss-5.1.0.GA\server\default\tmp\deploy
    02:09:01,073 INFO  [ServerImpl] Starting Microcontainer, bootstrapURL=file:/E:/Program%20Files/jboss-5.1.0.GA/server/default/conf/bootstrap.xml
    02:09:01,590 INFO  [VFSCacheFactory] Initializing VFSCache [org.jboss.virtual.plugins.cache.CombinedVFSCache]
    02:09:01,593 INFO  [VFSCacheFactory] Using VFSCache [CombinedVFSCache[real-cache: null]]
    02:09:01,824 INFO  [CopyMechanism] VFS temp dir: E:\Program Files\jboss-5.1.0.GA\server\default\tmp
    02:09:01,825 INFO  [ZipEntryContext] VFS force nested jars copy-mode is enabled.
    02:09:02,653 INFO  [ServerInfo] Java version: 1.7.0-ea,Oracle Corporation
    02:09:02,653 INFO  [ServerInfo] Java Runtime: Java(TM) SE Runtime Environment (build 1.7.0-ea-b119)
    02:09:02,654 INFO  [ServerInfo] Java VM: Java HotSpot(TM) Client VM 20.0-b03,Oracle Corporation
    02:09:02,654 INFO  [ServerInfo] OS-System: Windows 7 6.1,x86
    02:09:02,655 INFO  [ServerInfo] VM arguments: -Dprogram.name=run.bat -Xms128m -Xmx512m -XX:MaxPermSize=256m -Dfile.encoding=Cp1256 
    02:09:02,685 INFO  [JMXKernel] Legacy JMX core initialized
    02:09:04,111 INFO  [ProfileServiceBootstrap] Loading profile: ProfileKey@18af9c0[domain=default, server=default, name=default]
    02:09:05,512 INFO  [WebService] Using RMI server codebase: http://127.0.0.1:8083/
    02:09:10,314 INFO  [NativeServerConfig] JBoss Web Services - Stack Native Core
    02:09:10,314 INFO  [NativeServerConfig] 3.1.2.GA
    02:09:10,868 INFO  [AttributeCallbackItem] Owner callback not implemented.
    02:09:12,130 INFO  [LogNotificationListener] Adding notification listener for logging mbean "jboss.system:service=Logging,type=Log4jService" to server org.jboss.mx.server.MBeanServerImpl@738dcb[ defaultDomain='jboss' ]
    02:09:21,370 INFO  [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@19847256{vfszip:/E:/Program%20Files/jboss-5.1.0.GA/server/default/deploy/IntroEJB3.jar/}
    02:09:21,371 INFO  [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@19847256{vfszip:/E:/Program%20Files/jboss-5.1.0.GA/server/default/deploy/IntroEJB3.jar/}
    02:09:21,372 INFO  [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@32232973{vfszip:/E:/Program%20Files/jboss-5.1.0.GA/server/default/deploy/Photos-ejb.jar/}
    02:09:21,372 INFO  [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@32232973{vfszip:/E:/Program%20Files/jboss-5.1.0.GA/server/default/deploy/Photos-ejb.jar/}
    02:09:21,373 INFO  [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@8696763{vfsfile:/E:/Program%20Files/jboss-5.1.0.GA/server/default/deploy/profileservice-secured.jar/}
    02:09:21,374 INFO  [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@8696763{vfsfile:/E:/Program%20Files/jboss-5.1.0.GA/server/default/deploy/profileservice-secured.jar/}
    02:09:21,374 INFO  [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@8696763{vfsfile:/E:/Program%20Files/jboss-5.1.0.GA/server/default/deploy/profileservice-secured.jar/}
    02:09:21,374 INFO  [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@8696763{vfsfile:/E:/Program%20Files/jboss-5.1.0.GA/server/default/deploy/profileservice-secured.jar/}
    02:09:24,107 INFO  [JMXConnectorServerService] JMX Connector server: service:jmx:rmi://127.0.0.1/jndi/rmi://127.0.0.1:1090/jmxconnector
    02:09:24,261 INFO  [MailService] Mail Service bound to java:/Mail
    02:09:27,913 WARN  [JBossASSecurityMetadataStore] WARNING! POTENTIAL SECURITY RISK. It has been detected that the MessageSucker component which sucks messages from one node to another has not had its password changed from the installation default. Please see the JBoss Messaging user guide for instructions on how to do this.
    02:09:27,929 WARN  [AnnotationCreator] No ClassLoader provided, using TCCL: org.jboss.managed.api.annotation.ManagementComponent
    02:09:28,021 WARN  [AnnotationCreator] No ClassLoader provided, using TCCL: org.jboss.managed.api.annotation.ManagementComponent
    02:09:28,091 INFO  [TransactionManagerService] JBossTS Transaction Service (JTA version - tag:JBOSSTS_4_6_1_GA) - JBoss Inc.
    02:09:28,091 INFO  [TransactionManagerService] Setting up property manager MBean and JMX layer
    02:09:28,515 INFO  [TransactionManagerService] Initializing recovery manager
    02:09:28,668 INFO  [TransactionManagerService] Recovery manager configured
    02:09:28,669 INFO  [TransactionManagerService] Binding TransactionManager JNDI Reference
    02:09:28,697 INFO  [TransactionManagerService] Starting transaction recovery manager
    02:09:29,193 INFO  [AprLifecycleListener] The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre7\bin;.;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre7/bin/client;C:/Program Files/Java/jre7/bin;C:/Program Files/Java/jre7/lib/i386;C:\Program Files\NVIDIA Corporation\PhysX\Common;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Windows Live\Shared;;C:\Program Files\Java\jdk1.7.0\bin;C:\Program Files\Apache Software Foundation\apache-maven-2.2.1\bin;E:\Program Files\jboss-5.1.0.GA\bin;C:\SUN\SDK\bin;E:\Downloads\Compressed\eclipse Helios;
    02:09:29,253 INFO  [Http11Protocol] Initialisation de Coyote HTTP/1.1 sur http-127.0.0.1-8080
    02:09:29,254 INFO  [AjpProtocol] Initializing Coyote AJP/1.3 on ajp-127.0.0.1-8009
    02:09:29,294 INFO  [StandardService] Dï?½marrage du service jboss.web
    02:09:29,299 INFO  [StandardEngine] Starting Servlet Engine: JBoss Web/2.1.3.GA
    02:09:30,002 INFO  [Catalina] Server startup in 747 ms
    02:09:30,024 INFO  [TomcatDeployment] deploy, ctxPath=/invoker
    02:09:30,615 INFO  [TomcatDeployment] deploy, ctxPath=/web-console
    02:09:30,955 INFO  [TomcatDeployment] deploy, ctxPath=/jbossws
    02:09:31,082 INFO  [RARDeployment] Required license terms exist, view vfszip:/E:/Program Files/jboss-5.1.0.GA/server/default/deploy/jboss-local-jdbc.rar/META-INF/ra.xml
    02:09:31,101 INFO  [RARDeployment] Required license terms exist, view vfszip:/E:/Program Files/jboss-5.1.0.GA/server/default/deploy/jboss-xa-jdbc.rar/META-INF/ra.xml
    02:09:31,125 INFO  [RARDeployment] Required license terms exist, view vfszip:/E:/Program Files/jboss-5.1.0.GA/server/default/deploy/jms-ra.rar/META-INF/ra.xml
    02:09:31,142 INFO  [RARDeployment] Required license terms exist, view vfszip:/E:/Program Files/jboss-5.1.0.GA/server/default/deploy/mail-ra.rar/META-INF/ra.xml
    02:09:31,164 INFO  [RARDeployment] Required license terms exist, view vfszip:/E:/Program Files/jboss-5.1.0.GA/server/default/deploy/quartz-ra.rar/META-INF/ra.xml
    02:09:31,310 INFO  [SimpleThreadPool] Job execution threads will use class loader of thread: main
    02:09:31,348 INFO  [QuartzScheduler] Quartz Scheduler v.1.5.2 created.
    02:09:31,353 INFO  [RAMJobStore] RAMJobStore initialized.
    02:09:31,353 INFO  [StdSchedulerFactory] Quartz scheduler 'DefaultQuartzScheduler' initialized from default resource file in Quartz package: 'quartz.properties'
    02:09:31,353 INFO  [StdSchedulerFactory] Quartz scheduler version: 1.5.2
    02:09:31,353 INFO  [QuartzScheduler] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started.
    02:09:31,523 INFO  [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=Photos-ejbPU' to JNDI name 'java:Photos-ejbPU'
    02:09:32,740 INFO  [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=DefaultDS' to JNDI name 'java:DefaultDS'
    02:09:33,149 INFO  [ServerPeer] JBoss Messaging 1.4.3.GA server [0] started
    02:09:33,229 INFO  [ConnectionFactoryJNDIMapper] supportsFailover attribute is true on connection factory: jboss.messaging.connectionfactory:service=ClusteredConnectionFactory but post office is non clustered. So connection factory will *not* support failover
    02:09:33,229 INFO  [ConnectionFactoryJNDIMapper] supportsLoadBalancing attribute is true on connection factory: jboss.messaging.connectionfactory:service=ClusteredConnectionFactory but post office is non clustered. So connection factory will *not* support load balancing
    02:09:33,284 INFO  [ConnectionFactory] Connector bisocket://127.0.0.1:4457 has leasing enabled, lease period 10000 milliseconds
    02:09:33,284 INFO  [ConnectionFactory] org.jboss.jms.server.connectionfactory.ConnectionFactory@80e41f started
    02:09:33,299 INFO  [QueueService] Queue[/queue/DLQ] started, fullSize=200000, pageSize=2000, downCacheSize=2000
    02:09:33,301 INFO  [ConnectionFactory] Connector bisocket://127.0.0.1:4457 has leasing enabled, lease period 10000 milliseconds
    02:09:33,301 INFO  [ConnectionFactory] org.jboss.jms.server.connectionfactory.ConnectionFactory@15dc5d3 started
    02:09:33,302 INFO  [ConnectionFactory] Connector bisocket://127.0.0.1:4457 has leasing enabled, lease period 10000 milliseconds
    02:09:33,302 INFO  [ConnectionFactory] org.jboss.jms.server.connectionfactory.ConnectionFactory@1250601 started
    02:09:33,303 INFO  [QueueService] Queue[/queue/ExpiryQueue] started, fullSize=200000, pageSize=2000, downCacheSize=2000
    02:09:33,402 INFO  [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name 'java:JmsXA'
    02:09:33,687 INFO  [JBossASKernel] Created KernelDeployment for: IntroEJB3.jar
    02:09:33,693 INFO  [JBossASKernel] installing bean: jboss.j2ee:jar=IntroEJB3.jar,name=GestionDeStockBean,service=EJB3
    02:09:33,693 INFO  [JBossASKernel]   with dependencies:
    02:09:33,693 INFO  [JBossASKernel]   and demands:
    02:09:33,693 INFO  [JBossASKernel] 	persistence.unit:unitName=#BankService
    02:09:33,694 INFO  [JBossASKernel] 	jboss.ejb:service=EJBTimerService
    02:09:33,694 INFO  [JBossASKernel]   and supplies:
    02:09:33,694 INFO  [JBossASKernel] 	jndi:GestionDeStockBean/remote-com.et.GestionDeStock
    02:09:33,694 INFO  [JBossASKernel] 	Class:com.et.GestionDeStock
    02:09:33,694 INFO  [JBossASKernel] 	jndi:GestionDeStockBean/remote
    02:09:33,694 INFO  [JBossASKernel] Added bean(jboss.j2ee:jar=IntroEJB3.jar,name=GestionDeStockBean,service=EJB3) to KernelDeployment of: IntroEJB3.jar
    02:09:33,695 INFO  [JBossASKernel] installing bean: jboss.j2ee:jar=IntroEJB3.jar,name=PremierEJB3Bean,service=EJB3
    02:09:33,695 INFO  [JBossASKernel]   with dependencies:
    02:09:33,695 INFO  [JBossASKernel]   and demands:
    02:09:33,695 INFO  [JBossASKernel] 	jboss.ejb:service=EJBTimerService
    02:09:33,695 INFO  [JBossASKernel]   and supplies:
    02:09:33,695 INFO  [JBossASKernel] 	Class:com.et.PremierEJB3
    02:09:33,695 INFO  [JBossASKernel] 	jndi:PremierEJB3Bean/remote
    02:09:33,695 INFO  [JBossASKernel] 	jndi:PremierEJB3Bean/remote-com.et.PremierEJB3
    02:09:33,695 INFO  [JBossASKernel] Added bean(jboss.j2ee:jar=IntroEJB3.jar,name=PremierEJB3Bean,service=EJB3) to KernelDeployment of: IntroEJB3.jar
    02:09:33,702 INFO  [EJB3EndpointDeployer] Deploy AbstractBeanMetaData@1ef87b{name=jboss.j2ee:jar=IntroEJB3.jar,name=PremierEJB3Bean,service=EJB3_endpoint bean=org.jboss.ejb3.endpoint.deployers.impl.EndpointImpl properties=[container] constructor=null autowireCandidate=true}
    02:09:33,702 INFO  [EJB3EndpointDeployer] Deploy AbstractBeanMetaData@214b22{name=jboss.j2ee:jar=IntroEJB3.jar,name=GestionDeStockBean,service=EJB3_endpoint bean=org.jboss.ejb3.endpoint.deployers.impl.EndpointImpl properties=[container] constructor=null autowireCandidate=true}
    02:09:33,803 INFO  [SessionSpecContainer] Starting jboss.j2ee:jar=IntroEJB3.jar,name=PremierEJB3Bean,service=EJB3
    02:09:33,814 INFO  [EJBContainer] STARTED EJB: com.et.PremierEJB3Bean ejbName: PremierEJB3Bean
    02:09:33,858 INFO  [JndiSessionRegistrarBase] Binding the following Entries in Global JNDI:
     
    	PremierEJB3Bean/remote - EJB3.x Default Remote Business Interface
    	PremierEJB3Bean/remote-com.et.PremierEJB3 - EJB3.x Remote Business Interface
     
    02:09:33,905 INFO  [PersistenceUnitDeployment] Starting persistence unit persistence.unit:unitName=#BankService
    02:09:33,975 INFO  [Version] Hibernate Annotations 3.4.0.GA
    02:09:34,051 INFO  [Environment] Hibernate 3.3.1.GA
    02:09:34,060 INFO  [Environment] hibernate.properties not found
    02:09:34,066 INFO  [Environment] Bytecode provider name : javassist
    02:09:34,072 INFO  [Environment] using JDK 1.4 java.sql.Timestamp handling
    02:09:34,197 INFO  [Version] Hibernate Commons Annotations 3.1.0.GA
    02:09:34,202 INFO  [Version] Hibernate EntityManager 3.4.0.GA
    02:09:34,233 INFO  [Ejb3Configuration] Processing PersistenceUnitInfo [
    	name: BankService
    	...]
    02:09:34,252 WARN  [Ejb3Configuration] Persistence provider caller does not implement the EJB3 spec correctly. PersistenceUnitInfo.getNewTempClassLoader() is null.
    02:09:35,222 INFO  [AnnotationBinder] Binding entity from annotated class: com.et.Produit
    02:09:35,282 INFO  [EntityBinder] Bind entity com.et.Produit on table Produit
    02:09:35,355 INFO  [Version] Hibernate Validator 3.1.0.GA
    02:09:35,441 INFO  [HibernateSearchEventListenerRegister] Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled.
    02:09:35,531 INFO  [ConnectionProviderFactory] Initializing connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider
    02:09:35,536 INFO  [InjectedDataSourceConnectionProvider] Using provided datasource
    02:09:35,541 INFO  [SettingsFactory] RDBMS: HSQL Database Engine, version: 1.8.0
    02:09:35,541 INFO  [SettingsFactory] JDBC driver: HSQL Database Engine Driver, version: 1.8.0
    02:09:35,567 INFO  [Dialect] Using dialect: org.hibernate.dialect.HSQLDialect
    02:09:35,575 INFO  [TransactionFactoryFactory] Transaction strategy: org.hibernate.ejb.transaction.JoinableCMTTransactionFactory
    02:09:35,578 INFO  [TransactionManagerLookupFactory] instantiating TransactionManagerLookup: org.hibernate.transaction.JBossTransactionManagerLookup
    02:09:35,581 INFO  [TransactionManagerLookupFactory] instantiated TransactionManagerLookup
    02:09:35,581 INFO  [SettingsFactory] Automatic flush during beforeCompletion(): disabled
    02:09:35,581 INFO  [SettingsFactory] Automatic session close at end of transaction: disabled
    02:09:35,581 INFO  [SettingsFactory] JDBC batch size: 15
    02:09:35,581 INFO  [SettingsFactory] JDBC batch updates for versioned data: disabled
    02:09:35,583 INFO  [SettingsFactory] Scrollable result sets: enabled
    02:09:35,583 INFO  [SettingsFactory] JDBC3 getGeneratedKeys(): disabled
    02:09:35,583 INFO  [SettingsFactory] Connection release mode: auto
    02:09:35,584 INFO  [SettingsFactory] Default batch fetch size: 1
    02:09:35,584 INFO  [SettingsFactory] Generate SQL with comments: disabled
    02:09:35,584 INFO  [SettingsFactory] Order SQL updates by primary key: disabled
    02:09:35,584 INFO  [SettingsFactory] Order SQL inserts for batching: disabled
    02:09:35,584 INFO  [SettingsFactory] Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
    02:09:35,588 INFO  [ASTQueryTranslatorFactory] Using ASTQueryTranslatorFactory
    02:09:35,588 INFO  [SettingsFactory] Query language substitutions: {}
    02:09:35,588 INFO  [SettingsFactory] JPA-QL strict compliance: enabled
    02:09:35,588 INFO  [SettingsFactory] Second-level cache: enabled
    02:09:35,588 INFO  [SettingsFactory] Query cache: disabled
    02:09:35,596 INFO  [SettingsFactory] Cache region factory : org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge
    02:09:35,596 INFO  [RegionFactoryCacheProviderBridge] Cache provider: org.hibernate.cache.HashtableCacheProvider
    02:09:35,598 INFO  [SettingsFactory] Optimize cache for minimal puts: disabled
    02:09:35,598 INFO  [SettingsFactory] Cache region prefix: persistence.unit:unitName=#BankService
    02:09:35,598 INFO  [SettingsFactory] Structured second-level cache entries: disabled
    02:09:35,607 INFO  [SettingsFactory] Statistics: disabled
    02:09:35,607 INFO  [SettingsFactory] Deleted entity synthetic identifier rollback: disabled
    02:09:35,608 INFO  [SettingsFactory] Default entity-mode: pojo
    02:09:35,608 INFO  [SettingsFactory] Named query checking : enabled
    02:09:35,672 INFO  [SessionFactoryImpl] building session factory
    02:09:35,938 INFO  [SessionFactoryObjectFactory] Factory name: persistence.unit:unitName=#BankService
    02:09:35,940 INFO  [NamingHelper] JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
    02:09:35,945 INFO  [SessionFactoryObjectFactory] Bound factory to JNDI name: persistence.unit:unitName=#BankService
    02:09:35,945 WARN  [SessionFactoryObjectFactory] InitialContext did not implement EventContext
    02:09:35,958 INFO  [SchemaExport] Running hbm2ddl schema export
    02:09:35,960 INFO  [SchemaExport] exporting generated schema to database
    02:09:35,961 INFO  [SchemaExport] schema export complete
    02:09:35,965 INFO  [NamingHelper] JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
    02:09:36,010 INFO  [SessionSpecContainer] Starting jboss.j2ee:jar=IntroEJB3.jar,name=GestionDeStockBean,service=EJB3
    02:09:36,016 INFO  [EJBContainer] STARTED EJB: com.et.GestionDeStockBean ejbName: GestionDeStockBean
    02:09:36,029 INFO  [JndiSessionRegistrarBase] Binding the following Entries in Global JNDI:
     
    	GestionDeStockBean/remote - EJB3.x Default Remote Business Interface
    	GestionDeStockBean/remote-com.et.GestionDeStock - EJB3.x Remote Business Interface
     
    02:09:36,093 INFO  [JBossASKernel] Created KernelDeployment for: Photos-ejb.jar
    02:09:36,093 INFO  [JBossASKernel] installing bean: jboss.j2ee:jar=Photos-ejb.jar,name=FichiersPhotoBean,service=EJB3
    02:09:36,093 INFO  [JBossASKernel]   with dependencies:
    02:09:36,093 INFO  [JBossASKernel]   and demands:
    02:09:36,093 INFO  [JBossASKernel] 	jboss.ejb:service=EJBTimerService
    02:09:36,094 INFO  [JBossASKernel] 	persistence.unit:unitName=#Photos-ejbPU
    02:09:36,094 INFO  [JBossASKernel]   and supplies:
    02:09:36,094 INFO  [JBossASKernel] 	Class:photos.FichiersPhotoRemote
    02:09:36,094 INFO  [JBossASKernel] 	jndi:FichiersPhotoBean/remote-photos.FichiersPhotoRemote
    02:09:36,094 INFO  [JBossASKernel] 	jndi:FichiersPhotoBean/remote
    02:09:36,094 INFO  [JBossASKernel] Added bean(jboss.j2ee:jar=Photos-ejb.jar,name=FichiersPhotoBean,service=EJB3) to KernelDeployment of: Photos-ejb.jar
    02:09:36,097 INFO  [EJB3EndpointDeployer] Deploy AbstractBeanMetaData@e1f904{name=jboss.j2ee:jar=Photos-ejb.jar,name=FichiersPhotoBean,service=EJB3_endpoint bean=org.jboss.ejb3.endpoint.deployers.impl.EndpointImpl properties=[container] constructor=null autowireCandidate=true}
    02:09:36,239 INFO  [JBossASKernel] Created KernelDeployment for: profileservice-secured.jar
    02:09:36,239 INFO  [JBossASKernel] installing bean: jboss.j2ee:jar=profileservice-secured.jar,name=SecureProfileService,service=EJB3
    02:09:36,239 INFO  [JBossASKernel]   with dependencies:
    02:09:36,239 INFO  [JBossASKernel]   and demands:
    02:09:36,239 INFO  [JBossASKernel] 	jndi:SecureManagementView/remote-org.jboss.deployers.spi.management.ManagementView
    02:09:36,239 INFO  [JBossASKernel] 	jboss.ejb:service=EJBTimerService
    02:09:36,239 INFO  [JBossASKernel]   and supplies:
    02:09:36,239 INFO  [JBossASKernel] 	Class:org.jboss.profileservice.spi.ProfileService
    02:09:36,239 INFO  [JBossASKernel] 	jndi:SecureProfileService/remote
    02:09:36,239 INFO  [JBossASKernel] 	jndi:SecureProfileService/remote-org.jboss.profileservice.spi.ProfileService
    02:09:36,239 INFO  [JBossASKernel] Added bean(jboss.j2ee:jar=profileservice-secured.jar,name=SecureProfileService,service=EJB3) to KernelDeployment of: profileservice-secured.jar
    02:09:36,241 INFO  [JBossASKernel] installing bean: jboss.j2ee:jar=profileservice-secured.jar,name=SecureDeploymentManager,service=EJB3
    02:09:36,241 INFO  [JBossASKernel]   with dependencies:
    02:09:36,241 INFO  [JBossASKernel]   and demands:
    02:09:36,241 INFO  [JBossASKernel] 	jboss.ejb:service=EJBTimerService
    02:09:36,241 INFO  [JBossASKernel]   and supplies:
    02:09:36,241 INFO  [JBossASKernel] 	jndi:SecureDeploymentManager/remote-org.jboss.deployers.spi.management.deploy.DeploymentManager
    02:09:36,241 INFO  [JBossASKernel] 	Class:org.jboss.deployers.spi.management.deploy.DeploymentManager
    02:09:36,241 INFO  [JBossASKernel] 	jndi:SecureDeploymentManager/remote
    02:09:36,241 INFO  [JBossASKernel] Added bean(jboss.j2ee:jar=profileservice-secured.jar,name=SecureDeploymentManager,service=EJB3) to KernelDeployment of: profileservice-secured.jar
    02:09:36,242 INFO  [JBossASKernel] installing bean: jboss.j2ee:jar=profileservice-secured.jar,name=SecureManagementView,service=EJB3
    02:09:36,242 INFO  [JBossASKernel]   with dependencies:
    02:09:36,243 INFO  [JBossASKernel]   and demands:
    02:09:36,243 INFO  [JBossASKernel] 	jboss.ejb:service=EJBTimerService
    02:09:36,243 INFO  [JBossASKernel]   and supplies:
    02:09:36,243 INFO  [JBossASKernel] 	jndi:SecureManagementView/remote-org.jboss.deployers.spi.management.ManagementView
    02:09:36,243 INFO  [JBossASKernel] 	Class:org.jboss.deployers.spi.management.ManagementView
    02:09:36,243 INFO  [JBossASKernel] 	jndi:SecureManagementView/remote
    02:09:36,243 INFO  [JBossASKernel] Added bean(jboss.j2ee:jar=profileservice-secured.jar,name=SecureManagementView,service=EJB3) to KernelDeployment of: profileservice-secured.jar
    02:09:36,244 INFO  [EJB3EndpointDeployer] Deploy AbstractBeanMetaData@c95759{name=jboss.j2ee:jar=profileservice-secured.jar,name=SecureProfileService,service=EJB3_endpoint bean=org.jboss.ejb3.endpoint.deployers.impl.EndpointImpl properties=[container] constructor=null autowireCandidate=true}
    02:09:36,244 INFO  [EJB3EndpointDeployer] Deploy AbstractBeanMetaData@10b08ea{name=jboss.j2ee:jar=profileservice-secured.jar,name=SecureDeploymentManager,service=EJB3_endpoint bean=org.jboss.ejb3.endpoint.deployers.impl.EndpointImpl properties=[container] constructor=null autowireCandidate=true}
    02:09:36,244 INFO  [EJB3EndpointDeployer] Deploy AbstractBeanMetaData@184db9e{name=jboss.j2ee:jar=profileservice-secured.jar,name=SecureManagementView,service=EJB3_endpoint bean=org.jboss.ejb3.endpoint.deployers.impl.EndpointImpl properties=[container] constructor=null autowireCandidate=true}
    02:09:36,305 INFO  [SessionSpecContainer] Starting jboss.j2ee:jar=profileservice-secured.jar,name=SecureDeploymentManager,service=EJB3
    02:09:36,307 INFO  [EJBContainer] STARTED EJB: org.jboss.profileservice.ejb.SecureDeploymentManager ejbName: SecureDeploymentManager
    02:09:36,323 INFO  [JndiSessionRegistrarBase] Binding the following Entries in Global JNDI:
     
    	SecureDeploymentManager/remote - EJB3.x Default Remote Business Interface
    	SecureDeploymentManager/remote-org.jboss.deployers.spi.management.deploy.DeploymentManager - EJB3.x Remote Business Interface
     
    02:09:36,410 INFO  [SessionSpecContainer] Starting jboss.j2ee:jar=profileservice-secured.jar,name=SecureManagementView,service=EJB3
    02:09:36,411 INFO  [EJBContainer] STARTED EJB: org.jboss.profileservice.ejb.SecureManagementView ejbName: SecureManagementView
    02:09:36,426 INFO  [JndiSessionRegistrarBase] Binding the following Entries in Global JNDI:
     
    	SecureManagementView/remote - EJB3.x Default Remote Business Interface
    	SecureManagementView/remote-org.jboss.deployers.spi.management.ManagementView - EJB3.x Remote Business Interface
     
    02:09:36,482 INFO  [SessionSpecContainer] Starting jboss.j2ee:jar=profileservice-secured.jar,name=SecureProfileService,service=EJB3
    02:09:36,484 INFO  [EJBContainer] STARTED EJB: org.jboss.profileservice.ejb.SecureProfileServiceBean ejbName: SecureProfileService
    02:09:36,496 INFO  [JndiSessionRegistrarBase] Binding the following Entries in Global JNDI:
     
    	SecureProfileService/remote - EJB3.x Default Remote Business Interface
    	SecureProfileService/remote-org.jboss.profileservice.spi.ProfileService - EJB3.x Remote Business Interface
     
    02:09:36,860 INFO  [TomcatDeployment] deploy, ctxPath=/admin-console
    02:09:37,016 INFO  [config] Initializing Mojarra (1.2_12-b01-FCS) for context '/admin-console'
    02:09:39,774 INFO  [TomcatDeployment] deploy, ctxPath=/
    02:09:39,834 INFO  [TomcatDeployment] deploy, ctxPath=/jmx-console
    02:09:39,908 ERROR [ProfileServiceBootstrap] Failed to load profile: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):
     
    DEPLOYMENTS MISSING DEPENDENCIES:
      Deployment "jboss.j2ee:jar=Photos-ejb.jar,name=FichiersPhotoBean,service=EJB3" is missing the following dependencies:
        Dependency "<UNKNOWN jboss.j2ee:jar=Photos-ejb.jar,name=FichiersPhotoBean,service=EJB3>" (should be in state "Described", but is actually in state "** UNRESOLVED Demands 'persistence.unit:unitName=#Photos-ejbPU' **")
      Deployment "jboss.j2ee:jar=Photos-ejb.jar,name=FichiersPhotoBean,service=EJB3_endpoint" is missing the following dependencies:
        Dependency "jboss.j2ee:jar=Photos-ejb.jar,name=FichiersPhotoBean,service=EJB3" (should be in state "Configured", but is actually in state "PreInstall")
      Deployment "persistence.unit:unitName=#Photos-ejbPU" is missing the following dependencies:
        Dependency "jboss.jca:name=photos,service=DataSourceBinding" (should be in state "Create", but is actually in state "** NOT FOUND Depends on 'jboss.jca:name=photos,service=DataSourceBinding' **")
     
    DEPLOYMENTS IN ERROR:
      Deployment "<UNKNOWN jboss.j2ee:jar=Photos-ejb.jar,name=FichiersPhotoBean,service=EJB3>" is in error due to the following reason(s): ** UNRESOLVED Demands 'persistence.unit:unitName=#Photos-ejbPU' **
      Deployment "jboss.jca:name=photos,service=DataSourceBinding" is in error due to the following reason(s): ** NOT FOUND Depends on 'jboss.jca:name=photos,service=DataSourceBinding' **
     
    02:09:39,919 INFO  [Http11Protocol] Dï?½marrage de Coyote HTTP/1.1 sur http-127.0.0.1-8080
    02:09:39,962 INFO  [AjpProtocol] Starting Coyote AJP/1.3 on ajp-127.0.0.1-8009
    02:09:39,969 INFO  [ServerImpl] JBoss (Microcontainer) [5.1.0.GA (build: SVNTag=JBoss_5_1_0_GA date=200905221634)] Started in 39s:545ms
    Cotés serveur:
    La classe FichiersPhotosRemote
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    package photos;
     
     import java.io.*;
     import javax.ejb.Remote;
     
      @Remote
      public interface FichiersPhotoRemote {
          String[] liste();
          byte[] getPhoto(String nom) throws IOException;
         void setPhoto(byte[] octets, String genre, String identification) throws IOException;
         void supprimer(String nom);
     }
    la classe FichiersPhotosBean:
    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
    package photos;
     
     import java.awt.image.BufferedImage;
    import java.io.ByteArrayInputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
     
    import javax.ejb.Stateless;
    import javax.imageio.ImageIO;
    import javax.persistence.EntityManager;
    import javax.persistence.PersistenceContext;
     
     @Stateless
     public class FichiersPhotoBean implements FichiersPhotoRemote {  
        @PersistenceContext(unitName = "Photos-ejbPU")
        EntityManager persistance;
        private final String répertoire = "E:/Photos/";
     
        public String[] liste() {
           return new File(répertoire).list();
        }
     
        public byte[]  getPhoto(String nom) throws IOException {
            File fichier = new File(répertoire+nom);
            byte[] octets = new byte[(int)fichier.length()];
            FileInputStream photo = new FileInputStream(fichier);
            photo.read(octets);
            photo.close();
            return octets;
         }
     
        public void setPhoto(byte[] octets, String genre, String identification) throws IOException {       
            Photo photo = new Photo();
            photo.setId(System.currentTimeMillis());
            File fichier = new File(répertoire+photo.getNomFichier());
            FileOutputStream stockage = new FileOutputStream(fichier);
            stockage.write(octets);
            stockage.close();  
            photo.setGenre(genre);
            photo.setIdentification(identification);
            ByteArrayInputStream fluxImage = new ByteArrayInputStream(octets);
            BufferedImage image = ImageIO.read(fluxImage);
            photo.setLargeur(image.getWidth());
            photo.setHauteur(image.getHeight());
            photo.setPoids(octets.length);
            persistance.persist(photo); 
         }
     
        public void supprimer(String nom) {
            File fichier = new File(répertoire+nom);
            fichier.delete();
         }
     }
    BeanEntity :
    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
    package photos;
     
     import java.io.Serializable;
     import java.text.DateFormat;
     import java.util.Date;
     import javax.persistence.*;
     
     @Entity
     public class Photo implements Serializable {
        private long id;
        private Date instantStockage;
        private String genre;
        private String identification;
        private int largeur;
        private int hauteur;
        private long poids;    
     
        @Id
        public long getId() { return id; }
        public void setId(long id) { 
            this.id = id;
            setInstantStockage(new Date(id));
         }
     
        @Temporal(TemporalType.TIMESTAMP)
        public Date getInstantStockage() { return instantStockage; }
        public void setInstantStockage(Date instantStockage) { this.instantStockage = instantStockage; }
     
        @Column(length=15, nullable=false)
        public String getGenre() { return genre; }
        public void setGenre(String genre) { this.genre = genre; }
     
        @Column(nullable=false)
        public String getIdentification() { return identification; }
        public void setIdentification(String identification) { this.identification = identification; }
     
        public int getLargeur() { return largeur; }
        public void setLargeur(int largeur) { this.largeur = largeur; }
     
        public int getHauteur() { return hauteur; }
        public void setHauteur(int hauteur) { this.hauteur = hauteur; }
     
        public long getPoids() { return poids; }
        public void setPoids(long poids) { this.poids = poids;  }    
     
        @Transient
        public String getDateFormat() {
           return DateFormat.getDateInstance(DateFormat.FULL).format(instantStockage);
        }
     
        @Transient
        public String getNomFichier() {
           return id+".jpg";
        }
     }
    et le fichier persistence.xml (qui se trouve dans META-INF)
    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"?>
    <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" 
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
       xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
     
      <persistence-unit name="Photos-ejbPU" transaction-type="JTA">
     
          <provider>org.hibernate.ejb.HibernatePersistence</provider>
           <jta-data-source>photos</jta-data-source>
          <properties>
     
             <property name="hibernate.hdm2ddl.auto" value="update" />
     
             <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
          </properties>
       </persistence-unit>
    </persistence>
    et maintenant cotés client :
    la classe stockage
    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
    package photos;
     
     import javax.swing.*;
     import java.awt.*;
     import java.awt.event.*;
     import java.awt.image.BufferedImage;
     import java.io.*;
     import javax.imageio.*;
     import javax.naming.*;
     import photos.FichiersPhotoRemote;;
     
     public class Stockage extends JFrame implements ActionListener {
        private String répertoire = "E:/Stockage/";
     
        private String[] liste;
        private Panneau panneau = new Panneau();
        private JComboBox choix;
        private JButton enregistrer = new JButton("Stocker la photo");
        private JPanel sud = new JPanel();
        private JTextField genre = new JTextField("Genre", 15);
        private JTextField identification = new JTextField("Identification", 15);
        private static FichiersPhotoRemote fichiers;
     
        public Stockage() {
            liste = new File(répertoire).list();
            System.out.println(liste);
            choix = new JComboBox(liste);
            panneau.change(récupérer());
            choix.addActionListener(this);
            enregistrer.addActionListener(this);
            sud.add(genre);
            sud.add(identification);
            sud.add(enregistrer);
            setSize(500, 400);
            setTitle("Stockage de photos");
            add(choix, BorderLayout.NORTH);
            add(sud, BorderLayout.SOUTH);
            add(panneau);
            setDefaultCloseOperation(EXIT_ON_CLOSE);
            setVisible(true);
        }
     
        private BufferedImage récupérer() {
           try {
              BufferedImage photo = ImageIO.read(new File(répertoire+choix.getSelectedItem()));
              return photo;
           }
           catch (Exception ex) {
              setTitle("Problème de localisation des photos");
              return null;
          }      
        }
     
        public static void main(String[] args) throws Exception {
            Context ctx = new InitialContext();
       //     fichiers = (FichiersPhotoRemote) ctx.lookup(photos.FichiersPhotoRemote.class.getName());
            fichiers = (FichiersPhotoRemote) ctx.lookup("FichiersPhotoBean/remote");
            new Stockage();
        }
     
        public void actionPerformed(ActionEvent e) {
           if (e.getSource()==choix) {
              panneau.change(récupérer());
           }
           else if (e.getSource()==enregistrer) {       
              try {
                  File fichier = new File(répertoire+choix.getSelectedItem());
                  byte[] octets = new byte[(int)fichier.length()];
                  FileInputStream photo = new FileInputStream(fichier);
                  photo.read(octets);
                  fichiers.setPhoto(octets, genre.getText(), identification.getText());
               }
               catch (IOException ex) {
                  setTitle("Problème avec le serveur");
               }
          }
        }
     }
     
     class Panneau extends JComponent {
        private BufferedImage image;
        private double ratio;
     
        public void change(BufferedImage image) {
          if (image!=null) {
             this.image = image;
             ratio = (double)image.getWidth()/image.getHeight();  
             repaint();
          }
        }
     
        protected void paintComponent(Graphics surface) {
           if (image!=null)
             surface.drawImage(image, 0, 0, this.getWidth(), (int)(this.getWidth()/ratio), null);   
        }   
     }
    de plus le fichier "Photos-ejbPU-ds.xml" dans HOME_JBOOS\server\default\deploy
    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
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <datasources>
        <local-tx-datasource>
            <jndi-name>Photos-ejbPU</jndi-name>
            <rar-name>jboss-local-jdbc.rar</rar-name>
            <use-java-context>true</use-java-context>
            <connection-definition>javax.sql.DataSource</connection-definition>
            <jmx-invoker-name>jboss:service=invoker,type=jrmp</jmx-invoker-name>
            <min-pool-size>0</min-pool-size>
            <max-pool-size>10</max-pool-size>
            <blocking-timeout-millis>30000</blocking-timeout-millis>
            <idle-timeout-minutes>30</idle-timeout-minutes>
            <prefill>false</prefill>
            <background-validation>false</background-validation>
            <background-validation-millis>0</background-validation-millis>
            <validate-on-match>true</validate-on-match>
            <statistics-formatter>org.jboss.resource.statistic.pool.JBossDefaultSubPoolStatisticFormatter</statistics-formatter>
            <isSameRM-override-value>false</isSameRM-override-value>
            <allocation-retry>0</allocation-retry>
            <allocation-retry-wait-millis>5000</allocation-retry-wait-millis>
            <security-domain-and-application xsi:type="securityMetaData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
            <metadata/>
            <local-transaction/>
            <user-name>postgres</user-name>
            <password>esi2010</password>
            <prepared-statement-cache-size>0</prepared-statement-cache-size>
            <share-prepared-statements>false</share-prepared-statements>
            <set-tx-query-timeout>false</set-tx-query-timeout>
            <query-timeout>0</query-timeout>
            <use-try-lock>0</use-try-lock>
            <driver-class>org.postgresql.Driver</driver-class>
            <connection-url>jdbc:postgresql://localhost:5432/photos</connection-url>
        </local-tx-datasource>
    </datasources>
    merci pour votre aide

  2. #2
    Membre averti
    Étudiant
    Inscrit en
    Janvier 2011
    Messages
    35
    Détails du profil
    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Janvier 2011
    Messages : 35
    Par défaut
    J'ai résolu mon problème :
    j'ai fait des changement dans mon fichier persistence.xml comme suivant :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
        
      <persistence-unit name="NOM" transaction-type="JTA">
      
          <provider>org.hibernate.ejb.HibernatePersistence</provider>
           <jta-data-source>java:/JndiName</jta-data-source>
    NOM est utilisé dans la classe Bean
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    @Stateless
     public class FichiersPhotoBean implements FichiersPhotoRemote  {  
       @PersistenceContext(unitName = "NOM")
        EntityManager persistance;
    JndiName est le nom de Jndi dans JBOSS (ou le nom du fichier JndiNom-ds.xml)
    Bonne chance à tous

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. une erreur dans l'exécution d'un programme
    Par viou25 dans le forum Langage
    Réponses: 4
    Dernier message: 15/11/2008, 22h52
  2. Erreur dans l'exécution d'une requête
    Par ouinih dans le forum SQL
    Réponses: 3
    Dernier message: 11/06/2008, 23h32
  3. cron erreur dans l'exécution d'un script
    Par Carhod dans le forum Unix
    Réponses: 1
    Dernier message: 31/01/2008, 13h23
  4. [OK] Erreur dans l'exécution d'un code de macro.
    Par Funcky222 dans le forum Macros et VBA Excel
    Réponses: 7
    Dernier message: 26/09/2007, 21h35
  5. erreur dans l'exécution de Dlookup
    Par jessy212 dans le forum Access
    Réponses: 3
    Dernier message: 30/08/2006, 13h58

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