IIS virtual directory creation fails on IIS 7.0 / windows server 2008 - nant

When I tried to create a virtual directory in the remote server using NAnt build script It could not create and shows the error message below:
The webservice at 'remote_machine' does not exist or is not reachable
The OS of remote server is Windows server 2008. Here I have used NAnt 0.92 and natcontrib 0.92.
Any suggestions would be appreciated.
EDiT: It is working for local machine but not for the remote. Any suggestion Please.
the code portion:
<property name="serverName" value="MyServer"/>
<property name="currentDeployName" value="Research"/>
<property name="deployDir" value="\\${serverName}\wwwroot\${currentDeployName}"/>
<property name="currentDir" value="${deployDir}"/>
<property name="DeployWebDir" value="${sourceDir}\Deployment\Deployment.Web"/>
<property name="webrootDir" value="C:\Inetpub\wwwroot"/>
<deliisdir iisserver="${serverName}" vdirname="${currentDeployName}" />
<mkdir dir="${deployDir}" />
<copy todir="${deployDir}" overwrite="true">
<fileset basedir="${DeployWebDir}">
<include name="**\*" />
</fileset>
</copy>
<mkiisdir iisserver="${serverName}" dirpath="${webrootDir}\${currentDeployName}"
vdirname="${currentDeployName}"/>

Related

Encoding UTF-8 problem while JPA/hibernate execute sql-script with Intelli-J

Im developing a Jee webapp using JPA/Hibernate as ORM framework, PostgreSQL as db, and Tomcat as server.
When i start the app i want entitymanager to inject some data in my db.
I do that whith
<property name="javax.persistence.sql-load-script-source" value="META-INF/data.sql"/>
in persistence.xml
Everything works fine except that i get some bad encoding like "Ardèche" instead of "Ardèche".
My whole project is in utf-8, my database too.
I had encoding output problems in Intelli-j terminal with tomcat, that i managed to resolve using -Dfile.encoding=UTF-8 in Help | Edit Custom VM Options.
But my data in my db is still wrong, even if in Intelli-J output i get the good result.
If i execute the script straight into pgadmin there is no problem.
I tried everything i could find to solve that, but nothing worked.
I probably have conflict in the configuration now, cause i tried too many different stuff.
My persistence.xml
<properties>
<property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver" />
<property name="javax.persistence.jdbc.url" value="jdbc:postgresql://localhost:5432/DB" />
<property name="javax.persistence.jdbc.user" value="db" />
<property name="javax.persistence.jdbc.password" value="" />
<property name="hibernate.connection.useUnicode" value="true" />
<property name="hibernate.connection.characterEncoding" value="UTF-8" />
<property name="hibernate.connection.charSet" value="UTF-8"/>
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.hbm2ddl.auto" value="create" />
<property name="javax.persistence.sql-load-script-source" value="META-INF/data.sql"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQL95Dialect"/>
<property name="hibernate.connection.autocommit" value="true" />
</properties>
It's my first message on stackoverflow so i hope i did everything properly !
Thanks !
thanks for your answer, i just managed to fix it by adding <property name="hibernate.hbm2ddl.charset_name" value="UTF-8"/> to persistence.xml. I didn't check enough the hibernate doc !

NAnt - Check if process exists

We use NAnt to stop the service, replace the files and start it backup.
<echo message="Waiting for Service to stop."/>
<property name="stopWait" value="360" />
<call target="stopServiceWait" />
... which calls below block
<!--Waits specified number of seconds or until service is stopped.-->
<target name="stopServiceWait">
<if test="${int::parse(stopWait) > 0}">
<echo message="Stopping Service... Waiting ${stopWait} more seconds..."/>
<property name="stopWait" value="${int::parse(stopWait) - 1}" />
<property name="isStopped" value="${service::is-stopped(bf.serviceName, bf.serverName)}" />
<echo message="isStopped - ${isStopped}"/>
<if test="${isStopped == 'False'}">
<sleep seconds="1" />
<echo message="Service is still not stopped"/>
<call target="stopServiceWait" />
</if>
</if>
</target>
However after stopping the service the process often continues running for quite a few seconds, blocking the files. So we just wait some more time right now:
<!--Wait another 60 sec.-->
<echo message="Sleeping additional 60 seconds to ensure that process shuts down after stop."/>
<sleep seconds="60" />
Often long wait is not necessary and just extends outage, or sometimes it is not enough and the deployment has to be restarted.
Question:
Is there a way to check from NANT if the process with the certain name exists?

Configuring database connection in Jboss FUSE

