Target "run" does not exist in the project "barbecue" - ant

I want to run a sample demo for JasperReport, so I downloaded the file but when I type the following in my windows 7 command line according to the Jasperreport documentation :
C:\jasperreports-4.7.0\demo\samples\barbecue>ant run
I got the following error:
Target "run" does not exist in the project "barbecue" .
So what might be the problem ?
::UPDATED::
After i typed ant –p in my CMD i got the following :-
C:\jasperreports-4.7.0\demo\samples\barbecue>ant -p
Buildfile: C:\jasperreports-4.7.0\demo\samples\barbecue\build.xml
Shows how barcodes could be included in reports using the Barbecue component.
Main targets:
clean Deletes all the generated files.
compile Compiles the XML report design and produces the .jasper file.
csv Generates a CSV version of the report by converting the .jrprint
file.
decompile Decompiles a .jasper file into a .jrxml file.
docx Generates a DOCX version of the report by converting the .jrprin
t file.
fill Fills the compiled report design with data and produces the .jrp
rint file.
html Generates an HTML version of the report by converting the .jrpri
nt file.
javac Compiles the java source files of the test application.
jxl Generates an XLS version of the report by converting the .jrprin
t file using the JExcelApi library.
ods Generates an ODS version of the report by converting the .jrprin
t file.
odt Generates an ODT version of the report by converting the .jrprin
t file.
pdf Generates a PDF version of the report by converting the .jrprint
file.
pptx Generates a PPTX version of the report by converting the .jrprin
t file.
print Sends the report in the .jrprint file to the printer.
rtf Generates an RTF version of the report by converting the .jrprin
t file.
test Runs the sample.
view Launches the report viewer to preview the report stored in the .
jrprint file.
viewDesign Launches the design viewer to preview the compiled report design
.
viewDesignXml Launches the design viewer to preview the XML report design.
viewXml Launches the report viewer to preview the generated report store
d in an XML file.
writeApi Generates a .java version of the report by converting the .jrxml
file.
writeApiXml Generates a .jrxml version of the report by executing the API ve
rsion of the report design.
xhtml Generates an XHTML version of the report by converting the .jrpr
int file.
xls Generates an XLS version of the report by converting the .jrprin
t file using the POI library.
xlsx Generates an XLSX version of the report by converting the .jrpri
nt file.
xml Generates an XML version of the report by converting the .jrprin
t file.
xmlEmbed Generates an XML version of the report by converting the .jrprin
t file.
Default target: test
:::::UPDATED2:::::
i type ant test for the charts demo but the problem is still there:-
C:\jasperreports-4.7.0\demo\samples\charts>ant test
Buildfile: C:\jasperreports-4.7.0\demo\samples\charts\build.xml
test:
[echo] ===================================
[echo] Charts Sample
[echo] ===================================
clean:
clean-sample:
javac:
javac:
[mkdir] Created dir: C:\jasperreports-4.7.0\demo\samples\charts\build\classe
s
[javac] C:\jasperreports-4.7.0\demo\samples\build.xml:41: warning: 'includea
ntruntime' was not set, defaulting to build.sysclasspath=last; set to false for
repeatable builds
[javac] Compiling 2 source files to C:\jasperreports-4.7.0\demo\samples\char
ts\build\classes
[javac] warning: [options] bootstrap class path not set in conjunction with
-source 1.6
[javac] Note: C:\jasperreports-4.7.0\demo\samples\charts\src\ChartsApp.java
uses unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] 1 warning
[copy] Copied 5 empty directories to 5 empty directories under C:\jasperrep
orts-4.7.0\demo\samples\charts\build\classes
compile:
compile:
[mkdir] Created dir: C:\jasperreports-4.7.0\demo\samples\charts\build\report
s
[jrc] Compiling 24 report design files.
[jrc] File : C:\jasperreports-4.7.0\demo\samples\charts\reports\MultipleAx
isChartReport.jrxml ... OK.
[jrc] File : C:\jasperreports-4.7.0\demo\samples\charts\reports\XYBarChart
TimePeriodReport.jrxml ... OK.
[jrc] File : C:\jasperreports-4.7.0\demo\samples\charts\reports\XYAreaChar
tReport.jrxml ... OK.
[jrc] File : C:\jasperreports-4.7.0\demo\samples\charts\reports\Pie3DChart
Report.jrxml ... OK.
[jrc] File : C:\jasperreports-4.7.0\demo\samples\charts\reports\StackedBar
3DChartReport.jrxml ... OK.
[jrc] File : C:\jasperreports-4.7.0\demo\samples\charts\reports\MeterChart
Report.jrxml ... OK.
[jrc] File : C:\jasperreports-4.7.0\demo\samples\charts\reports\XYBarChart
Report.jrxml ... OK.
[jrc] File : C:\jasperreports-4.7.0\demo\samples\charts\reports\StackedAre
aChartReport.jrxml ... OK.
[jrc] File : C:\jasperreports-4.7.0\demo\samples\charts\reports\Candlestic
kChartReport.jrxml ... OK.
[jrc] File : C:\jasperreports-4.7.0\demo\samples\charts\reports\HighLowCha
rtReport.jrxml ... OK.
[jrc] File : C:\jasperreports-4.7.0\demo\samples\charts\reports\XYLineChar
tReport.jrxml ... OK.
[jrc] File : C:\jasperreports-4.7.0\demo\samples\charts\reports\BubbleChar
tReport.jrxml ... OK.
[jrc] File : C:\jasperreports-4.7.0\demo\samples\charts\reports\Thermomete
rChartReport.jrxml ... OK.
[jrc] File : C:\jasperreports-4.7.0\demo\samples\charts\reports\StackedBar
ChartReport.jrxml ... OK.
[jrc] File : C:\jasperreports-4.7.0\demo\samples\charts\reports\ScatterCha
rtReport.jrxml ... OK.
[jrc] File : C:\jasperreports-4.7.0\demo\samples\charts\reports\TimeSeries
ChartReport.jrxml ... OK.
[jrc] File : C:\jasperreports-4.7.0\demo\samples\charts\reports\SubDataset
ChartReport.jrxml ... OK.
[jrc] File : C:\jasperreports-4.7.0\demo\samples\charts\reports\AreaChartR
eport.jrxml ... OK.
[jrc] File : C:\jasperreports-4.7.0\demo\samples\charts\reports\LineChartR
eport.jrxml ... OK.
[jrc] File : C:\jasperreports-4.7.0\demo\samples\charts\reports\XYBarChart
TimeSeriesReport.jrxml ... OK.
[jrc] File : C:\jasperreports-4.7.0\demo\samples\charts\reports\GanttChart
Report.jrxml ... OK.
[jrc] File : C:\jasperreports-4.7.0\demo\samples\charts\reports\PieChartRe
port.jrxml ... OK.
[jrc] File : C:\jasperreports-4.7.0\demo\samples\charts\reports\Bar3DChart
Report.jrxml ... OK.
[jrc] File : C:\jasperreports-4.7.0\demo\samples\charts\reports\BarChartRe
port.jrxml ... OK.
test:
[java] net.sf.jasperreports.engine.JRException: java.sql.SQLException: sock
et creation error
[java] at net.sf.jasperreports.engine.util.AbstractSampleApp.getDemoHsq
ldbConnection(AbstractSampleApp.java:158)
[java] at ChartsApp.fill(ChartsApp.java:83)
[java] at ChartsApp.test(ChartsApp.java:63)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcces
sorImpl.java:57)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMet
hodAccessorImpl.java:43)
[java] at java.lang.reflect.Method.invoke(Method.java:601)
[java] at net.sf.jasperreports.engine.util.AbstractSampleApp.executeTas
k(AbstractSampleApp.java:94)
[java] at net.sf.jasperreports.engine.util.AbstractSampleApp.main(Abstr
actSampleApp.java:179)
[java] at ChartsApp.main(ChartsApp.java:54)
[java] Caused by: java.sql.SQLException: socket creation error
[java] at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
[java] at org.hsqldb.jdbc.jdbcConnection.<init>(Unknown Source)
[java] at org.hsqldb.jdbcDriver.getConnection(Unknown Source)
[java] at org.hsqldb.jdbcDriver.connect(Unknown Source)
[java] at java.sql.DriverManager.getConnection(DriverManager.java:579)
[java] at java.sql.DriverManager.getConnection(DriverManager.java:221)
[java] at net.sf.jasperreports.engine.util.AbstractSampleApp.getDemoHsq
ldbConnection(AbstractSampleApp.java:150)
[java] ... 9 more
BUILD SUCCESSFUL
Total time: 8 seconds
C:\jasperreports-4.7.0\demo\samples\charts>ant run
Buildfile: C:\jasperreports-4.7.0\demo\samples\charts\build.xml
BUILD FAILED
Target "run" does not exist in the project "charts".
Total time: 0 seconds

