Social networks
You can find me on:
   
Open sharing content

These articles are available under Creative Commons license BY-SA-3.0

Posts Tagged ‘deploy’

This is a very simple solution, that unfortunately took me a couple of hours because I couldn´t find it anywhere…

Place your server properties in the maven settings.xml file (found in the .m2 folder) like this:

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

	<profiles>
		<profile>
			<id>wildfly-remote</id>
			<properties>
				<wildfly-hostname>199.181.11.11</wildfly-hostname>
				<wildfly-port>9990</wildfly-port>
				<wildfly-username>remoteuser</wildfly-username>
				<wildfly-password>remotepassword</wildfly-password>
			</properties>
		</profile>

		<profile>
			<id>wildfly-local</id>
			<properties>
				<wildfly-home>/home/laura/wildfly-8.0.0.Final</wildfly-home>
				<wildfly-hostname>127.0.0.1</wildfly-hostname>
				<wildfly-port>9990</wildfly-port>
				<wildfly-username>laura</wildfly-username>
				<wildfly-password>localpassword</wildfly-password>
			</properties>
		</profile>

	</profiles>

	<activeProfiles>
		<activeProfile>wildfly-local</activeProfile>
		<activeProfile>wildfly-remote</activeProfile>
	</activeProfiles>

</settings>

In the pom.xml file place the plugins under build>plugins> and set the server configuration parameters as maven properties (without adding the in your pom):

<plugin>
				<groupId>org.wildfly.plugins</groupId>
				<artifactId>wildfly-maven-plugin</artifactId>
				<version>1.0.0.Final</version>
				<configuration>
					<hostname>${wildfly-hostname}</hostname>
					<port>${wildfly-port}</port>
					<username>${wildfly-username}</username>
					<password>${wildfly-password}</password>
				</configuration>
				<executions>
					<execution>
<!-- 						<phase>package</phase> -->
<!-- 						<goals> -->
<!-- 							<goal>deploy</goal> -->
<!-- 						</goals> -->
					</execution>
				</executions>
			</plugin>

To deploy on the localhost server run the following command:

wildfly:deploy -P wildfly-local

To deploy on the remote server run:

wildfly:deploy -P wildfly-remote

You can also run undeploy, redeploy…For further information see: https://docs.jboss.org/wildfly/plugins/maven/latest/

To make a Liferay Service Builder with external database there are some rules to follow. This post will help you to get straight to the point.
Keep in mind that:

  • You can’t deploy more than one portlet mapping column with the same entity name, otherwise you get a hot-Deployment error.
  • the names of the portlet name, namespace and database must be distinct (ex. portlet=”imageview“, namespace=”mammography“, database=”dicomviewer“).
  • when you add external jar, you must add them in the Tomcat/lib/ext
    so liferay can find them in the global classpath.

The steps to make the service builder with the external database mapping are:

  1. make the service.xml file in the /docroot/WEB-INF/
  2. launch the build-service ant command
  3. add the ext-spring.xml file in the /docroot/WEB-INF/src/META-INF/ folder
  4. deploy the portlet.

The example below might be helpful.

—service.xml ————

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE service-builder PUBLIC "-//Liferay//DTD Service Builder 6.0.0//EN" "http://www.liferay.com/dtd/liferay-service-builder_6_0_0.dtd">


<service-builder package-path="it.dicom">
<author>Laura Liparulo</author>
<namespace>mammography</namespace>

<entity name="Volume" local-service="true" remote-service="true" table="volume"
data-source="mammographyDataSource" session-factory="mammographySessionFactory" tx-manager="mammographyTransactionManager">
<!-- PK Fields -->
<column name="volumeId" type="long" primary="true" />
<!-- Other Fields -->
<column name="volumeName" type="String" />
<!-- Relationships -->
<column name="caseVolume" type="Collection" entity="CaseArchive"
mapping-key="volumeId" />
<order by="asc">
<order-column name="volumeName" />

</order>
<finder name="Volume_Name" return-type="Collection">
<finder-column name="volumeName" />
</finder>
</entity>

<entity name="CaseArchive" local-service="true" remote-service="true" table="case_archive"
data-source="mammographyDataSource" session-factory="mammographySessionFactory" tx-manager="mammographyTransactionManager">
<!-- PK Fields -->
<column name="caseId" type="long" primary="true" />
<!-- Other Fields -->
<column name="caseName" type="String" />
<column name="volumeId" type="long" />
<column name="notes" type="String" />
<!-- Relationships -->
<column name="image_Case" type="Collection" entity="Image"
mapping-key="caseId" />
<order by="asc">
<order-column name="caseName" />
</order>
<finder name="Case_Name" return-type="Collection">
<finder-column name="caseName" />

</finder>
</entity>

</service-builder>
;

—ext-spring.xml ————

<?xml version="1.0"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean
class="
org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
</bean>
<bean id="mammographyDataSourceTarget"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/dicomviewer" />
<property name="username" value="root" />

<property name="password" value="tigertailz" />
</bean>
<bean id="mammographyDataSource"
class="org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy">
<property name="targetDataSource">
<ref bean="mammographyDataSourceTarget" />
</property>
</bean>
<bean id="mammographyHibernateSessionFactory"
class="com.liferay.portal.spring.hibernate.PortletHibernateConfiguration">
<property name="dataSource">
<ref bean="mammographyDataSource" />
</property>
</bean>
<bean id="mammographySessionFactory">
<property name="sessionFactoryImplementor">
<ref bean="mammographyHibernateSessionFactory" />

</property>
</bean>
<bean id="mammographyTransactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="dataSource">
<ref bean="mammographyDataSource" />
</property>
<property name="sessionFactory">
<ref bean="mammographyHibernateSessionFactory" />
</property>
</bean>
</beans>

Now you can make it fast as a shark! 🙂