JADE Agent Integration with WSIG - java

installed all neccesary pre-requisite for integrating web service with jade. when trying to test out the wsig jade-addon with ant in command prompt like this
>ant deploy-examples
it loads up and shows 100 errors , tried different things(The Logger Keeps Popping As Error). Please need serious help as it is a huge project for me.Thanks
Here is the console error
Microsoft Windows [Version 6.2.9200]
(c) 2012 Microsoft Corporation. All rights reserved.
C:\Users\THEOPHY>cd C:\jade\add-ons\wsig
C:\jade\add-ons\wsig>ant deploy-examples
Buildfile: C:\jade\add-ons\wsig\build.xml
init:
[echo] JAVA_HOME C:\Program Files\Java\jdk1.8.0_51
[echo] CATALINA_HOME C:\juddi
[echo] source dir C:\jade\add-ons\wsig\src
[echo] build dir C:\jade\add-ons\wsig\webModule\WEB-INF\classes
[echo] OS platform is Windows 8
SubWCRev:
compile:
[javac] Compiling 46 source files to C:\jade\add-ons\wsig\webModule\WEB-INF\classes
[javac] warning: [options] bootstrap class path not set in conjunction with -source 1.5
[javac] warning: [options] source value 1.5 is obsolete and will be removed in a future release
[javac] warning: [options] target value 1.5 is obsolete and will be removed in a future release
[javac] warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
[javac] C:\jade\add-ons\wsig\src\com\tilab\wsig\WSIGConfiguration.java:49: error: cannot find symbol
[javac] private static Logger logger = Logger.getMyLogger(WSIGConfiguration.class.getName());
[javac] ^
[javac] symbol: method getMyLogger(String)
[javac] location: class Logger
[javac] C:\jade\add-ons\wsig\src\com\tilab\wsig\WSIGConfiguration.java:67: error: cannot find symbol
[javac] public static final String KEY_WSIG_PRESERVE_JAVA_TYPE = SLCodec.PRESERVE_JAVA_TYPES;
[javac] ^
[javac] symbol: variable PRESERVE_JAVA_TYPES
[javac] location: class SLCodec
[javac] C:\jade\add-ons\wsig\src\com\tilab\wsig\WSIGConfiguration.java:184: error: cannot find symbol
[javac] return getProperty(jade.core.Profile.LOCAL_PORT);
[javac] ^
[javac] symbol: variable LOCAL_PORT
[javac] location: class Profile

I think it has to do with what version of java it is attempting to target. As you can see there are some warnings that indicate source and target are obsolete. What I had to do to get this working is simply delete the references to the source and target in the build.xml to force it to use a default value.
For example change:
<target name="compile" depends="init,SubWCRev" description="Compile WSIG sources">
<javac srcdir="${wsigSrc.dir}"
debug="${debug-build}"
destdir="${wsigBuild.dir}"
encoding="ISO-8859-1"
optimize="${optimised-build}"
includeAntRuntime="no"
target="1.5"
source="1.5">
<classpath refid="wsigCompile.classpath"/>
</javac>
<echo>Compilation complete</echo>
</target>
to this:
<target name="compile" depends="init,SubWCRev" description="Compile WSIG sources">
<javac srcdir="${wsigSrc.dir}"
debug="${debug-build}"
destdir="${wsigBuild.dir}"
encoding="ISO-8859-1"
optimize="${optimised-build}"
includeAntRuntime="no">
<classpath refid="wsigCompile.classpath"/>
</javac>
<echo>Compilation complete</echo>
</target>

Related

JDK 11 compiling class files fails with OOM exception

