I am using ESAPI to encode the string, when using with Oracle JDBC. I Get following error even though i have ESAPI.Properties in my project.
final var queryString =
String.format("SELECT * FROM %1$s WHERE %2$s = '%3$s'",
ESAPI.encoder().encodeForSQL(new OracleCodec(),tableName),
ESAPI.encoder().encodeForSQL(new OracleCodec(),columnName),
ESAPI.encoder().encodeForSQL(new OracleCodec(),columnValue));
Caused by: java.lang.ClassNotFoundException: org.owasp.encoder.esapi.ESAPIEncoder
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:375)
at org.owasp.esapi.util.ObjFactory.loadClassByStringName(ObjFactory.java:158)
at org.owasp.esapi.util.ObjFactory.make(ObjFactory.java:81)
... 108 common frames omitted
Here is my project structure.
Version:
implementation 'org.owasp.esapi:esapi:2.2.1.1'
here is my ESAPI.properties file
# Properties based on ESAPI 2.2.1.1's configuration/esapi/ESAPI.properties file.
ESAPI.Encoder=org.owasp.encoder.esapi.ESAPIEncoder
# Log4JFactory Requires log4j.xml or log4j.properties in classpath - http://www.laliluna.de/log4j-tutorial.html
# Note that this is now considered deprecated!
#ESAPI.Logger=org.owasp.esapi.logging.log4j.Log4JLogFactory
# To use JUL, you need to obtain ESAPI's esapi-java-logging.properties and drop
# it somewhere into your class path. You can get it from the ESAPI configuration
# jar. (See Release 2.2.1.1 under GitHub for ESAPI/esapi-java-legacy.)
ESAPI.Logger=org.owasp.esapi.logging.java.JavaLogFactory
# To use the new SLF4J logger in ESAPI (see GitHub issue #129), set
#ESAPI.Logger=org.owasp.esapi.logging.slf4j.Slf4JLogFactory
# and do whatever other normal SLF4J configuration that you normally would do for your application.
# Note: The uncommented out ones are those needed for SLF4J. Others may be
# needed if you change the ESAPI logger.
#===========================================================================
# ESAPI Logging
# Set the application name if these logs are combined with other applications
Logger.ApplicationName=sql-service
# If you use an HTML log viewer that does not properly HTML escape log data, you can set LogEncodingRequired to true
Logger.LogEncodingRequired=false
# Determines whether ESAPI should log the application name. This might be clutter in some single-server/single-app environments.
Logger.LogApplicationName=true
# Determines whether ESAPI should log the server IP and port. This might be clutter in some single-server environments.
Logger.LogServerIP=false
# LogFileName, the name of the logging file. Provide a full directory path (e.g., C:\\ESAPI\\ESAPI_logging_file) if you
# want to place it in a specific directory.
#Logger.LogFileName=ESAPI_logging_file
# MaxLogFileSize, the max size (in bytes) of a single log file before it cuts over to a new one (default is 10,000,000)
#Logger.MaxLogFileSize=10000000
# Determines whether ESAPI should log the user info.
Logger.UserInfo=false
# Determines whether ESAPI should log the session id and client IP
Logger.ClientInfo=false
Any Help would be appreciated.
Related
I have a below text file in String 'str'
# Configuration file for the Jakarta ISAPI Redirector
# The path to the ISAPI Redirector Extension, relative to the website
# This must be in a virtual directory with execute privileges
extension_uri=/jakarta/isapi_redirect.dll
# Full path to the log file for the ISAPI Redirector
log_file=C:\\\\Programs\\\\Org\\\\Pro\\\\Client\\\\apache-tomcat-8.0.33\\\\logs\\\\isapi_redirect.log
# Log level (debug, info, warn, error or trace)
log_level=info
# Full path to the workers.properties file
worker_file=C:\\\\Programs\\\\Org\\\\Pro\\\\Client\\\\apache-tomcat-8.0.33\\\\conf\\\\workers.properties
# Full path to the uriworkermap.properties file
worker_mount_file=C:\\\\Programs\\\\Org\\\\Pro\\\\Client\\\\apache-tomcat-8.0.33\\\\conf\\\\uriworkermap.properties
and i want to replace all occurrences of
C:\\\\Programs\\\\Org\\\\Pro\\\\Client\\\\apache-tomcat-8.0.33
with
C:\\\\Program Files\\\\Apache Software Foundation\\\\Tomcat 9.0
so that my final 'str' looks like below
# Configuration file for the Jakarta ISAPI Redirector
# The path to the ISAPI Redirector Extension, relative to the website
# This must be in a virtual directory with execute privileges
extension_uri=/jakarta/isapi_redirect.dll
# Full path to the log file for the ISAPI Redirector
log_file=C:\\\\Program Files\\\\Apache Software Foundation\\\\Tomcat 9.0\\\\logs\\\\isapi_redirect.log
# Log level (debug, info, warn, error or trace)
log_level=info
# Full path to the workers.properties file
worker_file=C:\\\\Program Files\\\\Apache Software Foundation\\\\Tomcat 9.0\\\\conf\\\\workers.properties
# Full path to the uriworkermap.properties file
worker_mount_file=C:\\\\Program Files\\\\Apache Software Foundation\\\\Tomcat 9.0\\\\conf\\\\uriworkermap.properties
Basically i want to replace filepath after '=' till i encounter 'apache'. this 'apache' could sometimes be 'Tomcat' as well
I visited almost every answers/solutions in stackoverflow and tried to tweak them but none of them yield desired output.
I have tried around 8-9 Regex since its too many i didn't post them
"\" is a meta character in Regex which means you should code "\\" , meanwhile "\" needs to be escaped in Java so that If you want to match a "\" character you should code "\\\\".
I am having problems with JanusGraph connecting to Solr: I have the following:
application.java
public static void main(String args[]) {
JanusGraph g = JanusGraphFactory.open("/path/to/file/janusgraph-solr.properties");
GraphOfTheGodsFactory.load(g);
g.close();
}
janushgraph-solr.properties
# Change to the directory where JanusGraph was extracted. Later commands
# use relative paths to the Solr config files shipped with the JanusGraph
# distribution.
cd $JANUSGRAPH_HOME
# The name must be URL safe and should contain one dot/full-stop
# character. The part of the name after the dot must not conflict with
# any of JanusGraph's internal CF names. Starting the part after the dot
# "solr" will avoid a conflict with JanusGraph's internal CF names.
CORE_NAME=testt
# Where to upload collection configuration and send CoreAdmin requests.
SOLR_HOST=localhost:8983
# The value of index.[X].solr.http-urls in JanusGraph's config file
# should match $SOLR_HOST and $CORE_NAME. For example, given the
# $CORE_NAME and $SOLR_HOST values above, JanusGraph's config file would
# contain (assuming "search" is the desired index alias):
#
index.search.solr.http-urls=http://localhost:8983/solr/testt
#
# The stock JanusGraph config file conf/janusgraph-cassandra-solr.properties
# ships with this http-urls value.
storage.backend=cassandrathrift
GraphOfTheGods file: https://github.com/JanusGraph/janusgraph/blob/master/janusgraph-core/src/main/java/org/janusgraph/example/GraphOfTheGodsFactory.java
I get the following error:
Exception in thread "main" java.lang.IllegalArgumentException: Could not instantiate implementation: org.janusgraph.diskstorage.cassandra.thrift.CassandraThriftStoreManager
Caused by: org.janusgraph.diskstorage.TemporaryBackendException: Temporary failure in storage backend
Caused by: java.net.ConnectException: Connection refused (Connection refused)
How do i get rid of storage.backend=cassandrathrift and use solr as the backend? replacing "cassandrathrift" with solr as the document suggests fails for me. This results in the solr class not being found. Any help would be appreciated
Enable thrift server on cassandra
nodetool enablethrift
Change your storage backend configuration from
storage.backend=cassandrathrift
to:
storage.backend=cql
I downloaded neo4j.zip from its site and extract it.
I downloaded and installed jdk 7, I have two folders in :
C:\Program Files\Java\jdk1.7.0_75
and
C:\Program Files\Java\jre7
And I clicked on New and made a variable named JAVA_HOME and its value is
C:\Program Files\Java\jdk1.7.0_75
I have added
org.neo4j.server.startup_timeout=0
line to my neo4j-server.properties file because of timeout error and
I have changed the port number in neo4j-server.properties file from 7474 to 80 and 8085, this is my neo4j-server.properties now:
################################################################
# Neo4j
#
# neo4j-server.properties - runtime operational settings
#
################################################################
#***************************************************************
# Server configuration
#***************************************************************
# location of the database directory
org.neo4j.server.database.location=data/graph.db
# Low-level graph engine tuning file
org.neo4j.server.db.tuning.properties=conf/neo4j.properties
# Database mode
# Allowed values:
# HA - High Availability
# SINGLE - Single mode, default.
# To run in High Availability mode, configure the neo4j.properties config file, then uncomment this line:
#org.neo4j.server.database.mode=HA
# Let the webserver only listen on the specified IP. Default is localhost (only
# accept local connections). Uncomment to allow any connection. Please see the
# security section in the neo4j manual before modifying this.
#org.neo4j.server.webserver.address=0.0.0.0
# Require (or disable the requirement of) auth to access Neo4j
dbms.security.auth_enabled=true
#
# HTTP Connector
#
# http port (for all data, administrative, and UI access)
org.neo4j.server.webserver.port=8085
#
# HTTPS Connector
#
# Turn https-support on/off
org.neo4j.server.webserver.https.enabled=true
# https port (for all data, administrative, and UI access)
org.neo4j.server.webserver.https.port=7473
# Certificate location (auto generated if the file does not exist)
org.neo4j.server.webserver.https.cert.location=conf/ssl/snakeoil.cert
# Private key location (auto generated if the file does not exist)
org.neo4j.server.webserver.https.key.location=conf/ssl/snakeoil.key
# Internally generated keystore (don't try to put your own
# keystore there, it will get deleted when the server starts)
org.neo4j.server.webserver.https.keystore.location=data/keystore
# Comma separated list of JAX-RS packages containing JAX-RS resources, one
# package name for each mountpoint. The listed package names will be loaded
# under the mountpoints specified. Uncomment this line to mount the
# org.neo4j.examples.server.unmanaged.HelloWorldResource.java from
# neo4j-server-examples under /examples/unmanaged, resulting in a final URL of
# http://localhost:7474/examples/unmanaged/helloworld/{nodeId}
#org.neo4j.server.thirdparty_jaxrs_classes=org.neo4j.examples.server.unmanaged=/examples/unmanaged
#*****************************************************************
# HTTP logging configuration
#*****************************************************************
# HTTP logging is disabled. HTTP logging can be enabled by setting this
# property to 'true'.
org.neo4j.server.http.log.enabled=false
# Logging policy file that governs how HTTP log output is presented and
# archived. Note: changing the rollover and retention policy is sensible, but
# changing the output format is less so, since it is configured to use the
# ubiquitous common log format
org.neo4j.server.http.log.config=conf/neo4j-http-logging.xml
#*****************************************************************
# Administration client configuration
#*****************************************************************
# location of the servers round-robin database directory. possible values:
# - absolute path like /var/rrd
# - path relative to the server working directory like data/rrd
# - commented out, will default to the database data directory.
org.neo4j.server.webadmin.rrdb.location=data/rrd
org.neo4j.server.startup_timeout=0
but again when I run Neo4j.bat by double clicking on it, cmd window will open and java window will open and will close after some seconds and cmd window will close after it and
http://localhost:8085/browser/
is unavailable.
This is my error from
C:\Users\Fereshteh\Desktop\neo4j-enterprise-2.2.0-windows\neo4j-enterprise-2.2.0\data\graph.db\messages
2015-04-10 01:56:42.689+0000 ERROR [o.n.s.e.EnterpriseBootstrapper]: Failed to start Neo Server on port [8085]
org.neo4j.server.ServerStartupException: Starting Neo4j Server failed: Wanted record LOG_VERSION, but this record wasn't read since the neostore didn't contain it
at org.neo4j.server.AbstractNeoServer.start(AbstractNeoServer.java:255) ~[neo4j-server-2.2.0.jar:2.2.0]
at org.neo4j.server.Bootstrapper.start(Bootstrapper.java:117) [neo4j-server-2.2.0.jar:2.2.0]
at org.neo4j.server.Bootstrapper.main(Bootstrapper.java:69) [neo4j-server-2.2.0.jar:2.2.0]
Caused by: java.lang.IllegalStateException: Wanted record LOG_VERSION, but this record wasn't read since the neostore didn't contain it
at org.neo4j.kernel.impl.store.record.NeoStoreUtil.getValue(NeoStoreUtil.java:127) ~[neo4j-kernel-2.2.0.jar:2.2.0]
at org.neo4j.kernel.impl.store.record.NeoStoreUtil.getLogVersion(NeoStoreUtil.java:150) ~[neo4j-kernel-2.2.0.jar:2.2.0]
at org.neo4j.kernel.impl.recovery.StoreRecoverer.recoveryNeededAt(StoreRecoverer.java:57) ~[neo4j-kernel-2.2.0.jar:2.2.0]
at org.neo4j.server.preflight.PerformRecoveryIfNecessary.run(PerformRecoveryIfNecessary.java:62) ~[neo4j-server-2.2.0.jar:2.2.0]
at org.neo4j.server.preflight.PreFlightTasks.run(PreFlightTasks.java:71) ~[neo4j-server-2.2.0.jar:2.2.0]
at org.neo4j.server.AbstractNeoServer.runPreflightTasks(AbstractNeoServer.java:387) ~[neo4j-server-2.2.0.jar:2.2.0]
at org.neo4j.server.AbstractNeoServer.start(AbstractNeoServer.java:195) ~[neo4j-server-2.2.0.jar:2.2.0]
And in my C:\Users\Fereshteh\Desktop\neo4j-enterprise-2.2.0-windows\neo4j-enterprise-2.2.0\data\log
I have just README and windows-wrapper.0.0.txt and windows-wrapper.0.0.log.lck
what should I do to be able to run Neo4j and work with it?
I have windows 7 x86
thanks in advance.
I had the same error today. In my case, it was because the files in the database directory were corrupted (I unzipped an existing graph which failed on first try). After I unzipped the existing graph database correctly - and the database files were fine - it worked. So, maybe your database directory is also corrupted.
Move the neo4j folder to another directory -> \Program'thisblankisbad'Files\ <- was the cause for me. I was trying to reinstall the service on Windows with
neo4j install-service
and neo4j threw:
neo4j Error: mainclass org.neo4j.server.startup.Neo4jCommand could not be found or loaded cause: java.lang.ClassNotFoundException: org.neo4j.server.startup.Neo4jCommand
after i moved the neo4j folder to another directory (NO BLANKS!!!) it was fine
windows 10, neo4j v4.4.9
I am trying to implement the example given here: http://benjsicam.me/blog/running-a-java-application-as-a-windows-service-part-1-tutorial/
The code basically turns a Java application into a service. The application outputs Date and Time to the console at specific intervals. The whole project gets exported to a runnable JAR file, with required libraries in a separate folder. All I have to do is modify the wrapper.conf file to run Main.jar (which is the exported JAR) and put the exported libraries in the lib folder.
I have followed everything exactly, but I am getting the following problem: WrapperManager cannot be resolved. I am including the links for snapshots which show the Maven project structure, the contents of POM.xml, and code contents of four Java files. Also included are the required source files in Google Drive.
Java version jdk1.8.0_11
Main.java
Google Drive Link
Error Shown:
Wrapper.conf file (removed most of the comments+top part)
wrapper.java.mainclass=batch_Proc.main_prog.Main
# Java Classpath (include wrapper.jar) Add class path elements as
# needed starting from 1
wrapper.java.classpath.1=../lib/wrapper.jar
wrapper.java.classpath.2=../lib/aopalliance-1.0.jar
wrapper.java.classpath.3=../lib/commons-logging-1.1.1.jar
wrapper.java.classpath.4=../lib/spring-aop-3.2.1.RELEASE.jar
wrapper.java.classpath.5=../lib/spring-beans-3.2.1.RELEASE.jar
wrapper.java.classpath.6=../lib/spring-context-3.2.1.RELEASE.jar
wrapper.java.classpath.7=../lib/spring-context-support-3.2.1.RELEASE.jar
wrapper.java.classpath.8=../lib/spring-core-3.2.1.RELEASE.jar
wrapper.java.classpath.9=../lib/spring-expression-3.2.1.RELEASE.jar
wrapper.java.classpath.10=../lib/spring-web-3.2.1.RELEASE.jar
wrapper.java.classpath.11=../lib/wrappertest.jar
wrapper.java.classpath.12=Main.jar
# Java Library Path (location of Wrapper.DLL or libwrapper.so)
wrapper.java.library.path.1=../lib
# Java Bits. On applicable platforms, tells the JVM to run in 32 or 64-bit mode.
wrapper.java.additional.auto_bits=FALSE
# Java Additional Parameters
wrapper.java.additional.1=
# Initial Java Heap Size (in MB)
#wrapper.java.initmemory=3
# Maximum Java Heap Size (in MB)
#wrapper.java.maxmemory=64
# Application parameters. Add parameters as needed starting from 1
#wrapper.app.parameter.1=
#********************************************************************
# Wrapper Logging Properties
#********************************************************************
# Enables Debug output from the Wrapper.
wrapper.debug=FALSE
# Format of output for the console. (See docs for formats)
wrapper.console.format=PM
# Log Level for console output. (See docs for log levels)
wrapper.console.loglevel=INFO
# Log file to use for wrapper output logging.
wrapper.logfile=../logs/wrapper.log
# Format of output for the log file. (See docs for formats)
wrapper.logfile.format=LPTM
# Log Level for log file output. (See docs for log levels)
wrapper.logfile.loglevel=INFO
# Maximum size that the log file will be allowed to grow to before
# the log is rolled. Size is specified in bytes. The default value
# of 0, disables log rolling. May abbreviate with the 'k' (kb) or
# 'm' (mb) suffix. For example: 10m = 10 megabytes.
wrapper.logfile.maxsize=0
# Maximum number of rolled log files which will be allowed before old
# files are deleted. The default value of 0 implies no limit.
wrapper.logfile.maxfiles=0
# Log Level for sys/event log output. (See docs for log levels)
wrapper.syslog.loglevel=NONE
#********************************************************************
# Wrapper General Properties
#********************************************************************
# Allow for the use of non-contiguous numbered properties
wrapper.ignore_sequence_gaps=TRUE
# Do not start if the pid file already exists.
wrapper.pidfile.strict=TRUE
# Title to use when running as a console
wrapper.console.title=Test Wrapper Sample Application
#********************************************************************
# Wrapper JVM Checks
#********************************************************************
# Detect DeadLocked Threads in the JVM. (Requires Standard Edition)
wrapper.check.deadlock=TRUE
wrapper.check.deadlock.interval=10
wrapper.check.deadlock.action=RESTART
wrapper.check.deadlock.output=FULL
# Out Of Memory detection.
# (Ignore output from dumping the configuration to the console. This is only needed by the TestWrapper sample application.)
wrapper.filter.trigger.999=wrapper.filter.trigger.*java.lang.OutOfMemoryError
wrapper.filter.allow_wildcards.999=TRUE
wrapper.filter.action.999=NONE
# Ignore -verbose:class output to avoid false positives.
wrapper.filter.trigger.1000=[Loaded java.lang.OutOfMemoryError
wrapper.filter.action.1000=NONE
# (Simple match)
wrapper.filter.trigger.1001=java.lang.OutOfMemoryError
# (Only match text in stack traces if -XX:+PrintClassHistogram is being used.)
#wrapper.filter.trigger.1001=Exception in thread "*" java.lang.OutOfMemoryError
#wrapper.filter.allow_wildcards.1001=TRUE
wrapper.filter.action.1001=RESTART
wrapper.filter.message.1001=The JVM has run out of memory.
#********************************************************************
# Wrapper Email Notifications. (Requires Professional Edition)
#********************************************************************
# Common Event Email settings.
#wrapper.event.default.email.debug=TRUE
#wrapper.event.default.email.smtp.host=<SMTP_Host>
#wrapper.event.default.email.smtp.port=25
#wrapper.event.default.email.subject=[%WRAPPER_HOSTNAME%:%WRAPPER_NAME%:%WRAPPER_EVENT_NAME%] Event Notification
#wrapper.event.default.email.sender=<Sender email>
#wrapper.event.default.email.recipient=<Recipient email>
# Configure the log attached to event emails.
#wrapper.event.default.email.attach_log=TRUE
#wrapper.event.default.email.maillog.lines=50
#wrapper.event.default.email.maillog.format=LPTM
#wrapper.event.default.email.maillog.loglevel=INFO
# Enable specific event emails.
#wrapper.event.wrapper_start.email=TRUE
#wrapper.event.jvm_prelaunch.email=TRUE
#wrapper.event.jvm_start.email=TRUE
#wrapper.event.jvm_started.email=TRUE
#wrapper.event.jvm_deadlock.email=TRUE
#wrapper.event.jvm_stop.email=TRUE
#wrapper.event.jvm_stopped.email=TRUE
#wrapper.event.jvm_restart.email=TRUE
#wrapper.event.jvm_failed_invocation.email=TRUE
#wrapper.event.jvm_max_failed_invocations.email=TRUE
#wrapper.event.jvm_kill.email=TRUE
#wrapper.event.jvm_killed.email=TRUE
#wrapper.event.jvm_unexpected_exit.email=TRUE
#wrapper.event.wrapper_stop.email=TRUE
# Specify custom mail content
wrapper.event.jvm_restart.email.body=The JVM was restarted.\n\nPlease check on its status.\n
# Name of the service
wrapper.name=JavaWindowsServiceSample
# Display name of the service
wrapper.displayname=Java Windows Service Sample
# Description of the service
wrapper.description=A sample java windows service application
# Service dependencies. Add dependencies as needed starting from 1
wrapper.ntservice.dependency.1=
# Mode in which the service is installed. AUTO_START, DELAY_START or DEMAND_START
wrapper.ntservice.starttype=AUTO_START
# Allow the service to interact with the desktop.
wrapper.ntservice.interactive=false
I solved this problem! I had made a simple mistake of not making sure the correct dependencies were downloaded in Maven.
The required jars for WrapperManager and WrapperListener were not available which were causing the errors.
I'am using debian distribution.I write a code in windows but I have no error and I create a database.Despite I prepare libraries in Debian, my database is not created and data is not added and in java program there was no error.
My Database Path.
dbPath=/var/lib/neo4j/data/graph.db
I guess error occurs about database proporties.
I have 2 different proporties so I don't know how can I set this settings.
-etc/neo4j
-/var/lib/neo4j/conf
You should have the /etc/neo4j/neo4j-server.properties file that typically begins like
################################################################
# Neo4j configuration
#
################################################################
#***************************************************************
# Server configuration
#***************************************************************
# location of the database directory
org.neo4j.server.database.location=data/graph.db
...
...
Where database path is relative.
If you want to have an absolute path, you should have this line:
org.neo4j.server.database.location=/var/lib/neo4j/data/graph.db