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

Portails Java Discussion :

Déployer une application EJB 3 + JSF sur Liferay [Liferay]


Sujet :

Portails Java

  1. #1
    Membre régulier
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Janvier 2011
    Messages
    80
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Indre et Loire (Centre)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels

    Informations forums :
    Inscription : Janvier 2011
    Messages : 80
    Points : 88
    Points
    88
    Par défaut Déployer une application EJB 3 + JSF sur Liferay
    Bonjour,

    j'ai terminer de développer une application web :
    EJB 3.0
    Jsf 1.2
    richface
    jboss 4,2

    le problème c'est que je veut la déployer sur un portail Liferay

    Est ce que quelqu'un peut me donner une solution ? et quelle version de liferay utilisé c'est très urgent ?

    Merci

  2. #2
    Membre averti Avatar de mLk92
    Profil pro
    Inscrit en
    Mars 2006
    Messages
    527
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2006
    Messages : 527
    Points : 305
    Points
    305
    Par défaut
    C'est une mauvaise utilisation de Liferay... Une application dans une application ? Je pense personnellement que ce que tu as fait dans ton application, tu aurais pu le faire avec liferay lui même, même des services, webservices, etc...

    Si c'est déjà une application, Faut-il réellement utiliser Liferay ?

    M'enfin, pour répondre à ta question:

    Tout va dépendre de l'architecture de ton application, le mieux serait de séparer la partie service de la partie web (ex: service -> jar et web-> war).

    Dans tous les cas il faut inclure une configuration de portlet et qu'elle soit adaptée à Liferay.

    Tu dois te créer et configurer le fichier portal-ext.properties pour faire fonctionner avec jboss et ta base de données.

    Au niveau de la version, ça dépendra de ton application, perso j'ai eu un projet avec ce type de conception, c'était la version de l'époque (5.1). Je peux te dire que c'était pas très propre, voir même bancale

    En gros il y avait un projet liferay contenant le thème liferay etc, un projet web (richfaces, portlet, etc) et un projet de service.
    " Can't take your slogans no more, no more sweet talk from the hypocrits " by Robert Nesta Marley

  3. #3
    Membre régulier
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Janvier 2011
    Messages
    80
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Indre et Loire (Centre)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels

    Informations forums :
    Inscription : Janvier 2011
    Messages : 80
    Points : 88
    Points
    88
    Par défaut
    mon projet ce compose en 3 partie :
    le jar
    le war
    et le ear (pour les rassemblé)
    exemple voici le code de ClientController (mon managed bean ) :
    on trouve q'il se sert du ear pour fonctionner linge 71 Object ref = jndiContext.lookup("sam/ClientBean/remote");
    donc il faut intégrer les ear dans liferay ? comment ? une solution !
    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
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    package com.consoft.jsf;
     
    import com.consoft.entity.Client;
    import com.consoft.entity.Reference;
    import com.consoft.jsf.Controller;
    import com.consoft.stateless.client.ClientBeanRemote;
     
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    //import javax.sql.rowset.serial.SerialBlob;
     
    import java.util.ArrayList;
    import java.util.HashMap;
    import java.util.List;
    import java.util.Map;
    //import java.awt.Graphics2D;
    //import java.awt.Image;
    //import java.io.File;
    import java.io.IOException;
    //import java.io.InputStream;
    //import java.io.OutputStream;
    import java.io.Serializable;
     
    import javax.faces.application.FacesMessage;
    import javax.faces.context.FacesContext;
    import javax.faces.event.ValueChangeEvent;
    import javax.faces.model.SelectItem;
    //import javax.imageio.ImageIO;
    //import java.awt.image.BufferedImage;
     
    import org.ajax4jsf.io.parser.BufferedStringState;
    import org.apache.myfaces.custom.fileupload.UploadedFile;
    import org.jboss.logging.Logger;
     
    public class ClientController extends Controller implements Serializable {
     
    	/**
             * 
             */
     
    	Logger l = Logger.getLogger(ClientController.class);
    	private static final long serialVersionUID = 1L;
    	// Init
    	// ----------------------------------------------------------------------
    	// -----------------
    	private UploadedFile uploadedFile;
    	private String fileName;
     
    	// Actions
    	// ------------------------------------------------------------------
    	// ------------------
     
    	// ======================================
    	// = Attributs =
    	// ======================================
     
    	private Client client = new Client();
    	private String keyword;
    	private List<Client> clients;
    	private Map<Integer, Boolean> selectedIds = new HashMap<Integer, Boolean>();
    	private Boolean logocheck;
    	private Boolean inputLogo;
    	private List<Client> selectedClients;
    	private List<SelectItem> result = new ArrayList<SelectItem>();
     
    	ClientBeanRemote TB() throws NamingException {
    		// Context jndiContext = getInitialContext();
    		Context jndiContext;
    		jndiContext = new InitialContext();
    		Object ref = jndiContext.lookup("sam/ClientBean/remote");
    		ClientBeanRemote clientBean = (ClientBeanRemote) ref;
    		return clientBean;
    	}
     
    	// ======================================
    	// = Constantes =
    	// ======================================
     
    	// ======================================
    	// = Constructeurs =
    	// ======================================
     
    	// ======================================
    	// = Methodes publiques =
    	// ======================================
    	public String doCreateClient() {
    		// final String mname = "doCreateClient";
    		// logger.entering(cname, mname);
     
    		String navigateTo = null;
     
    		try {
     
    			// If the client Exist (have the same name)
    			List<Client> Exist = null;
    			Exist = TB().searchClients(client.getNom());
    			if (!(Exist.size() > 0 && Exist != null)) {
    				if (uploadedFile.getContentType().contains("image")) {
     
    					// Create the Client
    					client.setLogo(uploadedFile.getBytes());
    					client.setNombreref(0);
    					client.setLogotype(uploadedFile.getContentType());
    					// View the cntent type of uploaded file
    					System.out.println(uploadedFile.getContentType());
    					client = TB().createClient(client);
    					navigateTo = doFindClients();
    					// Supprimer l'instance de client
     
    					// Show succes message.
    					FacesContext.getCurrentInstance().addMessage(
    							"uploadForm",
    							new FacesMessage(FacesMessage.SEVERITY_INFO,
    									"Client ajouté avec succés!", null));
    				} else {
    					FacesContext.getCurrentInstance().addMessage(
    							"uploadForm",
    							new FacesMessage(FacesMessage.SEVERITY_ERROR,
    									"Le logo choisit n'est pas une image!",
    									null));
    				}
    			} else {
    				// Show succes message.
    				FacesContext.getCurrentInstance().addMessage(
    						"uploadForm",
    						new FacesMessage(FacesMessage.SEVERITY_ERROR,
    								"Le client existe déja!", null));
    			}
    		} catch (IOException e) {
     
    			// Show error message.
    			FacesContext.getCurrentInstance().addMessage(
    					"uploadForm",
    					new FacesMessage(FacesMessage.SEVERITY_ERROR,
    							"File upload failed with I/O error.", null));
     
    			// Always log stacktraces.
    			e.printStackTrace();
    		} catch (Exception e) {
    			System.out.println(e);// addMessage(cname, mname, e);
    		}
     
    		// logger.exiting(cname, mname, navigateTo);
     
    		return navigateTo;
    	}
     
    	// Ldap
    	public String doAuthentificate() {
     
    		String navigateTo = null;
    		// client instance clear attribut
    		Clear();
     
    		try {
    			if (TB().Authentificate())
    				navigateTo = "clients.displayed";
    			else
    				navigateTo = "technologies.displayed";
     
    		} catch (Exception e) {
    			logger.warning(e.getMessage());
    			e.printStackTrace();
    			// addMessage(cname, mname, e);
    		}
     
    		// logger.exiting(cname, mname, navigateTo);
    		return navigateTo;
    	}
     
    	// ldap
     
    	public String doFindClients() {
    		// final String mname = "doFindClients";
    		// logger.entering(cname, mname);
     
    		String navigateTo = null;
    		// client instance clear attribut
    		Clear();
     
    		try {
     
    			//
     
    			// category = catalogBean.findCategory(getParamId("categoryId"));
    			// Rechercher tous les clients
    			clients = TB().findClients();
    			navigateTo = "clients.displayed";
    		} catch (Exception e) {
    			logger.warning(e.getMessage());
    			e.printStackTrace();
    			// addMessage(cname, mname, e);
    		}
     
    		// logger.exiting(cname, mname, navigateTo);
    		return navigateTo;
    	}
     
    	/*
    	 * doShowClient() used when we try to update they lookup for the client
    	 */
    	public String doShowClient() {
     
    		String navigateTo = null;
    		try {
    			// ligne provisoire
    			clients = TB().findClients();
    			client = TB().findClient(getParamId("clientId"));
     
    			// description = technologie.getDescription();
    			navigateTo = "client.showed";
    		} catch (Exception e) {
    			// addMessage(cname, mname, e);
    		}
    		/*
    		 * System.out.println(client.getNom());
    		 * System.out.println(client.getSiteweb());
    		 * System.out.println(client.getLogotype());
    		 * System.out.println(getParamId("clientId"));
    		 */
    		return navigateTo;
    	}
     
    	public Client doFindClient(int clientId) {
     
    		Client client = null;
    		try {
     
    			client = TB().findClient(clientId);
     
    		} catch (Exception e) {
    			// addMessage(cname, mname, e);
    			System.out.println("Error While looking for Client" + e);
    			e.printStackTrace();
    		}
    		/*
    		 * System.out.println(client.getNom());
    		 * System.out.println(client.getSiteweb());
    		 * System.out.println(client.getLogotype());
    		 * System.out.println(getParamId("clientId"));
    		 */
    		return client;
    	}
     
    	public String doUpdateClient() {
    		// final String mname = "doUpdateClient";
    		// logger.entering(cname, mname);
     
    		String navigateTo = null;
    		try {
    			List<Client> Exist = null;
    			Exist = TB().searchClients(client.getNom());
    			boolean occurence = false;
    			for (Client c : Exist) {
    				boolean equals = c.getNom().equalsIgnoreCase(client.getNom());
     
    				if (c.getNoclient() != client.getNoclient() && equals)
     
    					occurence = true;
    			}
     
    			if (occurence == false) {
    				// Update the Client
    				System.out.println("aloooorrr" + logocheck.toString());
    				if (logocheck) {
    					if (uploadedFile.getContentType().contains("image")) {
    						client.setLogo(uploadedFile.getBytes());
    						client.setLogotype(uploadedFile.getContentType());
     
    						client = TB().updateClient(client);
    						// Show succes message.
    						FacesContext.getCurrentInstance().addMessage(
    								"uploadForm",
    								new FacesMessage(FacesMessage.SEVERITY_INFO,
    										"Client modifié avec succés!", null));
     
    						client.setNoclient(0);
    						navigateTo = doFindClients();
    					} else {
    						FacesContext.getCurrentInstance().addMessage(
    								"uploadForm",
    								new FacesMessage(FacesMessage.SEVERITY_ERROR,
    										"Le logo choisit n'est pas une image!",
    										null));
     
    					}
    				} else {
    					client = TB().updateClient(client);
    					// Show succes message.
    					FacesContext.getCurrentInstance().addMessage(
    							"uploadForm",
    							new FacesMessage(FacesMessage.SEVERITY_INFO,
    									"Client modifié avec succés!", null));
     
    					client.setNoclient(0);
    					navigateTo = doFindClients();
    				}
     
    				// to refresh the list of clients
     
    				// navigateTo = "client.updated";
    			} else {
    				FacesContext.getCurrentInstance().addMessage(
    						"uploadForm",
    						new FacesMessage(FacesMessage.SEVERITY_ERROR,
    								"Le client existe déja !", null));
    			}
    		} catch (Exception e) {
    			// addMessage(cname, mname, e);
    			e.printStackTrace();
    			FacesContext.getCurrentInstance().addMessage(
    					"uploadForm",
    					new FacesMessage(FacesMessage.SEVERITY_ERROR,
    							"File upload failed with I/O error.", null));
    		}
     
    		// logger.exiting(cname, mname, navigateTo);
     
    		return navigateTo;
    	}
     
    	public String doSearch() {
    		// final String mname = "doSearch";
    		// logger.entering(cname, mname);
     
    		String navigateTo = null;
     
    		try {
    			clients = TB().searchClients(keyword);
    			navigateTo = "clients.found";
    		} catch (Exception e) {
    			// addMessage(cname, mname, e);
    		}
     
    		// logger.exiting(cname, mname, navigateTo);
    		return navigateTo;
    	}
     
    	public String DeleteSelectedClients() {
    		String navigateTo = null;
    		List<Reference> listr = null;
     
    		ReferenceController rc = new ReferenceController();
    		boolean msg = false;
    		StringBuffer erreur = new StringBuffer();
    		try {
    			for (Client clt : clients) {
     
    				if (selectedIds.containsKey(clt.getNoclient())) {
    					if (selectedIds.get(clt.getNoclient()).booleanValue() == true) {
     
    						// Verify whether the client is attached to a reference
    						listr = rc.TB().searchClientReferences(
    								clt.getNoclient());
     
    						if (listr.size() > 0) {
    							// remove from selected Ids
    							selectedIds.remove(clt.getNoclient());
     
    							erreur.append(clt.getNom() + " | ");
    							msg = true;
    						} else {
    							// Delete the client
    							TB().deleteClient(clt);
    							navigateTo = "client.deleted";
    						}
     
    					}
    				}
    			}
    			// Message d'erreur
    			if (msg)
    				FacesContext
    						.getCurrentInstance()
    						.addMessage(
    								"clientForm",
    								new FacesMessage(
    										FacesMessage.SEVERITY_ERROR,
    										"Impossible de supprimer un client appartenant à une référence! ",
    										null));
    		} catch (Exception e) {
    			// addMessage(cname, mname, e);
    		}
     
    		navigateTo = doFindClients();
    		return navigateTo; // Navigation case.
     
    	}
     
    	public List<SelectItem> doFillClients() {
    		try {
     
    			clients = TB().findClients();
    			for (Client client : clients) {
     
    				// SelectItem item = new
    				// SelectItem(client.getNoclient(),client.getNom());
    				// En passe le client et son nom
    				SelectItem item = new SelectItem(client.getNoclient(),
    						client.getNom());
    				result.add(item);
    			}
    		} catch (Exception e) {
    			// addMessage(cname, mname, e);
    		}
    		return result;
    	}
     
    	public void changeInputLogo(ValueChangeEvent value) {
    		setInputLogo(!(Boolean) value.getNewValue());
    		FacesContext.getCurrentInstance().renderResponse();
     
    	}
     
    	// Clear pour vider les champs d'un client
     
    	public void Clear() {
    		this.keyword = null;
    		getClient().setNoclient(0);
    		getClient().setLogotype(null);
    		getClient().setNom(null);
    		getClient().setLogo(null);
    		getClient().setSiteweb(null);
    		setLogocheck(false);
    		setInputLogo(true);
    	}
     
    	// //////////////////////////////////////////////
     
    	// }
     
    	// ======================================
    	// = Methodes Protégées =
    	// ======================================
     
    	// ======================================
    	// = Accesseurs =
    	// ======================================
    	public void addSelectedClient(Client clt) {
    		selectedClients.add(clt);
    	}
     
    	public Map<Integer, Boolean> getSelectedIds() {
    		return selectedIds;
    	}
     
    	public void setSelectedIds(Map<Integer, Boolean> selectedIds) {
    		this.selectedIds = selectedIds;
    	}
     
    	public Client getClient() {
    		return client;
    	}
     
    	public void setClient(Client client) {
    		this.client = client;
    	}
     
    	public String getKeyword() {
    		return keyword;
    	}
     
    	public void setKeyword(String keyword) {
    		this.keyword = keyword;
    	}
     
    	public UploadedFile getUploadedFile() {
    		return uploadedFile;
    	}
     
    	public String getFileName() {
    		return fileName;
    	}
     
    	public void setUploadedFile(UploadedFile uploadedFile) {
    		this.uploadedFile = uploadedFile;
    	}
     
    	// ======================================
    	// = Methodes Privées =
    	// ======================================
     
    	public List<Client> getClients() {
    		return clients;
    	}
     
    	public Boolean getLogocheck() {
    		return logocheck;
    	}
     
    	public void setLogocheck(Boolean logocheck) {
    		this.logocheck = logocheck;
    	}
     
    	public void setClients(List<Client> clients) {
    		this.clients = clients;
    	}
     
    	public Boolean getInputLogo() {
    		return inputLogo;
    	}
     
    	public void setInputLogo(Boolean inputLogo) {
    		this.inputLogo = inputLogo;
    	}
     
    	// ======================================
    	// = Methodes hash, equals, toString =
    	// ======================================
    	public static Context getInitialContext()
    			throws javax.naming.NamingException {
    		return new javax.naming.InitialContext();
    	}
    }

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

Discussions similaires

  1. Déployer une application JSP avec GlassFish sur un serveur FTP
    Par farid69 dans le forum Glassfish et Payara
    Réponses: 0
    Dernier message: 12/02/2013, 21h05
  2. Réponses: 4
    Dernier message: 02/03/2012, 12h45
  3. Réponses: 1
    Dernier message: 14/05/2008, 15h31
  4. Déployer une application sur un réseau.
    Par maniaco_jazz dans le forum Windows Forms
    Réponses: 2
    Dernier message: 11/04/2008, 10h33
  5. [Intraweb] Déployer une application intraweb sur IIS ?
    Par maxgar dans le forum Web & réseau
    Réponses: 9
    Dernier message: 21/07/2004, 14h21

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