[Edit] This is no longer an issue. Did not change anything except using the current JDK11.
Updated jar dependencies for jdk 11 compliance.
Updated ant to 1.10.x.
Changed ANT_OPTS to use upto 5GB of memory.
Changed the javac task inside build script to use upto 5GB of memory and fork=true.
I get the following error:
[javac] Compiling 909 source files to C:\xyz\build\classes
[javac]
[javac]
[javac] The system is out of resources.
[javac] Consult the following stack trace for details.
[javac] java.lang.OutOfMemoryError: Java heap space
[javac] at jdk.zipfs/jdk.nio.zipfs.ZipPath.relativize(ZipPath.java:226)
[javac] at jdk.compiler/com.sun.tools.javac.file.JavacFileManager$ArchiveContainer$1.preVisitDirectory(JavacFileManager.java:525)
[javac] at jdk.compiler/com.sun.tools.javac.file.JavacFileManager$ArchiveContainer$1.preVisitDirectory(JavacFileManager.java:521)
[javac] at java.base/java.nio.file.Files.walkFileTree(Files.java:2731)
[javac] at jdk.compiler/com.sun.tools.javac.file.JavacFileManager$ArchiveContainer.<init>(JavacFileManager.java:520)
[javac] at jdk.compiler/com.sun.tools.javac.file.JavacFileManager.getContainer(JavacFileManager.java:316)
[javac] at jdk.compiler/com.sun.tools.javac.file.JavacFileManager.list(JavacFileManager.java:712)
[javac] at jdk.compiler/com.sun.tools.javac.code.ClassFinder.list(ClassFinder.java:734)
[javac] at jdk.compiler/com.sun.tools.javac.code.ClassFinder.scanUserPaths(ClassFinder.java:678)
[javac] at jdk.compiler/com.sun.tools.javac.code.ClassFinder.fillIn(ClassFinder.java:551)
[javac] at jdk.compiler/com.sun.tools.javac.code.ClassFinder.complete(ClassFinder.java:299)
[javac] at jdk.compiler/com.sun.tools.javac.code.ClassFinder$$Lambda$42/0x00000008000d6040.complete(Unknown Source)
[javac] at jdk.compiler/com.sun.tools.javac.code.Symtab.lambda$addRootPackageFor$8(Symtab.java:780)
[javac] at jdk.compiler/com.sun.tools.javac.code.Symtab$$Lambda$44/0x00000008000d5840.complete(Unknown Source)
[javac] at jdk.compiler/com.sun.tools.javac.code.Symbol.complete(Symbol.java:642)
[javac] at jdk.compiler/com.sun.tools.javac.comp.Enter.visitTopLevel(Enter.java:355)
[javac] at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:529)
[javac] at jdk.compiler/com.sun.tools.javac.comp.Enter.classEnter(Enter.java:286)
[javac] at jdk.compiler/com.sun.tools.javac.comp.Enter.classEnter(Enter.java:301)
[javac] at jdk.compiler/com.sun.tools.javac.comp.Enter.complete(Enter.java:576)
[javac] at jdk.compiler/com.sun.tools.javac.comp.Enter.main(Enter.java:560)
[javac] at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:1066)
[javac] at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:937)
[javac] at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:311)
[javac] at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:170)
[javac] at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:57)
[javac] at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:43)
Note : This same setup continues to build fine under java 8
Update 1:
Running ant with -verbose and the javac in the build file with verbose provides the search path that is used. Comparing thejdk8 and jdk11 entries :
JDK8 had the following entries that wern't present in jdk 11 search path
c:\jdk1.8.0_152\jre\lib\resources.jar
c:\jdk1.8.0_152\jre\lib\rt.jar
c:\jdk1.8.0_152\jre\lib\sunrsasign.jar
c:\jdk1.8.0_152\jre\lib\jsse.jar
c:\jdk1.8.0_152\jre\lib\jce.jar
c:\jdk1.8.0_152\jre\lib\charsets.jar
c:\jdk1.8.0_152\jre\lib\jfr.jar
c:\jdk1.8.0_152\jre\classes
c:\jdk1.8.0_152\jre\lib\ext\access-bridge-64.jar
c:\jdk1.8.0_152\jre\lib\ext\cldrdata.jar
c:\jdk1.8.0_152\jre\lib\ext\dnsns.jar
c:\jdk1.8.0_152\jre\lib\ext\jaccess.jar
c:\jdk1.8.0_152\jre\lib\ext\jfxrt.jar
c:\jdk1.8.0_152\jre\lib\ext\localedata.jar
c:\jdk1.8.0_152\jre\lib\ext\nashorn.jar
c:\jdk1.8.0_152\jre\lib\ext\sunec.jar
c:\jdk1.8.0_152\jre\lib\ext\sunjce_provider.jar
c:\jdk1.8.0_152\jre\lib\ext\sunmscapi.jar
c:\jdk1.8.0_152\jre\lib\ext\sunpkcs11.jar
c:\jdk1.8.0_152\jre\lib\ext\zipfs.jar
c:\jdk1.8.0_152\lib\tools.jar
C:\SourceRepo\xx\yy\
The last line is the root of the project where the build.xml exists.
After the search path, there are a bunch of "loading ZipFileIndexFileObject...".
Followed by class file generation of my classes.
Followed by putting them in a jar.
The entries in jdk11 that were missing in the jdk8 search path.
C:\jdk-11\lib\modules
The above modules doesn't exist.
And then it fails with OOM stacktrace as listed earlier.
Update 2 Oct 17'2018:
Got an openjdk11 docker image (linux), installed ant on it, mounted my source directory and did an ant build. Worked fine no issues. So it seems like a windows jdk11 issue to me right now.

