3

I am trying to run the storm starter project locally. I am following the instructions from-

https://github.com/apache/storm/tree/master/examples/storm-starter

but when I try to execute the storm jar command, I get

ERROR StatusLogger Invalid URL C:/Users/xyzabc/apache-storm-0.10.0-beta/log4j2/cluster.xml java.net.MalformedURLException: unknown protocol: c

I think it has something to do with the following piece defined in the cluster.xml and worker.xml

 <RollingFile name="METRICS"
                 fileName="${sys:storm.log.dir}/metrics.log"
                 filePattern="${sys:storm.log.dir}/metrics.log.%i">

so apparently the filename needs to be like

file:///C:/Users/xyzabc/apache-storm-0.10.0-beta/log4j2/cluster.xml

but when I try to do that by setting

<RollingFile name="METRICS"
                     fileName="file:///${sys:storm.log.dir}/metrics.log"
                     filePattern="file:///${sys:storm.log.dir}/metrics.log.%i">

I get this error

ERROR Unable to create file file:///C:\Users\xyzabc\apache-storm-0.10.0-beta\logs/metrics.log java.io.IOException: The filename, directory name, or volume label syntax is incorrect

as you can see, it totally messes up the filepath somehow.

is there a way that i can properly render "file:///" in the xml property ?

Aditi Parikh
  • 1,522
  • 3
  • 13
  • 34
AbtPst
  • 7,778
  • 17
  • 91
  • 172
  • Which topology of storm-started do you try to run? Do you really need to specify the prefix `file://` (btw: it should be only two slashes, not three) Furthermore, I am wondering (but I am no window user) why you use slashed and not backslashes? – Matthias J. Sax Sep 06 '15 at 14:27
  • Did my solution help you? – Razvan Manolescu Dec 22 '15 at 14:15

4 Answers4

2

Remove all the changes from \log4j2\worker.xml and \log4j2\cluster.xml.

Edit \bin\storm-config.cmd and modify below specified entries.

From

set STORM_LOGBACK_CONFIGURATION_FILE=%STORM_LOGBACK_CONFIGURATION_DIR%\cluster.xml

To

set STORM_LOGBACK_CONFIGURATION_FILE=file://%STORM_LOGBACK_CONFIGURATION_DIR%\cluster.xml

From

set STORM_LOGBACK_CONFIGURATION_FILE=%STORM_HOME%\log4j2\cluster.xml

To

set STORM_LOGBACK_CONFIGURATION_FILE=file://%STORM_HOME%\log4j2\cluster.xml

This addition of file:// on logback configuration entries in storm-config.cmd help to resolve the issue.

1

According to the Microsoft naming conventions, you should be using only backslashes on the path, but instead you have back-slashes and front-slashes.

file:///C:\Users\xyzabc\apache-storm-0.10.0-beta\logs/metrics.log

And there is more:

Note File I/O functions in the Windows API convert "/" to "\" as part of converting the name to an NT-style name, except when using the "\?\" prefix as detailed in the following sections.

For file I/O, the "\?\" prefix to a path string tells the Windows APIs to disable all string parsing and to send the string that follows it straight to the file system. For example, if the file system supports large paths and file names, you can exceed the MAX_PATH limits that are otherwise enforced by the Windows APIs. For more information about the normal maximum path limitation, see the previous section Maximum Path Length Limitation.

SQL.injection
  • 2,607
  • 5
  • 20
  • 37
0

Same problem, bro
But, after this error:

storm\bin>ERROR StatusLogger Invalid URL D:/stuff/storm/log4j2/cluster.xml java.net.MalformedURLException: unknown protocol: d

If you open java processes, you'll see, that all works:
screenshot

0

I had the same issue, I edited storm-config.cmd and added the protocol to the URL env vars:

if not %STORM_LOGBACK_CONFIGURATION_DIR% == nil (
    set STORM_LOGBACK_CONFIGURATION_FILE=file://%STORM_LOGBACK_CONFIGURATION_DIR%\cluster.xml
) 

if not defined STORM_LOGBACK_CONFIGURATION_FILE (
  set STORM_LOGBACK_CONFIGURATION_FILE=file://%STORM_HOME%\log4j2\cluster.xml
)

I believe you are getting the "Unable to create file" issue because it's expecting a path, not a URL. Try to revert these changes and see if it works.

Razvan Manolescu
  • 414
  • 2
  • 10
  • Those lines are already present in storm-config.cmd. They need to be modified in the storm-config.cmd by adding "file://" prefix, rather than in storm.cmd. – VladH Feb 21 '17 at 19:45