Exception: com.algodeal.* is not allowed as a package name for strategies
Hi,
I'm suddenly getting this error for a strategy that was running just fine on the server an hour or two ago:
Exception in thread "main" java.lang.IllegalArgumentException:
com.algodeal.* is not allowed as a package name for
strategies
at com.algodeal.marketrunner.runner.compilation.StrategyCompiler.getClassName(StrategyCompiler.java:174)
at com.algodeal.marketrunner.runner.compilation.StrategyCompiler.getStrategySourceFileName(StrategyCompiler.java:183)
at com.algodeal.marketrunner.runner.compilation.StrategyCompiler.writeStrategySource(StrategyCompiler.java:187)
at com.algodeal.marketrunner.runner.compilation.StrategyCompiler.compile(StrategyCompiler.java:70)
at com.algodeal.marketrunner.runner.compilation.StrategyCompiler.compile(StrategyCompiler.java:41)
at com.algodeal.marketrunner.runner.StrategyRemoteRunner.checkStrategyCompiles(StrategyRemoteRunner.java:57)
at com.algodeal.marketrunner.runner.StrategyRemoteRunner.sendStrategyToBackTestServer(StrategyRemoteRunner.java:34)
at com.algodeal.MainStrategyRunner.runRemote(MainStrategyRunner.java:74)
at com.algodeal.MainStrategyRunner.mainNonStatic(MainStrategyRunner.java:172)
at com.algodeal.MainStrategyRunner.modularMain(MainStrategyRunner.java:159)
at com.algodeal.MainStrategyRunner.main(MainStrategyRunner.java:145)
My strategy class is NOT in the package com.algodeal though. It was in the default package, then I moved it to com.eliotstock.algo just in case the error message wasn't right. No joy. Any ideas?
Cheers,
Eliot.
Comments are currently closed for this discussion. You can start a new one.
Support Staff 2 Posted by Eric on 14 May, 2010 07:47 AM
Hi Eliot,
We indeed have code that tries to find the package name used by the class. It is possible that this code has bugs, particularly for code that is unusually formatted.
Could you please paste here the beginning of your source code? For example, down to the first line that declares the class.
Many thanks,
Eric
3 Posted by Eliot Stock on 14 May, 2010 09:21 AM
Hi Eric,
It's happening with two classes. One extends the other. Maybe it's matching on my package name, but then it happened when I had these in the default package too.
package com.eliotstock.algo;
import static com.algodeal.marketData.instruments.Futures.*;
import com.algodeal.marketData.prices.Bar;
import com.algodeal.marketData.prices.impl.BarImpl;
import com.algodeal.marketrunner.indicators.BarSeries;
import com.algodeal.marketrunner.strategies.BarType;
import com.algodeal.marketrunner.strategies.Instruments;
import com.algodeal.marketrunner.strategies.MarketData;
@Instruments(futures = { E_MINI_SP /, FTSE, CAC_40 / }) @MarketData(type = BarType.Minute, start = "2009/01/01", end = "2009/12/31") public class StockSnellingIntradayMultiBar extends StockSnellingIntraday {
...
package com.eliotstock.algo;
import java.awt.Color;
import org.apache.commons.math.stat.descriptive.rank.Max;
import com.algodeal.marketrunner.indicators.SMA;
import com.algodeal.marketrunner.indicators.BarSeries;
import com.algodeal.marketrunner.indicators.StandardDeviation;
import com.algodeal.marketrunner.orders.LimitOrder;
import com.algodeal.marketrunner.orders.StopOrder;
import com.algodeal.marketrunner.recorders.records.IndicatorColorRecord.DrawMode;
import com.algodeal.marketrunner.strategies.AbstractStrategy;
import com.algodeal.marketrunner.strategies.MarketData;
import static com.algodeal.marketData.instruments.Futures.;
import com.algodeal.marketrunner.strategies.BarType;
import com.algodeal.marketData.prices.;
import com.algodeal.marketrunner.strategies.*;
@Instruments(futures = { E_MINI_SP }) @MarketData(type = BarType.Minute, start = "2009/01/01", end = "2009/12/31") public class StockSnellingIntraday extends AbstractStrategy {
...
Cheers,
Eliot
Support Staff 4 Posted by Eric on 14 May, 2010 12:35 PM
hm... this looks good.
Another possibility is that you have another class in your Eclipse project that is placed in the com.algodeal package. You see, when you submit a strategy remotely, it actually bundles all the .java files in your Eclipse project in a zip file and sends the file to our server. If any Java file is in the com.algodeal package, the submission will fail.
Try doing a File Search on the "package com.algodeal" string in your project under Eclipse.
Does that help?
Eric
5 Posted by Eliot Stock on 15 May, 2010 03:26 AM
Thanks Eric. Found it - my fault. I had been extracting the sources from the marketrunner jars in the libs dir to poke around and of course they were being bundled up and pushed to the server.
Eric closed this discussion on 25 May, 2010 01:31 PM.