Java errors are like a car accident. One car will hit another which causes the first to careen into a street light. The street light topples over and hits a gasoline truck which explodes.
In the end, you have destruction, fire, and death. However, the whole thing started because the driver was too busy texting and didn't stop at a stop sign.
You have a long, long list of error messages, but what's important are those at the very beginning:
net.sf.jasperreports.engine.JRException: java.sql.SQLException: socket creation error
[java] at net.sf.jasperreports.engine.util.AbstractSampleApp.getDemoHsqldbConnection(AbstractSampleApp.java:158)
This is a socket creation error.
This error seems to point out that you can't connect to the server or the database.
And, that's about as far as I can get with this. I really don't know Jasper, but I did find this. Does that help you at all?
Is there a server you should be running, or a database you need to connect to that's not created? Do you have a firewall that's preventing connecting to the server/database. (I'm leaning towards the database issue because I do see stuff about hsqldb and sql in your error message.
I take it you're not a Java developer because you seemed confused by Ant and it's build.xml file. Is there someone who can help you with this? If you can, look at the build.xml and see what the target test is doing. It's running a Java command, and you can try running that command outside of Ant. Sometimes, that will give you a bit more information.

You should run ant test command for run the sample (cleaning, compiling and generating the report in all formats: xls, pdf, etc.).
For viewing report in JRViewer you should run ant view command.
The result (output) for ant test will be:
d:\java\jasperreports-4.5.1\demo\samples\barbecue>ant test
Buildfile: d:\java\jasperreports-4.5.1\demo\samples\barbecue\build.xml
test:
[echo] ===================================
[echo] Barbecue Sample
[echo] ===================================
clean:
clean-sample:
javac:
javac:
[mkdir] Created dir: d:\java\jasperreports-4.5.1\demo\samples\barbecue\build
\classes
[javac] d:\java\jasperreports-4.5.1\demo\samples\build.xml:41: warning: 'inc
ludeantruntime' was not set, defaulting to build.sysclasspath=last; set to false
for repeatable builds
[javac] Compiling 1 source file to d:\java\jasperreports-4.5.1\demo\samples\
barbecue\build\classes
compile:
compile:
[mkdir] Created dir: d:\java\jasperreports-4.5.1\demo\samples\barbecue\build
\reports
[jrc] Compiling 1 report design files.
[jrc] File : d:\java\jasperreports-4.5.1\demo\samples\barbecue\reports\Bar
becueReport.jrxml ... OK.
test:
[java] Filling time : 3198
[java] PDF creation time : 993
[java] XML creation time : 224
[java] XML creation time : 44
[java] HTML creation time : 109
[java] RTF creation time : 98
[java] XLS creation time : 364
[java] XLS creation time : 248
[java] CSV creation time : 6
[java] ODT creation time : 95
[java] ODS creation time : 12
[java] DOCX creation time : 183
[java] XLSX creation time : 103
[java] PPTX creation time : 74
[java] XHTML creation time : 56
BUILD SUCCESSFUL
Total time: 13 seconds
The reaction on the net.sf.jasperreports.engine.JRException: java.sql.SQLException: sock
et creation error exception:
The sample that you are trying to start is using connection to the HSQLDB server. For starting DB you should run ant runServer command from the demo/hsqldb folder.
For more details how to run sample you can read this post

Related

Sonar integration with Ant

I am try to integrate the sonar with ant. My SonarQube server is running fine but when i am building the XML using ant i am getting the following error.
Property 'sonar.jdbc.url' is not supported any more. It will be ignored. There is no longer any DB connection to the SQ database.
[sonar:sonar] Property 'sonar.jdbc.username' is not supported any more. It will be ignored. There is no longer any DB connection to the SQ database.
[sonar:sonar] Property 'sonar.jdbc.password' is not supported any more. It will be ignored. There is no longer any DB connection to the SQ database.
[sonar:sonar] User cache: C:\Users\XYZ\.sonar\cache
[sonar:sonar] Load plugins index
[sonar:sonar] Load plugins index (done) | time=26ms
[sonar:sonar] Default locale: "en_US", source code encoding: "UTF-8" (analysis is platform dependent)
[sonar:sonar] Process project properties
BUILD FAILED
C:\Users\XYZ\git\ABCAPI\ant\build.xml:264: java.lang.IllegalStateException: Unable to load component class org.sonar.batch.scan.ProjectLock
I am new to sonar. I also added the the sonar.properties file and tried, but then also I am getting the error Unable to load component class org.sonar.batch.scan.ProjectLock.
I have tried placing the jdbc properties to build xml directly also but no gain.
I have seen previously discussion but they were of no help.

Ant ignoring copy task file?

I have the following :
<mkdir dir="${build.dir}/serverNIO" />
<copy todir="${build.dir}/serverNIO" overwrite="true" verbose="true">
<fileset dir="resources/serverresources">
<include name="*.properties" />
</fileset>
</copy>
I want to copy the properties file from one folder to the other, all other tasks work fine except this one.
Why does this happen? I do not even get any error message,and the file are in the location mentioned.
So when I try to run my server:
MacBook-Pro:ClientServerNio ramapriyasridharan$ ant run_server
Buildfile: /Users/ramapriyasridharan/Downloads/ClientServerNio/build.xml
init:
[mkdir] Created dir: /Users/ramapriyasridharan/Downloads/ClientServerNio/bin
[mkdir] Created dir: /Users/ramapriyasridharan/Downloads/ClientServerNio/dist
compile_server:
[mkdir] Created dir: /Users/ramapriyasridharan/Downloads/ClientServerNio/bin/serverNIO
[copy] Copying 1 file to /Users/ramapriyasridharan/Downloads/ClientServerNio/bin/serverNIO
[copy] Copying /Users/ramapriyasridharan/Downloads/ClientServerNio/resources/serverresources/server.properties to /Users/ramapriyasridharan/Downloads/ClientServerNio/bin/serverNIO/server.properties
init:
compile_common_server:
[javac] Compiling 3 source files to /Users/ramapriyasridharan/Downloads/ClientServerNio/bin/serverNIO
init:
compile_database_api:
[javac] Compiling 1 source file to /Users/ramapriyasridharan/Downloads/ClientServerNio/bin/serverNIO
[javac] Compiling 5 source files to /Users/ramapriyasridharan/Downloads/ClientServerNio/bin/serverNIO
jar_server:
[jar] Building jar: /Users/ramapriyasridharan/Downloads/ClientServerNio/dist/server.jar
run_server:
[java] Exception in thread "main" java.io.FileNotFoundException: /ClientServerNio/bin/serverNIO/server.properties (No such file or directory)
[java] at java.io.FileInputStream.open(Native Method)
[java] at java.io.FileInputStream.<init>(FileInputStream.java:146)
[java] at java.io.FileInputStream.<init>(FileInputStream.java:101)
[java] at ch.ethz.rama.asl.server.MessageServer.main(Unknown Source)
[java] Java Result: 1
EDIT :
Now it suddenly seems to copy files, only thing is my server program cannot find the properties file,even tought its in the same directory, what should I do?
The Ant script copies server.properties to...
/Users/ramapriyasridharan/Downloads/ClientServerNio/bin/serverNIO/server.properties
...but the Java program launched in the run_server target is looking for the file at...
/ClientServerNio/bin/serverNIO/server.properties
To fix this, either:
<copy> in the Ant script needs to copy server.properties to /ClientServerNio/bin/serverNIO
MessageServer.main needs to change so it looks for server.properties under /Users/ramapriyasridharan

Build.xml is failed with JNDI error

MY ant build is stopped working with JNDI error, it was working perfectly couple of days ago. The log says that it there is no initial context exception.
Buildfile: C:\vseelsh_workspace\vseelsh_perforce_ws\pem_rd\NBDX\nbdx\build.xml
clean:
[delete] Deleting directory C:\vseelsh_workspace\vseelsh_perforce_ws\pem_rd\NBDX\nbdx\build
prepare:
[mkdir] Created dir: C:\vseelsh_workspace\vseelsh_perforce_ws\pem_rd\NBDX\nbdx\build
[mkdir] Created dir: C:\vseelsh_workspace\vseelsh_perforce_ws\pem_rd\NBDX\nbdx\build\classes
[mkdir] Created dir: C:\vseelsh_workspace\vseelsh_perforce_ws\pem_rd\NBDX\nbdx\build\dist
[mkdir] Created dir: C:\vseelsh_workspace\vseelsh_perforce_ws\pem_rd\NBDX\nbdx\build\report
compile:
[javac] C:\vseelsh_workspace\vseelsh_perforce_ws\pem_rd\NBDX\nbdx\build.xml:75: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 331 source files to C:\vseelsh_workspace\vseelsh_perforce_ws\pem_rd\NBDX\nbdx\build\classes
copyresources:
[copy] Copying 3 files to C:\vseelsh_workspace\vseelsh_perforce_ws\pem_rd\NBDX\nbdx\build\classes
test:
schemaexport:
[hibernatetool] Executing Hibernate Tool with a JPA Configuration
[hibernatetool] 1. task: hbm2ddl (Generates database schema)
[hibernatetool] log4j:WARN No appenders could be found for logger (org.jboss.logging).
[hibernatetool] log4j:WARN Please initialize the log4j system properly.
[hibernatetool] log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
[hibernatetool] SLF4J: Class path contains multiple SLF4J bindings.
[hibernatetool] SLF4J: Found binding in [jar:file:/C:/vseelsh_workspace/vseelsh_perforce_ws/pem_rd/NBDX/nbdx/lib/gwt/gwt-2.3.0/gwt-2.3.0/samples/DynaTableRf/war/WEB-INF/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
[hibernatetool] SLF4J: Found binding in [jar:file:/C:/Jboss/jboss-as-7.1.1.Final/modules/org/slf4j/impl/main/slf4j-jboss-logmanager-1.0.0.GA.jar!/org/slf4j/impl/StaticLoggerBinder.class]
[hibernatetool] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
[hibernatetool] An exception occurred while running exporter #2:hbm2ddl (Generates database schema)
[hibernatetool] To get the full stack trace run ant with -verbose
[hibernatetool] org.hibernate.service.jndi.JndiException: Error parsing JNDI name [java:/nbdxDS]
[hibernatetool] javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
BUILD FAILED
The issue is resolved. Actually my project has two persistence.xml files where one of them is used by build.xml to export schema. In this file used by build.xml I should not use data source tag to refer JNDI (it is directly referring database credentials to connect to it). I have mistakenly copied contents from one persistence.xml file to another which has caused to have jta-datasource tag in it which I could not notice. It has forced build process to look for data source referred as JNDI in this file which is basically not possible because data source is not yet created and stored in JNDI by any other process. After removing this jta-datasource tag has resolved from this persistence tag has resolved the issue.

Unable to run the demo setup

I have downloaded the Activity 5.10 zip file and then i have downloaded and configured the Apache ANT and i test it and it worked successfully.
But i am unable to run the demo file as specified in this link http://activiti.org/userguide/#demo.setup
if i type the following using the cmd command line:-
C:\activiti-5.10\activiti-5.10\setup>ant demo.start
I will get the following error:-
'ant' is not recognized as an internal or external command, operable program or batch file.
Can anyone help me in identifying what is the problem?
BR
:::UPDATE:::
thanks for the reply, i have copied the ANT bin files inside the setup directory for the activity,, then i run the CMD command again ,, but i got the following error that i build failed,,
AS MENTIONED BELOW:-
C:\Users\Desktop\activiti-5.10\activiti-5.10\setup>ant demo.start
Buildfile: C:\Users\Desktop\activiti-5.10\activiti-5.10\setup\build.xml
demo.install:
internal.cfg.create:
[copy] Copying 1 file to C:\Users\Desktop\activiti-5.10\activiti-5.
10\setup\build\activiti-cfg
[zip] Building zip: C:\Users\Desktop\activiti-5.10\activiti-5.10\s
etup\build\activiti-cfg.jar
[echo] copying configuration to ../workspace/activiti-engine-examples/src/m
ain/config
[unzip] Expanding: C:\Users\Desktop\activiti-5.10\activiti-5.10\setu
p\build\activiti-cfg.jar into C:\Users\Desktop\activiti-5.10\activiti-5.
10\workspace\activiti-engine-examples\src\main\config
internal.classpath.libs:
internal.taskdef.launch:
h2.start:
[echo] starting H2 database...
[launch] launching cmd 'C:\Users\Desktop\activiti-5.10\activiti-5.10\
apps\h2\h2.start.bat ' in dir 'C:\Users\Desktop\activiti-5.10\activiti-5
.10\apps\h2'
[launch] waiting for launch completion msg 'TCP server running'...
[launch] 'java' is not recognized as an internal or external command,
[launch] operable program or batch file.
[launch] launched process completed
[echo] H2 database started
tomcat.start:
BUILD FAILED
C:\Users\Desktop\activiti-5.10\activiti-5.10\setup\build.xml:330: couldn
't find executable for script C:\Users\Desktop\activiti-5.10\activiti-5.
10\apps\apache-tomcat-6.0.32\bin\startup
Total time: 0 seconds
Looks like you didn't set the ant directory in you path variable. Either specifiy the entire path to ant or add it to the path variable
I typed tomcat.install and it solved the problem since I need to download the tomcat inside the apps directory.

Blackberry JDE 6.0 VERIFIER ERROR And KXML 2

I am trying to import kxml2, what I did is I downloaded the lib, went to Project Explorer -> Properties -> Build Path -> Libraries, I include the kxml2-2.3.0.jar. I run compile and get this error
JAR file creation failed with error -1
The preverified classes if any are in tmp25754. See jar log of errors in C:\Users\sgil\AppData\Local\Temp\rapc_1296da5f.dir\jarlog.txt
Error!: Error: preverifier failed: C:\Program Files (x86)\Eclipse-Blackberry\plugins\net.rim.ejde.componentpack6.0.0_6.0.0.30\components ...
Packaging project ** failed (took 0.795 seconds)
Error!: Error: preverifier failed: C:\Program Files (x86)\Eclipse-Blackberry\plugins\net.rim.ejde.componentpack6.0.0_6.0.0.30\components ...
Packaging project ** failed (took 0.795 seconds)
I tried running the preverifier and I got this:
preverify -classpath "C:\Program Files (x86)\Eclipse-B
lackberry\plugins\net.rim.ejde.componentpack6.0.0_6.0.0.30\components\lib\net_ri
m_api.jar" "C:\Users\sgil\Desktop\Projects\Blackberry****\lib\kxml2-2.3.0.
jar"
I get this error:
JAR file creation failed with error -1
The preverified classes if any are in tmp25503. See jar log of errors in output\
jarlog.txt
Any advice?
The solution to this is to put the correct PATH variable in the "Enviromental Variables" of the System(right click in My PC->Enviromental Variables).
If "PATH" already exists you need to add the path of the BIN of the JDK installed on the Computer.
The carpet you should add this is the bin:
for example: C:\PATH_TO_THE_INSTALLED_JDK\bin

Resources