One way I know to configure DB in JBOSS FUSE is to use blueprint.xml.
Below configuration in blueprint.xml works
<bean id="gemsDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
<property name="url" value="${gems_url}" />
<property name="username" value="${gems_username}" />
<property name="password" value="${gems_password}" />
<property name="maxIdle" value="5" />
<property name="minIdle" value="1" />
<property name="initialSize" value="1" />
</bean>
However, Is there any way to configure it in JBOSS container specific configuration file. For example - In JBOSS EAP we can configure it in standalone.xml. On similar lines can we configure it in JBOSS FUSE?
Jboss Fuse provides the integration with various data sources. You need to configure them bundle wise like you have used. But no such configuration is there on container level.
You can define a Datasource in a bundle and export it. In other bundles you import and use it like a service.
Prerequisites
Install these features
features:install jdbc
features:install jndi
Datasource bundle
Drop an XML file inside deploy folder with following content:
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
<bean id="dataSource" class="org.postgresql.jdbc3.Jdbc3SimpleDataSource">
<property name="url" value="jdbc:postgresql://localhost:5432/databasename"/>
<property name="user" value="username"/>
<property name="password" value="xxx"/>
</bean>
<service interface="javax.sql.DataSource" ref="dataSource">
<service-properties>
<entry key="osgi.jndi.service.name" value="jdbc/yourdatabasename_ds"/>
</service-properties>
</service>
</blueprint>
This will export a service with javax.sql.DataSource interface and a JNDI name
Use Datasource service
When a bundle needs the datasource, ask OSGi to inject it.
<blueprint>
<reference id="yourDatabaseDs"
interface="javax.sql.DataSource"
availability="mandatory"
filter="(osgi.jndi.service.name=jdbc/yourdatabasename_ds)"/>
</blueprint>
The right Datasource is retrieved using the JNDI name you provided.
Using availability="mandatory" you can force your bundle to wait for the Datasource to become available. The bundle won't start without this reference.
You need the correct JDBC drivers for the database you are using.
Other goodies
You have a lot of commands in JBoss Fuse console to interact with the database now, like jdbc:datasources that will list all available datasources. With jdbc:query you can run any SQL against your DB (good for debugging issues and testing the connection)

Unable to invoke an EJB deployed on JBoss 7.1 from JBoss ESB 4.10

I'm trying to invoke an Stateless Session Bean (EJB 3) deployed on Jboss 7.1 Final from an remote instance of JBoss ESB 4.10.
In my jboss-esb.xml I have the following information:
<action name="EJBTestWithReturnValue" class="org.jboss.soa.esb.actions.EJBProcessor">
<property name="ejb3" value="true" />
<property name="method" value="login" />
<property name="jndi-name" value="gwtbatis-ear/gwtibatis-ejb/UserServiceEJB!com.aestasit.gwtibatis.UserServiceRemote" />
<property name="initial-context-factory" value="org.jnp.interfaces.NamingContextFactory" />
<property name="security-principal" value="xxxx" />
<property name="security-credentials" value="xxxx" />
<property name="provider-url" value="localhost:4447" />
<property name="ejb-params">
<arg0 type="java.lang.String">username</arg0>
<arg1 type="java.lang.String">password</arg1>
</property>
<property name="esb-out-var" value="org.jboss.soa.esb.message.defaultEntry"/>
Whatever JNDI binding I try I always get an error "invalid stream header: 00000018".
I successfully invoke the same EJB from a Java client but I use a different context factory ("org.jboss.naming.remote.client.InitialContextFactor").
Is there a way to invoke the remote EJB from ESB, without importing the client lib required by JBoss 7 and wriying my own EJB invoker?

Deploying on remote JBoss 6.x with Cargo

I'm trying to setup an Ant Target to perform a remote deploy on a JBoss 6.x server, using Cargo.
Here is my target description:
<target name="deploy" depends="install-cargo,make-war">
<input message="Enter username for deployment..."
addproperty="deploy.username" />
<input message="Enter password for ${deploy.username}..."
addproperty="deploy.password" >
<handler type="secure" />
</input>
<cargo containerId="jboss6x" action="redeploy" type="remote">
<configuration type="runtime">
<property name="cargo.hostname" value="${deploy.host}" />
<property name="cargo.servlet.port" value="${deploy.host}" />
<property name="cargo.remote.username" value="${deploy.username}" />
<property name="cargo.remote.password" value="${deploy.password}" />
<deployable type="war" file="${dist.dir}/${ant.project.name}.war">
<property name="context" value="${ant.project.name}" />
</deployable>
</configuration>
</cargo>
Every jar inside [jboss.home]/client and [jboss.home]/lib is inside cargo.tasks classpath but when i try to execute the Target I get this error:
javax.security.auth.login.LoginException: impossibile trovare la classe LoginModule: org.jboss.security.ClientLoginModule
That is Java cannot find class org.jboss.security.ClientLoginModule (by the way: this class is located inside jbosssx.jar in [jboss.home]/lib).
Am I missing some jar? Do I need to configure something for jaas? Thanks for your help.