Thorntail using project-defaults.yaml
Using the below command line arguments to start the application.
Trying to pass location of a Java .properties file to use as system properties.
java -jar application-thorntail.jar -P ../config/application.properties -P ../config/application-dev.properties -s ../config/project-defaults.yaml
Property key value in
application.properties
mail.smtp.password=testpass
tds.username=username
In yaml i want to evaluate the value as below
mail:
mail-sessions:
default:
smtp-server:
username: ${mail.smtp.user}
password: ${mail.smtp.password}
outbound-socket-binding-ref: mail-smtp
jndi-name: java:jboss/mail/Default
However, on a statup values are not getting evaluated
Error getting subresources for ConnectionDefinitions
java.lang.RuntimeException: Failed to adopt value java.lang.String
at org.wildfly.swarm.config.runtime.invocation.EntityAdapter.fromEntity(EntityAdapter.java:346)
at org.wildfly.swarm.config.runtime.invocation.Marshaller.appendNode(Marshaller.java:33)
at org.wildfly.swarm.config.runtime.invocation.Marshaller.marshalSubresources(Marshaller.java:129)
at org.wildfly.swarm.config.runtime.invocation.Marshaller.appendNode(Marshaller.java:38)
at org.wildfly.swarm.config.runtime.invocation.Marshaller.marshalSubresources(Marshaller.java:129)
at org.wildfly.swarm.config.runtime.invocation.Marshaller.appendNode(Marshaller.java:38)
at org.wildfly.swarm.config.runtime.invocation.Marshaller.marshalSubresources(Marshaller.java:129)
at org.wildfly.swarm.config.runtime.invocation.Marshaller.appendNode(Marshaller.java:38)
at org.wildfly.swarm.config.runtime.invocation.Marshaller.marshal(Marshaller.java:23)
at org.wildfly.swarm.container.runtime.marshal.SubsystemMarshaller.marshal(SubsystemMarshaller.java:59)
at org.wildfly.swarm.container.runtime.marshal.SubsystemMarshaller$Proxy$_$$_WeldClientProxy.marshal(Unknown Source)
at org.wildfly.swarm.container.runtime.marshal.DMRMarshaller.marshal(DMRMarshaller.java:70)
at org.wildfly.swarm.container.runtime.marshal.DMRMarshaller$Proxy$_$$_WeldClientProxy.marshal(Unknown Source)
at org.wildfly.swarm.container.runtime.RuntimeServer.start(RuntimeServer.java:194)
at org.wildfly.swarm.container.runtime.RuntimeServer$Proxy$_$$_WeldClientProxy.start(Unknown Source)
at org.wildfly.swarm.container.runtime.ServerBootstrapImpl.lambda$bootstrap$1(ServerBootstrapImpl.java:159)
at org.wildfly.swarm.spi.api.ClassLoading.withTCCL(ClassLoading.java:43)
at org.wildfly.swarm.container.runtime.ServerBootstrapImpl.bootstrap(ServerBootstrapImpl.java:113)
at org.wildfly.swarm.Swarm.start(Swarm.java:401)
at org.wildfly.swarm.Swarm.main(Swarm.java:745)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.wildfly.swarm.bootstrap.MainInvoker.invoke(MainInvoker.java:57)
at org.wildfly.swarm.bootstrap.Main.run(Main.java:134)
at org.wildfly.swarm.bootstrap.Main.main(Main.java:87)
Caused by: java.lang.IllegalStateException: Failed to resolve expression: ${tds.username}
at org.jboss.dmr.ValueExpressionResolver.resolve(ValueExpressionResolver.java:128)
at org.jboss.dmr.ValueExpression.resolveString(ValueExpression.java:163)
at org.jboss.dmr.ValueExpression.resolveString(ValueExpression.java:153)
at org.wildfly.swarm.config.runtime.invocation.SimpleTypeAdapter.toDmr(SimpleTypeAdapter.java:22)
at org.wildfly.swarm.config.runtime.invocation.EntityAdapter.fromEntity(EntityAdapter.java:343)
... 26 more
Well, first of all you defined your property as tds.username, but you are tring to access it as mail.smtp.user.
If this was just a mistake when writing the example, maybe you could try using ${env.XXX}.
Change your property file from mail.smtp.user to MAIL_SMTP_USER and then, on project-defaults, use username: ${env.MAIL_SMTP_USER}.
If this works, you could even propose a default value (in the example below, "defaultusername"):
username: ${env.MAIL_SMTP_USER:defaultusername}
Important to note that I don't have the tools to test it.
Related
I am using db2 version 10.5 and inserting the values into the DB2JSON, created a simple standalone java program to retrieve all the values from the table(Collection) when I run the query I am getting the following error
Exception in thread "main" java.lang.RuntimeException: com.ibm.db2.jcc.am.SqlException: [jcc][t4][1065][12306][3.69.66] Caught java.io.CharConversionException. See attached Throwable for details. ERRORCODE=-4220, SQLSTATE=null
at com.ibm.nosql.json.api.DBObjectRowHandler.handle(DBObjectRowHandler.java:38)
at com.ibm.nosql.json.api.DBObjectRowHandler.handle(DBObjectRowHandler.java:14)
at com.ibm.nosql.json.api.BaseResultIterator.next(BaseResultIterator.java:119)
at com.ibm.nosql.json.api.DBCursor.fetchResultsEagerly(DBCursor.java:801)
at com.ibm.nosql.json.api.DBCursor.find(DBCursor.java:895)
at com.ibm.nosql.json.api.DBCursor.hasNext(DBCursor.java:278)
at com.ws.Demo.TestingDemo.main(TestingDemo.java:47)
Caused by: com.ibm.db2.jcc.am.SqlException: [jcc][t4][1065][12306][3.69.66] Caught java.io.CharConversionException. See attached Throwable for details. ERRORCODE=-4220, SQLSTATE=null
at com.ibm.db2.jcc.am.gd.a(gd.java:733)
at com.ibm.db2.jcc.am.gd.a(gd.java:66)
at com.ibm.db2.jcc.am.gd.a(gd.java:120)
at com.ibm.db2.jcc.am.kc.a(kc.java:2868)
at com.ibm.db2.jcc.am.kc.p(kc.java:525)
at com.ibm.db2.jcc.am.kc.Z(kc.java:2747)
at com.ibm.db2.jcc.am.ResultSet.getObjectX(ResultSet.java:1438)
at com.ibm.db2.jcc.am.ResultSet.getObject(ResultSet.java:1413)
at com.ibm.nosql.json.api.DBResultSet.getObject(DBResultSet.java:255)
at com.ibm.nosql.json.api.DBData.getObjectX(DBData.java:66)
at com.ibm.nosql.json.api.DBObjectRowHandler.getObjectID(DBObjectRowHandler.java:58)
at com.ibm.nosql.json.api.DBObjectRowHandler.handle(DBObjectRowHandler.java:28)
... 6 more
Caused by: java.nio.charset.MalformedInputException: Input length = 290
at com.ibm.db2.jcc.am.r.a(r.java:19)
at com.ibm.db2.jcc.am.kc.a(kc.java:2864)
... 14 more
Caused by: sun.io.MalformedInputException
at sun.io.ByteToCharUTF8.convert(ByteToCharUTF8.java:292)
at com.ibm.db2.jcc.am.r.a(r.java:16)
... 15 more
I also went throught few posts where it suggest to use db2.jcc.charsetDecoderEncoder=3 but I have no idea where to use it, and also I few other posts it is suggested touse the lastest version db2jcc.jar, I am using the jars that is present inside the db2 10.5 under sqllib folder. Anyone let me know how to fix this
Add the following environment variable(Java VM arguments) in your tomcat settings
-Ddb2.jcc.charsetDecoderEncoder=3
This worked.
You can set the charset decoder encoder using system property inside your Java code.
For example:
System.setProperty("db2.jcc.charsetDecoderEncoder", "3");
I am getting this error while the server tries to generate a jsp file. We are using our very own Application server (proprietary tool). The server will download the files from a region (say QA) on which my application depends on.
I know the root cause for this error - Classpath is too long, but I dont know how my downloaded files/ jar are getting included to the classpath string, which makes its length greater than 32767 characters. (See the Screenshot)
I need a workaround to solve this problem.
Note : I have come across so many threads reg this issue. They are related to working with eclipse. I don't use eclipse at all. I am just using a text editor.. Any Idea on how to fix this issue.
Thanks in advance
[Error] arch.presentation.JSPResource generating jsp page: generating jsp servlet '__jsp_error__.jsp' org.apache.jasper.JasperException: Unable to compile clas
org.apache.jasper.JasperException: Unable to compile class for JSP
at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:105)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:344)
at org.apache.jasper.compiler.AntCompiler.generateClass(AntCompiler.java:288)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:323)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:301)
at arch.tools.JspC.JspC.processFile(JspC.java:458)
at arch.tools.JspC.JspC.parseFile(JspC.java:571)
at arch.presentation.JSPResource.compile_if_needed(JSPResource.java:300)
at arch.presentation.JSPResource.compile(JSPResource.java:497)
at arch.presentation.JSPResource.process(JSPResource.java:384)
at arch.presentation.JSPResource.process(JSPResource.java:375)
at arch.presentation.JSPResource.showErrorPage(JSPResource.java:157)
at arch.presentation.JSPResource.compile_if_needed(JSPResource.java:336)
at arch.presentation.JSPResource.compile(JSPResource.java:497)
at arch.presentation.JSPResource.process(JSPResource.java:384)
at arch.presentation.JSPResource.process(JSPResource.java:375)
at arch.presentation.beans.WebApplication$FilterChain.doFilter(WebApplication.java:519)
at arch.subsessions.Filter.doFilter(Filter.java:68)
at arch.presentation.beans.WebApplication$FilterChain.doFilter(WebApplication.java:513)
at pershing.netxoffice.amps.common.servlet.AmpsCommonFilter.doFilter(AmpsCommonFilter.java:80)
at arch.presentation.beans.WebApplication$FilterChain.doFilter(WebApplication.java:513)
at arch.subsessions.SubmitPostFilter.doFilter(SubmitPostFilter.java:58)
at arch.presentation.beans.WebApplication$FilterChain.doFilter(WebApplication.java:513)
at arch.presentation.beans.WebApplication._findAndDoFilter(WebApplication.java:740)
at arch.presentation.beans.WebApplication._findAndDoFilter(WebApplication.java:702)
at arch.presentation.beans.WebApplication._doServletFilterForRequest(WebApplication.java:691)
at arch.presentation.beans.WebApplication.processResource(WebApplication.java:1686)
at arch.presentation.beans.WebApplication.processRequest(WebApplication.java:2992)
at arch.servletengine.Provider.processRequest(Provider.java:447)
at arch.no.engine.Context.processRequest(Context.java:68)
at arch.no.engine.HttpConnector.processRequest(HttpConnector.java:58)
at arch.no.http.Response.prepare(Response.java:565)
at arch.no.http.Response._execute(Response.java:2008)
at arch.no.http.Response.startServletRequest(Response.java:1938)
at arch.no.http.Response.run(Response.java:1906)
at arch.no.http.HttpThreadPool._run(HttpThreadPool.java:35)
at arch.util.ThreadPool._runLoopBody(ThreadPool.java:221)
at arch.util.ThreadPool._runForThread(ThreadPool.java:238)
at arch.util.ThreadPool.access$000(ThreadPool.java:3)
at arch.util.ThreadPool$1.run(ThreadPool.java:96)
Caused by: Error running C:\Data\jdk6\bin\javac.exe compiler
at org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter.executeExternalCompile(DefaultCompilerAdapter.java:509)
at org.apache.tools.ant.taskdefs.compilers.JavacExternal.execute(JavacExternal.java:61)
at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:1065)
at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:882)
at org.apache.jasper.compiler.AntCompiler.generateClass(AntCompiler.java:257)
... 37 more
Caused by: java.io.IOException: Cannot run program "C:\Data\jdk6\bin\javac.exe": CreateProcess error=87, The parameter is incorrect
at java.lang.ProcessBuilder.start(ProcessBuilder.java:459)
at java.lang.Runtime.exec(Runtime.java:593)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.taskdefs.Execute$Java13CommandLauncher.exec(Execute.java:832)
at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:447)
at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:461)
at org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter.executeExternalCompile(DefaultCompilerAdapter.java:506)
... 41 more
Caused by: java.io.IOException: CreateProcess error=87, The parameter is incorrect
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(ProcessImpl.java:81)
at java.lang.ProcessImpl.start(ProcessImpl.java:30)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:452)
... 50 more
[Error] org.apache.jasper.compiler.Compiler Environment: Compile: javaFileName=/C:/Data/inautilus/Regions/qa/downloaded/pershing.netxoffice.amps.common/work/pershing.netxoffice.amps.common.WebApplication/__jsp__//amps_002fcommon/
classpath=C:\Data\inautilus\Regions\qa\downloaded\pershing.netxoffice.amps.common\work\pershing.netxoffice.amps.common.WebApplication\__jsp__;C:\Data\inautilus\Regions\qa\downloaded\pershing.netxoffice.amps.common\classes;C:\
are.thirdparty\lib\ais-client.jar;C:\Data\inautilus\Regions\qa\downloaded\middleware.thirdparty\lib\aqapi.jar;C:\Data\inautilus\Regions\qa\downloaded\middleware.thirdparty\lib\CL3Export.jar;C:\Data\inautilus\Regions\qa\downloaded
.4.57/arch.core.jdbc/lib/driver_getter/;C:/Data/arch.inautilus.full.7400.7.4.57/arch.core.jdbc/lib/oracle/db_config.py;C:/Data/arch.inautilus.full.7400.7.4.57/arch.core.jdbc/lib/oracle/ojdbc14.jar;C:\Data\inautilus\Regions\qa\dow
7400.7.4.57\arch.ejbpersistence\lib\hibernate3.jar;C:\Data\arch.inautilus.full.7400.7.4.57\arch.ejbpersistence\public.jar;C:\Data\inautilus\Regions\qa\downloaded\middleware.appln.MLGSyncService\classes;C:\Data\inautilus\Regions\q
mon\lib\icepublisher.jar;C:\Data\inautilus\Regions\qa\downloaded\com.inautix.netx.alertcommon\lib\icesocket.jar;C:\Data\inautilus\Regions\qa\downloaded\com.inautix.netx.alertcommon\lib\iceutil.jar;C:\Data\inautilus\Regions\qa\dow
voiceware.dialer\lib\util.jar;C:\Data\inautilus\Regions\qa\downloaded\arch.struts2\classes;C:\Data\inautilus\Regions\qa\downloaded\arch.struts2\lib;C:\Data\inautilus\Regions\qa\downloaded\arch.struts2\lib\antlr.jar;C:\Data\inauti
sper.jar;C:\Data\arch.inautilus.full.7400.7.4.57\arch.core.servletengine\lib\jersey-client-1.4.jar;C:\Data\arch.inautilus.full.7400.7.4.57\arch.core.servletengine\lib\jersey-core-1.4.jar;C:\Data\arch.inautilus.full.7400.7.4.57\ar
.samlcore\lib\xmlsec-1.4.3.jar;C:\Data\inautilus\Regions\qa\downloaded\system.sso.common.ssoutils\classes;C:\Data\inautilus\Regions\qa\downloaded\system.entitlements.cache\classes;C:\Data\inautilus\Regions\qa\downloaded\arch.cohe
autilus\Regions\qa\downloaded\arch.coherence.cache.containers\classes;C:\Data\inautilus\Regions\qa\downloaded\arch.coherence.grid.enterprisesession\classes;C:\Data\inautilus\Regions\qa\downloaded\arch.coherence.grid.enterpriseses
achment\classes;C:\Data\inautilus\Regions\qa\downloaded\netxoffice.attachment\public.jar;C:\Data\inautilus\Regions\qa\downloaded\imaging.webservices\classes;C:\Data\inautilus\Regions\qa\downloaded\imaging.webservices\lib;C:\Data\
aging\lib\poi-ooxml-3.7-20101029.jar;C:\Data\inautilus\Regions\qa\downloaded\com.pershing.imaging\lib\poi-ooxml-schemas-3.7-20101029.jar;C:\Data\inautilus\Regions\qa\downloaded\com.pershing.imaging\lib\xmlbeans-2.3.0.jar;C:/Data/
common.dbservices\lib\spring-core-3.1.2.RELEASE.jar;C:\Data\inautilus\Regions\qa\downloaded\pershing.common.dbservices\lib\spring-expression-3.1.2.RELEASE.jar;C:\Data\inautilus\Regions\qa\downloaded\pershing.common.dbservices\lib
ed\netxoffice.userdata\classes;C:\Data\inautilus\Regions\qa\downloaded\netxoffice.userdata\public.jar;C:\Data\inautilus\Regions\qa\downloaded\arch.workflowservices\classes;C:\Data\inautilus\Regions\qa\downloaded\arch.workflowserv
downloaded\com.inautix.netx.alert\lib\icebalancer.jar;C:\Data\inautilus\Regions\qa\downloaded\com.inautix.netx.alert\lib\icecommon.jar;C:\Data\inautilus\Regions\qa\downloaded\com.inautix.netx.alert\lib\icedbdao.jar;C:\Data\inauti
tilus\Regions\qa\downloaded\netxoffice.enterpriserichgrid\classes;C:\Data\inautilus\Regions\qa\downloaded\netxoffice.enterpriserichgrid\lib;C:\Data\inautilus\Regions\qa\downloaded\netxoffice.enterpriserichgrid\lib\itext-1.4.6.jar
ib\streambuffer.jar;C:\Data\inautilus\Regions\qa\downloaded\formsmgmt.laspdf\lib\war-classes.jar;C:\Data\inautilus\Regions\qa\downloaded\formsmgmt.laspdf\lib\woodstox-core-asl.jar;C:\Data\inautilus\Regions\qa\downloaded\formsmgmt
ation.rsa\public.jar;C:\Data\inautilus\Regions\qa\downloaded\middleware.common.AsyncGateway\classes;C:\Data\inautilus\Regions\qa\downloaded\middleware.common.AsyncGateway\public.jar;C:\Data\inautilus\Regions\qa\downloaded\eservic
ownloaded\arch.jsf\lib\commons-digester-1.8.jar;C:\Data\inautilus\Regions\qa\downloaded\arch.jsf\lib\commons-discovery-0.4.jar;C:\Data\inautilus\Regions\qa\downloaded\arch.jsf\lib\jetty-util-7.0.0pre3.jar;C:\Data\inautilus\Region
inautilus.full.7400.7.4.57\arch.core\lib\commons-fileupload-1.0-beta-1.jar;c:\data\arch.inautilus.full.7400.7.4.57\arch.core\lib\commons-logging-api.jar;c:\data\arch.inautilus.full.7400.7.4.57\arch.core\lib\concurrent.jar;c:\data
inautilus.full.7400.7.4.57\arch.core\lib\extensions\axis.jar;c:\data\arch.inautilus.full.7400.7.4.57\arch.core\lib\extensions\dom.jar;c:\data\arch.inautilus.full.7400.7.4.57\arch.core\lib\extensions\dom4j.jar;c:\data\arch.inautil
pi.jar;c:\data\arch.inautilus.full.7400.7.4.57\arch.core.servletengine\lib\jackson-core-asl-1.5.5.jar;c:\data\arch.inautilus.full.7400.7.4.57\arch.core.servletengine\lib\jackson-jaxrs-1.5.5.jar;c:\data\arch.inautilus.full.7400.7.
ersistence\lib\commons-collections-2.1.1.jar;c:\data\arch.inautilus.full.7400.7.4.57\arch.ejbpersistence\lib\ehcache-1.2.4.jar;c:\data\arch.inautilus.full.7400.7.4.57\arch.ejbpersistence\lib\hibernate-entitymanager.jar;c:\data\ar
cp=../../../arch/struts2/lib/commons-collections.jar;c:\data\arch.inautilus.full.7400.7.4.57\arch.core\classes;C:\Data\jdk6\lib\tools.jar;c:\data\arch.inautilus.full.7400.7.4.57\arch.core\classes;c:\data\arch.inautilus.full.7
full.7400.7.4.57\arch.core\lib\looks-win-1.1.2.jar;c:\data\arch.inautilus.full.7400.7.4.57\arch.core\lib\nis-providerutil.jar;c:\data\arch.inautilus.full.7400.7.4.57\arch.core\lib\nis.jar;c:\data\arch.inautilus.full.7400.7.4.57\a
s\xalan.jar;c:\data\arch.inautilus.full.7400.7.4.57\arch.core\lib\extensions\xercesImpl.jar;c:\data\arch.inautilus.full.7400.7.4.57\arch.core\lib\extensions\xsltc.jar;c:\data\arch.inautilus.full.7400.7.4.57\arch.core.servletengin
57\arch.core.servletengine\lib\jstl.jar;c:\data\arch.inautilus.full.7400.7.4.57\arch.core.servletengine\lib\servlet-api.jar;c:\data\arch.inautilus.full.7400.7.4.57\arch.core.servletengine\lib\standard.jar;c:\data\arch.inautilus.f
cp=C:\Data\inautilus\Regions\qa\downloaded\pershing.netxoffice.amps.common\work\pershing.netxoffice.amps.common.WebApplication\__jsp__
Changing the download directory from C:\Data\inautilus\Regions\qa\downloaded to C:/downloaded helps me to reduce the length of the classpath.. Works fine now
Can any body suggest me which jar i shld use to resolve the below exception,
Exception in thread "main" java.lang.NoSuchMethodError: org.neo4j.graphdb.factory.GraphDatabaseSetting$BooleanSetting.<init>(Ljava/lang/String;)V
at org.neo4j.shell.ShellSettings.<clinit>(ShellSettings.java:37)
at sun.misc.Unsafe.ensureClassInitialized(Native Method)
at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(Unknown Source)
at sun.reflect.ReflectionFactory.newFieldAccessor(Unknown Source)
at java.lang.reflect.Field.acquireFieldAccessor(Unknown Source)
at java.lang.reflect.Field.getFieldAccessor(Unknown Source)
at java.lang.reflect.Field.get(Unknown Source)
at org.neo4j.kernel.configuration.AnnotatedFieldHarvester.findStatic(AnnotatedFieldHarvester.java:47)
at org.neo4j.kernel.configuration.AnnotationBasedConfigurationMigrator.<init>(AnnotationBasedConfigurationMigrator.java:40)
at org.neo4j.kernel.configuration.Config.<init>(Config.java:89)
at org.neo4j.kernel.InternalAbstractGraphDatabase.<init>(InternalAbstractGraphDatabase.java:218)
at org.neo4j.kernel.EmbeddedGraphDatabase.<init>(EmbeddedGraphDatabase.java:103)
at org.neo4j.graphdb.factory.GraphDatabaseFactory$1.newDatabase(GraphDatabaseFactory.java:88)
at org.neo4j.graphdb.factory.GraphDatabaseBuilder.newGraphDatabase(GraphDatabaseBuilder.java:207)
at org.neo4j.graphdb.factory.GraphDatabaseFactory.newEmbeddedDatabase(GraphDatabaseFactory.java:69)
at com.Neo4J.src.EmbeddedNeo4j.createDb(EmbeddedNeo4j.java:48)
at com.Neo4J.src.EmbeddedNeo4j.main(EmbeddedNeo4j.java:38).
I have already included the below jar,
neo4j-kernel-1.9.3.jar.
Thanks.
Make sure you have the matching neo4j-shell jar file.
The command javap -v -classpath neo4j-shell-1.9.3.jar org.neo4j.shell.ShellSettings | grep invoke indicates to me that there are only five methods called by ShellSettings. One is the Object default constructor, but that's during the constructor for ShellSettings, not the static class initialization <clinit>. The others are all from class org.neo4j.helpers.Settings. setting is called four times, in two different overloaded versions, matches and illegalValueMessage each once.
So in the 1.9.3 version of neo4j, the call to the constructor of GraphDatabaseSetting$BooleanSetting which is mentioned in your stack trace does not occur. therefore your ShellSettings class must come from some other version which is not binary compatible to 1.9.3. Use compatible versions, and you should be fine.
I've been struggling with launching a java process from perl. The root of the problem is that the java process is missing the JAVA_HOME environment variable causing a ClassNotFoundException.
I started by using IPC::Run3 because of its relatively elegant redirection of STDIN/STDOUT.
Assuming IPC::Run3 would use %ENV, I tried adding $ENV{JAVA_HOME}.
When that didn't work I tried doing system(). That didn't work, so finally, I got it to work using system("JAVA_HOME=/path/to/java && /path/to/java_program");
My test program is below. Naturally I'd uncomment the proper block to test the appropriate invocation.
#!/usr/bin/perl -w
use strict;
use IPC::Run3;
use vars qw(%Config $nutch_stdout $nutch_stderr);
%Config = (
'nutch_binary' => q[/home/crawl/nutch/runtime/local/bin/nutch],
'nutch_crawl_dir' => q[/home/crawl/nutch-crawl/crawl/crawldb/current/part-00000],
'nutch_seed_dir' => q[/home/crawl/urls],
'solr_url' => q[http://localhost:8080/solr],
);
my #nutch_command = ("$Config{nutch_binary}",
"crawl $Config{nutch_seed_dir}",
"-solr $Config{solr_url}",
"-d $Config{nutch_crawl_dir}",
"-threads 1",
"-depth 1");
$ENV{JAVA_HOME} = '/usr/lib/jvm/java-1.6.0';
while ((my $key,my $value) = each %ENV) {
print "$key=$value\n";
}
print "Running #nutch_command\n";
# My original code. Next few lines are shown in first batch of output below.
#run3 \#nutch_command, undef, \$nutch_stdout, \$nutch_stderr;
#print "Output from Nutch:\n";
#print $nutch_stdout;
#print "Errors from Nutch:\n";
#print $nutch_stderr;
# Second try. The next line's output is the second batch of output.
#system(#nutch_command);
# Third try. Despite setting and displaying %ENV, this is the only thing I tried that worked
system("JAVA_HOME=/usr/lib/jvm/java-1.6.0 && #nutch_command");
Here's the output of running the run3:
-bash-3.2$ ./test.pl
... [snip] ...
JAVA_HOME=/usr/lib/jvm/java-1.6.0
... [snip] ...
Running /home/crawl/nutch/runtime/local/bin/nutch crawl /home/crawl/urls -solr http://localhost:8080/solr -d /home/crawl/nutch-crawl/crawl/crawldb/current/part-00000 -threads 1 -depth 1
Output from Nutch:
Errors from Nutch:
Exception in thread "main" java.lang.NoClassDefFoundError: crawl
Caused by: java.lang.ClassNotFoundException: crawl
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: crawl. Program will exit.
And the output of the first system() call:
-bash-3.2$ ./test.pl
... [snip] ...
JAVA_HOME=/usr/lib/jvm/java-1.6.0
... [snip] ...
Running /home/crawl/nutch/runtime/local/bin/nutch crawl /home/crawl/urls -solr http://localhost:8080/solr -d /home/crawl/nutch-crawl/crawl/crawldb/current/part-00000 -threads 1 -depth 1
Exception in thread "main" java.lang.NoClassDefFoundError: crawl
Caused by: java.lang.ClassNotFoundException: crawl
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: crawl. Program will exit.
Finally, the third system call-- the only one that worked!-- with the environment variable set inline:
-bash-3.2$ ./test.pl
... [snip] ...
JAVA_HOME=/usr/lib/jvm/java-1.6.0
... [snip] ...
Running /home/crawl/nutch/runtime/local/bin/nutch crawl /home/crawl/urls -solr http://localhost:8080/solr -d /home/crawl/nutch-crawl/crawl/crawldb/current/part-00000 -threads 1 -depth 1
crawl started in: crawl-20120216133832
... continue success stdout output
Finally to the question: Aside from having to set the environment in-line with the system() call, what's the appropriate way to pass an environment var to a IPC::Run3 or a system() call?
(Note: output of %ENV is truncated to only relevant lines... lines like PATH, SHELL, _, etc. not relevant to the question omitted)
In case it's relevant:
-bash-3.2$ uname -a
Linux hostname 2.6.18-238.el5xen #1 SMP Thu Jan 13 16:41:45 EST 2011 x86_64 x86_64 x86_64 GNU/Linux
-bash-3.2$ perl --version
This is perl, v5.8.8 built for x86_64-linux-thread-multi
The root of the problem is that the java process is missing the JAVA_HOME environment variable causing a ClassNotFoundException.
REVISED
That is not the root of the problem. In fact, Java itself does not require JAVA_HOME to be set.
The immediate cause of the problem is one of the following:
The wrapper is not setting the classpath correctly for the application that you are trying to execute.
The wrapper using the wrong class name. The class name "nutch" is unusual and suspicious - there's no package name.
It seems likely that the real root cause is that you are assembling the argument list incorrectly. Each of those arguments with a space inside them should really be two arguments; i.e.
my #nutch_command = ("$Config{nutch_binary}",
"crawl", "$Config{nutch_seed_dir}",
"-solr", "$Config{solr_url}",
"-d", "$Config{nutch_crawl_dir}",
"-threads", "1",
"-depth", "1");
I suspect that this has confused the nutch wrapper script, and caused it to use the wrong classname (among other things). When you pass the entire command as one string and let the shell parse it, the problem (naturally) goes away.
I have the zend javabridge working. Now I want to call a .jar file myWebTest.jar with an class of the same name. Then i want to call a function testWeb which returns a hello world string.
This in on 32bit Win 7 professional system
I added myWebTest.jar to the classpath located in /zend/zendserver/etc/java_bridge_server.ini:
[JAVA_BRIDGE_SERVER]
CLASSPATH="C:\Program Files\Zend\ZendServer\bin\javamw.jar;C:\Program Files\Zend\ZendServer\bin\myWebTest.jar;."
This path is correct.
I have restarted zend server and the code I am trying is:
$jObj = new Java("myWebTest");
// Print date through the object
print $jObj->testWeb("jim");
The log:
1 {main}
thrown in C:\Program Files\Zend\Apache2\htdocs\javaObject.php on line 4
[08-Dec-2011 11:44:48] PHP Fatal error: Call to a member function testWeb() on a non-object in C:\Program Files\Zend\Apache2\htdocs\javaObject.php on line 6
[08-Dec-2011 11:45:51] PHP Fatal error: Uncaught exception 'JavaException' with message 'Java Exception java.lang.ClassNotFoundException: myWebTest
java.lang.ClassNotFoundException: myWebTest
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
in C:\Program Files\Zend\Apache2\htdocs\javaObject.php:4
Stack trace:
#0 C:\Program Files\Zend\Apache2\htdocs\javaObject.php(4): *No Class!*->jbridge('myWebTest')
#1 {main}
thrown in C:\Program Files\Zend\Apache2\htdocs\javaObject.php on line 4
I can't find a how to on this anywhere. TIA Jim
From the documentation of Java
object java(string $class_name [ , ... ])
Parameters
class_name: Class name to create
...: Additional arguments are treated as constructor parameters
Return Value: The Java object that was created, NULL otherwise
Not to be confused, actually class name needs to be the full qualified Name of the class. As an example, if you have a class as below:
package experiment;
public class Test {
....
}
Here class name is: Test
Fully qualified name: experiment.Test
So to instantiate this class in PHP, you need to write:
$test = new Java("experiment.Test");
Additionally according to your exception log
Java Exception java.lang.ClassNotFoundException: myWebTest
It shows that, it can not find any class named as myWebTest in your class path. Which means either there is no class named myWebTest in the jar file, or jar is not properly loaded.
The argument to Java() is the fully qualified class name of the class you want to access, not the name of the jar file. For example the php java bridge docs say,
java("java.lang.Long")->MAX_VALUE
This access the class Long, in the package java.lang
There is some info on java packages and class names here.