How do I add a jar-file to Ant for a NetBeans Java Web App project so that it gets build on Jenkins?

As I pointed out in my previous question, I am trying to set up an automatic build system with Jenkins CI for a NetBeans multitiered web application project.
My Ant targets are clean and debug. Clean works, but debug fails when trying to compile the project.
In the output of my Jenkins build I see the following command:
[PGB Webapp] $ cmd.exe /C '""C:\Program Files (x86)\Jenkins\tools\hudson.tasks.Ant_AntInstallation\Apache_Ant\bin\ant.bat" "-Dlibs.MySQLDriver.classpath=C:/Program Files (x86)/MySQL/MySQL Connector J/mysql-connector-java-5.1.31-bin.jar" "-Dlibs.CopyLibs.classpath=C:/Program Files/NetBeans 8.0/java/ant/extra/org-netbeans-modules-java-j2seproject-copylibstask.jar" "-Dj2ee.server.home=C:/Program Files/wildfly-8.1.0.Final" clean debug && exit %%ERRORLEVEL%%"'
And this is the last part of my output: (the part that seems most important to me)
library-inclusion-in-manifest:
-do-compile:
[mkdir] Created dir: C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\build\empty
[mkdir] Created dir: C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\build\generated-sources\ap-source-output
[javac] Compiling 2 source files to C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\build\web\WEB-INF\classes
[javac] C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\src\java\com\edw\config\ApplicationConfig.java:6: error: package javax.ws.rs.core does not exist
[javac] import javax.ws.rs.core.Application;
[javac] ^
[javac] C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\src\java\com\edw\config\ApplicationConfig.java:8: error: cannot find symbol
[javac] public class ApplicationConfig extends Application {
[javac] ^
[javac] symbol: class Application
[javac] C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\src\java\com\edw\rest\EmployeeResource.java:12: error: package javax.ws.rs does not exist
[javac] import javax.ws.rs.GET;
[javac] ^
[javac] C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\src\java\com\edw\rest\EmployeeResource.java:13: error: package javax.ws.rs does not exist
[javac] import javax.ws.rs.Path;
[javac] ^
[javac] C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\src\java\com\edw\rest\EmployeeResource.java:14: error: package javax.ws.rs does not exist
[javac] import javax.ws.rs.PathParam;
[javac] ^
[javac] C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\src\java\com\edw\rest\EmployeeResource.java:15: error: package javax.ws.rs does not exist
[javac] import javax.ws.rs.QueryParam;
[javac] ^
[javac] C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\src\java\com\edw\rest\EmployeeResource.java:16: error: package javax.ws.rs does not exist
[javac] import javax.ws.rs.Produces;
[javac] ^
[javac] C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\src\java\com\edw\rest\EmployeeResource.java:17: error: package javax.ws.rs.core does not exist
[javac] import javax.ws.rs.core.MediaType;
[javac] ^
[javac] C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\src\java\com\edw\rest\EmployeeResource.java:19: error: cannot find symbol
[javac] #Path("/employees")
[javac] ^
[javac] symbol: class Path
[javac] C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\src\java\com\edw\rest\EmployeeResource.java:29: error: cannot find symbol
[javac] public List<Employee> find(#QueryParam("name") String name) {
[javac] ^
[javac] symbol: class QueryParam
[javac] location: class EmployeeResource
[javac] C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\src\java\com\edw\rest\EmployeeResource.java:27: error: cannot find symbol
[javac] #GET
[javac] ^
[javac] symbol: class GET
[javac] location: class EmployeeResource
[javac] C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\src\java\com\edw\rest\EmployeeResource.java:28: error: cannot find symbol
[javac] #Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
[javac] ^
[javac] symbol: class Produces
[javac] location: class EmployeeResource
[javac] C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\src\java\com\edw\rest\EmployeeResource.java:38: error: cannot find symbol
[javac] public Employee findById(#PathParam("id") String id) {
[javac] ^
[javac] symbol: class PathParam
[javac] location: class EmployeeResource
[javac] C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\src\java\com\edw\rest\EmployeeResource.java:36: error: cannot find symbol
[javac] #GET #Path("{id}")
[javac] ^
[javac] symbol: class GET
[javac] location: class EmployeeResource
[javac] C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\src\java\com\edw\rest\EmployeeResource.java:36: error: cannot find symbol
[javac] #GET #Path("{id}")
[javac] ^
[javac] symbol: class Path
[javac] location: class EmployeeResource
[javac] C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\src\java\com\edw\rest\EmployeeResource.java:37: error: cannot find symbol
[javac] #Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
[javac] ^
[javac] symbol: class Produces
[javac] location: class EmployeeResource
[javac] C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\src\java\com\edw\rest\EmployeeResource.java:44: error: cannot find symbol
[javac] public List<Employee> findByManager(#PathParam("id") String managerId) {
[javac] ^
[javac] symbol: class PathParam
[javac] location: class EmployeeResource
[javac] C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\src\java\com\edw\rest\EmployeeResource.java:42: error: cannot find symbol
[javac] #GET #Path("{id}/reports")
[javac] ^
[javac] symbol: class GET
[javac] location: class EmployeeResource
[javac] C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\src\java\com\edw\rest\EmployeeResource.java:42: error: cannot find symbol
[javac] #GET #Path("{id}/reports")
[javac] ^
[javac] symbol: class Path
[javac] location: class EmployeeResource
[javac] C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\src\java\com\edw\rest\EmployeeResource.java:43: error: cannot find symbol
[javac] #Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
[javac] ^
[javac] symbol: class Produces
[javac] location: class EmployeeResource
[javac] C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\src\java\com\edw\config\ApplicationConfig.java:17: error: method does not override or implement a method from a supertype
[javac] #Override
[javac] ^
[javac] C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\src\java\com\edw\config\ApplicationConfig.java:22: error: method does not override or implement a method from a supertype
[javac] #Override
[javac] ^
[javac] 22 errors
BUILD FAILED
C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\nbproject\build-impl.xml:208: The following error occurred while executing this line:
C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\nbproject\build-impl.xml:881: The following error occurred while executing this line:
C:\Program Files (x86)\Jenkins\workspace\PGB Webapp\pgb-war\nbproject\build-impl.xml:297: Compile failed; see the compiler error output for details.
Total time: 1 second
Build step 'Start Ant' marked build as failure
Finished: FAILURE
Well, the important thing here is that the Java compiler is not able to locate the RESTful Web Services library. I found the jar I need at C:/Program Files/wildfly-8.1.0.Final/modules/system/layers/base/javax/ws/rs/api/main/jaxrs-api-3.0.8.Final.jar.
I have no experience with the Ant buildtool, so I have searched and found a lot about it, but I cannot seem to figure out how to get this library added so that the project gets properly build on Jenkins.
Currently my build.xml file looks as follows:
<?xml version="1.0" encoding="UTF-8"?>
<project name="pgb" default="default" basedir="." xmlns:ear="http://www.netbeans.org/ns/j2ee-earproject/2">
<description>Builds, tests, and runs the project pgb.</description>
<import file="nbproject/build-impl.xml"/>
<taskdef resource="net/jtools/classloadertask/antlib.xml">
<classpath>
<fileset dir="${basedir}/lib" includes="ant-classloader*.jar"/>
</classpath>
</taskdef>
<!--Add jar to the classpath-->
<classloader loader="system">
<classpath>
<fileset dir="${basedir}/lib" includes="jboss-modules.jar"/>
<fileset dir="${basedir}/lib" includes="jaxrs-api-3.0.8.Final.jar"/>
</classpath>
</classloader>
</project>
The file build-impl.xml (which is imported) is generated by NetBeans (as you may probably know already) and is too big to display here, besides I could not change anything there because the system might automatically change that file itself.
Anyway, as you can see I've tried to use an Ant Classloader I found here: https://stackoverflow.com/a/5116470/2541501
But no luck there.. I even added the required jar-file to the lib directory of the project.
So, my question is: how do I change my Ant buildscript so that the Java compiler does not complain about missing packages (i.e. missing jar files)?
I am also worried that if I add any targets to my build.xml file that it might conflict with anything that is declared in the generated build-impl.xml file. Anyone also know anything about this?
Okay my colleague found out that we simply needed to copy the private properties of the NetBeans project into the Properties field of the Ant Invoke of the Jenkins job of our project.
So, our NetBeans project has a directory called private in the nbproject-directory. In this private directory there is a file called private.properties. We took the properties from this file and copied it into the Properties field of the Ant Invoke. Now our Properties field looks as follows:
libs.CopyLibs.classpath=C:/Program Files/NetBeans 8.0/java/ant/extra/org-netbeans-modules-java-j2seproject-copylibstask.jar
libs.MySQLDriver.classpath=C:/Program Files (x86)/MySQL/MySQL Connector J/mysql-connector-java-5.1.31-bin.jar
j2ee.platform.is.jsr109=true
j2ee.server.domain=C:/Wildfly/standalone
j2ee.server.home=C:/Wildfly
j2ee.server.instance=wildfly-deployer:localhost:8080#standalone&C:\\Wildfly
Now we can perform all Ant commands without a problem. We are also able to deploy the web application that is build through Jenkins.
If anyone is wondering, the RESTful Web Services can be found in WildFly. So we don't need to include the jar of the RESTful Web Services directly, all we need is to set the properties for the WildFly server right.
In retrospect, I would say that it is not that hard at all to set-up a continuous integration system with automatic builds for a NetBeans project. Now, next step is to also include automated testing for the project.

Compile failed when running a lucene example

After fixing the error like tools.jar and junit.jar not found (thanks to stack overflow) I tried to compile the example given in "lucene in action" book. But when I compiled I am getting this error. Can you tell what error I am getting and how to fix it?
Total time: 0 seconds
E:\LuceneInAction>ant Indexer
Buildfile: E:\LuceneInAction\build.xml
check-environment:
compile:
[javac] E:\LuceneInAction\build.xml:66: warning: 'includeantruntime' was not
set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 104 source files to E:\LuceneInAction\build\classes
[javac] E:\LuceneInAction\src\lia\analysis\AnalyzerUtils.java:3: warning: [d
eprecation] Assert in junit.framework has been deprecated
[javac] import junit.framework.Assert;
[javac] ^
[javac] E:\LuceneInAction\src\lia\handlingtypes\html\NekoHTMLHandler.java:18
: error: package org.apache.html.dom does not exist
[javac] import org.apache.html.dom.HTMLDocumentImpl;
[javac] ^
[javac] E:\LuceneInAction\src\lia\analysis\AnalyzerUtils.java:90: warning: [
deprecation] Assert in junit.framework has been deprecated
[javac] Assert.assertEquals(strings.length, tokens.length);
[javac] ^
[javac] E:\LuceneInAction\src\lia\analysis\AnalyzerUtils.java:93: warning: [
deprecation] Assert in junit.framework has been deprecated
[javac] Assert.assertEquals("index " + i, strings[i], tokens[i].termTe
xt());
[javac] ^
[javac] E:\LuceneInAction\src\lia\handlingtypes\html\NekoHTMLHandler.java:32
: error: cannot find symbol
[javac] new HTMLDocumentImpl().createDocumentFragment();
[javac] ^
[javac] symbol: class HTMLDocumentImpl
[javac] location: class NekoHTMLHandler
[javac] Note: Some input files use unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] 2 errors
[javac] 3 warnings
BUILD FAILED
E:\LuceneInAction\build.xml:66: Compile failed; see the compiler error output fo
r details.
Total time: 2 seconds
Sorry I dont have enough reputaion to post image
Tt is complaining about your jar which contains HtmlDocumentImpl not being on the classpath. Maybe xerces? A specific version.
The JUnits are a warning that it the Assert which comes from org.framework. You can update your JUnit jar file or leave it as is since that isnt the cause of the error.
The errors are due to a jar not being on your classpath. which in my guess is xerces

javac: java.lang.OutOfMemoryError when running ant from Eclipse

I have given loads of memory to eclipse in the ini file but its still not using anything more than 300mb which i can see in the task manager.
[javac] The system is out of resources.
[javac] Consult the following stack trace for details.
[javac] java.lang.OutOfMemoryError: Java heap space
[javac] at com.sun.tools.javac.comp.Attr.selectSym(Attr.java:1938)
[javac] at com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:1835)
[javac] at com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:1522)
[javac] at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:360)
[javac] at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:377)
[javac] at com.sun.tools.javac.comp.Annotate.enterAttributeValue(Annotate.java:190)
[javac] at com.sun.tools.javac.comp.Annotate.enterAnnotation(Annotate.java:167)
[javac] at com.sun.tools.javac.comp.MemberEnter.enterAnnotations(MemberEnter.java:743)
[javac] at com.sun.tools.javac.comp.MemberEnter.access$300(MemberEnter.java:42)
[javac] at com.sun.tools.javac.comp.MemberEnter$5.enterAnnotation(MemberEnter.java:711)
[javac] at com.sun.tools.javac.comp.Annotate.flush(Annotate.java:95)
[javac] at com.sun.tools.javac.comp.Annotate.enterDone(Annotate.java:87)
[javac] at com.sun.tools.javac.comp.Enter.complete(Enter.java:485)
[javac] at com.sun.tools.javac.comp.Enter.main(Enter.java:442)
[javac] at com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:819)
[javac] at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:727)
[javac] at com.sun.tools.javac.main.Main.compile(Main.java:353)
[javac] at com.sun.tools.javac.main.Main.compile(Main.java:279)
[javac] at com.sun.tools.javac.main.Main.compile(Main.java:270)
[javac] at com.sun.tools.javac.Main.compile(Main.java:69)
[javac] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[javac] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[javac] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[javac] at java.lang.reflect.Method.invoke(Method.java:597)
[javac] at org.apache.tools.ant.taskdefs.compilers.Javac13.execute(Javac13.java:56)
[javac] at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:1065)
[javac] at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:882)
[javac] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
[javac] at sun.reflect.GeneratedMethodAccessor19.invoke(Unknown Source)
[javac] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[javac] at java.lang.reflect.Method.invoke(Method.java:597)
[javac] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
this is my ini file which i have.
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
512M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize1024m
--vm
C:\Program Files\Java\jdk1.6.0_24\bin\javaw.exe -vmargs -Xms512m -Xmx1024m
I have no idea why it wont use the memory I am giving it. Do i need to do anything else to change the heap size?
Thanks
Not Eclipse is running out of memory, but ant. Ant is run as an external tool from eclipse, so it does not inherit the VM settings you are using for eclipse. You can set the options for it in the external tool run configuration. Go to Run -> External Tools -> External Tool Configurations... Then under "Ant Builds" you have to look up your ant build, and you can set the vm arguments in the JRE tab.
your eclipse.ini settings will take effect only if u change following:
Run -> External Tools -> External Tool
Configurations. go to configuration that u use, under jre tab -select option
Run in same JRE in workspace
this worked 4 me
See this topic with best Eclipse JVM settings
You can properly set the -Xms512m -Xmx1024m options to the Ant bin/sh script that Eclipse will run once you launch a build.
Go to your Eclipse folder
Go to plugins > org.apache.ant_<version> > bin
Modify the OS related Ant file
For Windows: Add this line to the ant.bat file export ANT_OPTS=-Xmx512m
For Unix/Mac OS X: You can directly edit the ant_exec_command command at the end of the ant file or setting the $ANT_ARGS variable
I had the same problem a week ago, and the solution was set fork attribute to true, to run javac in a separate process with its own heap size settings.
If fork is set to false, or not set (default is false), javac will run in the same process as Ant. The following is a snippet from my current build.xml:
<javac fork="true"
srcdir="${basedir}/src"
.....
</javac>
Setting fork to true will also limit any memory leaks in javac implementation to its own child process, without affecting the parent Ant process.
I read about this hint here

