I am trying to use Jenkins to execute a SQL script that is in my source control. To do this, I created a build task to invoke ANT. My ANT version is 1.9.4.
Here is the build file that I am calling
<project name="VResources-Reset">
<sql
driver="com.microsoft.sqlserver.jdbc.SQLServerDriver"
url="jdbc:sqlserver://SERVER_NAME:1433;databaseName=Automation"
userid="USERID"
password="PWD"
src="C:\\SvyDeploy\\DEV\\Sprint\\Automation\\Database\\Viewpoint\\View Resources\\VResources - Reset Users.sql"/>
<classpath>
<pathelement location="C:\\SvyDeploy\\DEV\\Sprint\\Automation\\libs\\sqljdbc4.jar"/>
</classpath>
</project>
I have also tried using org.database.jdbcDriver as the driver.
When I try to build my project in Jenkins, I am always getting the below error and can't figure out why. ANT and Jenkins are very new to me, so I'm sure I'm missing something simple. Can someone please point out what that is?
Class Not Found: JDBC driver com.microsoft.sqlserver.jdbc.SQLServerDriver could not be loaded
Hope classPath should be passed inside sql element.
Please try this..
<project name="VResources-Reset">
<sql driver="com.microsoft.sqlserver.jdbc.SQLServerDriver" url="jdbc:sqlserver://SERVER_NAME:1433;databaseName=Automation"
userid="USERID"
password="PWD"
src="C:\\SvyDeploy\\DEV\\Sprint\\Automation\\Database\\Viewpoint\\View Resources\\VResources - Reset Users.sql">
<classpath>
<pathelement location="C:\\SvyDeploy\\DEV\\Sprint\\Automation\\libs\\sqljdbc4.jar"/>
</classpath>
</sql>
</project>
Related
My springboot application builds into a WAR file (using Jenkins). I want to automate the remote deployment to Websphere 9.
I have read around and it seems there is no maven plugin for deployment to websphere 9 but ant support is pretty good. So, I'm using maven ant plugin to help running those ant tasks. I started with attempt to list the applications installed, just to see if it works. However I'm running into an exception related to localization:
[ERROR] C:\DEV\ant-was-deploy.xml:81:
java.util.MissingResourceException: Can't find bundle for base name
com.ibm.ws.profile.resourcebundle.WSProfileResourceBundle, locale
en_US
My ant-was-deploy.xml is referenced from pom.xml:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>id123</id>
<phase>clean</phase>
<configuration>
<locales>es</locales>
<target>
<ant antfile="${basedir}/ant-was-deploy.xml">
<target name="listApps"/>
</ant>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
ant-was-deploy.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project name="websphere" default="listApps" basedir="." >
<target name="listApps" >
<taskdef name="wsListApps" classname="com.ibm.websphere.ant.tasks.ListApplications" classpath="${wasHome.dir}/plugins/com.ibm.ws.runtime.jar" />
<wsListApps
profileName="AppServ01"
wasHome="C:\\opt\\IBM\\WebSphere\\AppServer"
/>
</target>
</project>
I think the error comes from com.ibm.ws.runtime.jar. Inside it has WSProfileResourceBundle.class and WSProfileResourceBundle_en.class but not WSProfileResourceBundle_en_US.class (name is just an assumption - I have copied the bundle with this name inside the jar but it didn't work).
I also tried to set the locale for the entire plugin but it seems that localization for this plugin is not implemented properly (no impact in my case - I set the locale to 'es' but still got the error for en_US).
I also tried to pass system parameters to maven command: mvn clean -Duser.language=fr -Duser.country=FR
It didn't work either.
So, my question is if there is a way to change the locale before the ant script? If I can set it to 'en' probably it will find the right resource bundle.
I'm fairly new to Websphere, if there is another solution to automate the remote deployment to websphere 9 I would be happy to hear it. I would rather not use scripts on target server or Jenkins plugin but if there is no other way ...
I just had the same issue. In my case, i was using an AppServer name (AppSrv1 instead of AppSrv01) that did not exist anymore, in my maven settings.xml.
The right server name solved the issue.
Using the TeamCity API:
We are trying to put together a dashboard to work out how long from a build failing, it took for someone to assign themselves to an investigation for the build / project.
We cant find a way to do this as investigations are assigned to projects not builds so there is no way to find out when an investigation started for a particular build ?
If you need to get investigation for build configuration you may use the following REST API:
http://teamcity:8111/app/rest/investigations?locator=buildType:(id:XXXX)
For example, the following request
https://teamcity.jetbrains.com/app/rest/investigations?locator=buildType:(id:Epigenome_GenestackTests)
returns the following response, which has timestamp under assignment node:
<?xml version="1.0" encoding="UTF-8"?>
<investigations count="1" href="/app/rest/investigations?locator=buildType:(id:Epigenome_GenestackTests)">
<investigation id="buildType:(id:Epigenome_GenestackTests)" state="TAKEN" href="/app/rest/investigations/buildType:(id:Epigenome_GenestackTests)">
<assignee username="evgeny.kurbatsky" name="Evgeny.Kurbatsky" id="1107" href="/app/rest/users/id:1107" />
<assignment>
<user username="oleg" name="Oleg Shpynov" id="2" href="/app/rest/users/id:2" />
<timestamp>20160321T122158+0000</timestamp>
</assignment>
<scope>
<buildTypes count="1">
<buildType id="Epigenome_GenestackTests" name="Genestack Tests" paused="true" description="Fast tests" projectName="BioLabs :: Epigenome" projectId="Epigenome" href="/app/rest/buildTypes/id:Epigenome_GenestackTests" webUrl="https://teamcity.jetbrains.com/viewType.html?buildTypeId=Epigenome_GenestackTests" />
</buildTypes>
</scope>
<target anyProblem="true" />
<resolution type="whenFixed" />
</investigation>
</investigations>
I created a method in Jython to add shared library to the installed application. I save the script file in {was.install.dir}/bin directory with name "addSharedLib.py". I am using ant to install the application on the cluster. My question is how do I call this jython method from ant script to get desired result? I am using websphere 8.5.5 ND.
def setSharedLibrary(appName,editionNo,saredLibName):
Have looked into the WAS provided ant environment?
There is ws_ant utility - ws_ant docs.
You can obtain one of the jython standalone jars from http://www.jython.org/downloads.html and just run the Ant java task like this ...
<?xml version="1.0" encoding="windows-1252" ?>
<project default="install">
<target name="install">
<java classname="org.python.util.jython" fork="true" failonerror="true">
<arg line="addSharedLib.py"/>
<classpath>
<pathelement location='D:\work\jython\jython2.5.3\jython-standalone-2.5.3.jar' />
</classpath>
</java>
</target>
</project>
I am trying to get Spring MVC and Junit working with eachother and I am having trouble configuring the build.xml file. I am fairly new at using ANT and do not really understand all the tutorials. I put the junit.jar file in the lib direcotory, but still am getting the following message from my console.
test:
BUILD FAILED
C:\Java\mmz\WEB-INF\build.xml:63: The <classpath> for <junit> must include junit.jar if not in Ant's own classpath
Total time: 223 milliseconds
Edit
Here is an example of wanting to run just one test
and I am not sure what I need to do, i tried doing something like the following, but I dont quite understand what its doing, so I dont know how to make changes
<path id="classpath.test">
<pathelement location="" />
<pathelement location="${test.dir}" />
</path>
<target name="test">
<junit>
<classpath refid="classpath.test" />
<formatter type="brief" usefile="false" />
<test name="TesterTest" />
</junit>
</target>
I am pretty lost on what to do next. Thanks
If you copy-pasted your build.xml file then there is probably a classpath element somewhere. Probably near the top of the file. In that element they have probably listed some paths and/or files. You need to add the junit jar to this section.
I am looking for something similar to the Ant sql task but that will accept a JDBC url of the format:
jdbc:oracle:thin:#TNS_NAME
One possible approach seems to be to write my own Ant task that uses an OracleDataSource to create the Connection, but is there a way to do this straight in Ant?
EDIT:
Thanks for the responses so far guys. I hope it helps if I elaborate a bit more on the error I'm getting.
My Ant task looks as follows:
<target name="MyTarget" >
<property name="oracle.net.tns_admin" value="/opt/oracle/product/10.2.0.1/NETWORK/ADMIN" />
<property name="jdbc.driver" value="ojdbc5.jar" />
<property name="jdbc.i18n.support" value="orai18n.jar" />
<property name="jdbc.driver.class" value="oracle.jdbc.OracleDriver" />
<path id="sql.class.path">
<pathelement location="${jdbc.driver}" />
<pathelement location="${jdbc.i18n.support}" />
</path>
<sql driver="${jdbc.driver.class}" url="jdbc:oracle:thin:#THE_TNS_NAME" userid="USER" password="PASSWORD" classpathref="sql.class.path" >
<![CDATA[
#SOME ARBITRARY SQL HERE
]]>
</sql>
</target>
This fails with the error:
java.sql.SQLException: Io exception: Unknown host specified
Replacing the url with "jdbc:oracle:thin:#HOST:PORT:INSTANCE" works fine, and I can also tnsping the tns name used above, so I know it's valid.
Was just working with this today and stumbled upon the missing piece. The TNS location needs to be set as a system property as indicated here: Oracle thin JDBC to TNS name
To establish an Oracle thin JDBC connection to a TNS alias (tnsname),
make sure you pass the oracle.net.tns_admin system property to the JVM.
Its value should be the directory in which your tnsnames.ora file is
located. After that, you can just pass the TNS alias in place of the
host name in the JDBC URL.
E.g. if you simply try to connect to jdbc:oracle:thin:#MYDB, which
is in your tnsnames.ora file, you’ll get an SQLException with a detail
message of Io exception: Unknown host specified. If you fire up the JVM
with a -Doracle.net.tns_admin=/oracle/10g/NETWORK/ADMIN, or use
System.setProperty(String,String) after startup, the connection
will be established successfully.
After doing this I was able to successfully connect using the TNS alias alone.
Are you sure it's NETWORK/ADMIN and not network/admin?
Unix filesystems are usually case sensitive - (assuming it's on Unix).
If you mean that you want a "thick" connection that uses tnsnames.ora and not the thin driver, then you can wrap a call to sqlplus in the xml file:
<target name="myTarget">
<!-- login.sql should have sqlcode exit so failonerror will fail build -->
<exec executable="sqlplus" failonerror="true">
<arg value="${userid}/${password}#${tnsalias}"/>
<arg value="#myScript"/>
</exec>
</target>
... is the basic idea.
[where userid, password, and tnsalias are defined in your properties file]
This obviously means you'll have to have at least the Instant Client stack installed.
Since we don't now yet, what the exact problem is, I can only assume that this might help:
http://theblasfrompas.blogspot.com/2008/04/jdbc-thin-connection-using-tnsnamesora.html