Doubt in build.xml file in Apache-Ant1.6.5

I have used Collections in my code with Generics. When try to compile that java file in build.xml, its showing error at generics and its saying its not a statement. I am using Apache-Ant-1.6.5 and i have installed JDK 1.5 only . I know generic will support in jdk1.5 but its showing error. The below is the error i am getting for the code
code :
Map<String, String> inputconfigmap =
new LinkedHashMap<String, String>();
Exception :
compile:
[mkdir] Created dir: D:\GenericPreProcessor\Source\classes
[javac] Compiling 49 source files to D:\GenericPreProcessor\Source\classes
[javac] D:\GenericPreProcessor\Source\src\com\dnb\genericpreprocessor\fileprocessor\FixedLength
FileProcessor.java:187: not a statement
[javac] Map<String, String> inputconfigmap =
new LinkedHashMap<String, String>();
I did as per your suggestion but i got the following in the console.
Console :
D:\GenericPreProcessor\Source>ant
Buildfile: build.xml
[echo] JVM version is 1.5
[echo] Target compilation is ${ant.build.javac.target}
clean:
[delete] Deleting directory D:\GenericPreProcessor\Source\classes
cleanJar:
compile:
[mkdir] Created dir: D:\GenericPreProcessor\Source\classes
[javac] Compiling 49 source files to D:\GenericPreProcessor\Source\classes
[javac] javac: invalid target release: 1.5
[javac] Usage: javac
[javac] where possible options include:
[javac] -g Generate all debugging info
[javac] -g:none Generate no debugging info
[javac] -g:{lines,vars,source} Generate only some debugging info
[javac] -nowarn Generate no warnings
[javac] -verbose Output messages about what the compiler is doing
[javac] -deprecation Output source locations where deprecated APIs are used
[javac] -classpath Specify where to find user class files
[javac] -sourcepath Specify where to find input source files
[javac] -bootclasspath Override location of bootstrap class files
[javac] -extdirs Override location of installed extensions
[javac] -d Specify where to place generated class files
[javac] -encoding Specify character encoding used by source files
[javac] -source Provide source compatibility with specified release
[javac] -target Generate class files for specific VM version
[javac] -help Print a synopsis of standard options
BUILD FAILED
Have you tried explicitly setting the source and target attributes for your javac task?
<target name="compile">
<javac .....
source="1.6"
target="1.6" />
</target>
Maybe you can check the version of your compilator with :
<echo>JVM version is ${ant.java.version}</echo>
<echo>Target compilation is ${ant.build.javac.target}</echo>
And you can add <property name="ant.build.javac.target" value="1.5" /> to force the compiler to use Java 5 compliance...
This property is the default target from ant 1.7, for ant 1.6 I think you must add target="${ant.build.javac.target}" to your javac target.
You need to define the type of the Map, i.e:
Map<String, String> inputconfigmap = new LinkedHashMap<String, String>();
Try
Map<?, ?> inputconfigmap = new LinkedHashMap<?, ?>();
Are you using double angle brackets (<< and >>)? They should be single ones as kgiannakakis showed:
Map<String, String> inputconfigmap = new LinkedHashMap<String, String>();

Categories

Resources