2012-02-03 129 views
0

我有一个Java应用程序我试图开始使用YAJSW。这只是一个简单的“Hello World”应用程序,我按照指示在这里:http://yajsw.sourceforge.net/#mozTocId527639与公共静态类YAJSW错误

我也做了以下内容:

  • 出口我的项目从Eclipse作为一个可运行的JAR文件。

  • 我跑genconfig - 没有问题

  • 我editted wrapper.conf并添加jar文件

  • 跑runConsole.bat的位置,我得到这个错误:

    java.lang.IllegalAccessException: class org.rzo.yajsw.app.WrapperJVMMain can not access a member of class xxxx with modifiers "public static"

它引用的类是主类,它必须是公共静态的。我卡住了!任何人都有建议吗?

+0

能否请您上传它运行为您服务的hello world代码,我想看看它是如何工作...或者你能回答我关于yajsw问题...谢谢 – Wearybands 2013-02-27 12:45:42

+0

我已经从使用上移这并找到了另一个解决方案祝你好运。 – Patrick 2013-02-27 14:03:13

回答

2

我有同样的问题,(运行yajsw稳定-11.0的Java 1.6.0_30-b12的,Win XP的临至五2002 SP3):

INFO|wrapper|Service socket-proxy|12-04-11 11:48:32|init 
INFO|wrapper|Service socket-proxy|12-04-11 11:48:32|ahessian jmx service bound to port 15002 
INFO|wrapper|Service socket-proxy|12-04-11 11:48:32|set state IDLE->STARTING 
INFO|wrapper|Service socket-proxy|12-04-11 11:48:32|Win service: before service init 
INFO|wrapper|Service socket-proxy|12-04-11 11:48:32|starting Process 
INFO|wrapper|Service socket-proxy|12-04-11 11:48:32|Controller State: UNKNOWN -> WAITING 
INFO|wrapper|Service socket-proxy|12-04-11 11:48:32|+ ServiceMain callback 
INFO|wrapper|Service socket-proxy|12-04-11 11:48:32|reporting status 0 
INFO|wrapper|Service socket-proxy|12-04-11 11:48:32|reporting status 0 
INFO|wrapper|Service socket-proxy|12-04-11 11:48:32|onstart 
INFO|wrapper|Service socket-proxy|12-04-11 11:48:32|working dir C:\dev\workspaceTax\socket-proxy 
INFO|wrapper|Service socket-proxy|12-04-11 11:48:32|create script: scripts/trayMessage.gv 
INFO|wrapper|Service socket-proxy|12-04-11 11:48:33|found script scripts/trayMessage.gv 
INFO|wrapper|Service socket-proxy|12-04-11 11:48:33|spawning wrapped process 
INFO|wrapper|Service socket-proxy|12-04-11 11:48:33|started process with pid 3720 
INFO|wrapper|Service socket-proxy|12-04-11 11:48:33|waiting for termination of process 
INFO|wrapper|Service socket-proxy|12-04-11 11:48:33|set state STARTING->RUNNING 
INFO|3720/0|Service socket-proxy|12-04-11 11:48:33|[INFO] DefaultFileReplicator - Using "C:\WINDOWS\TEMP\vfs_cache" as temporary files store. 
INFO|3720/0|Service socket-proxy|12-04-11 11:48:33|java.lang.IllegalAccessException: Class org.rzo.yajsw.app.WrapperJVMMain can not access a member of class [...].socketproxy.Proxy with modifiers "public static" 
INFO|wrapper|Service socket-proxy|12-04-11 11:48:33|Trigger found: Exception 
INFO|3720/0|Service socket-proxy|12-04-11 11:48:33| at sun.reflect.Reflection.ensureMemberAccess(Unknown Source) 
INFO|wrapper|Service socket-proxy|12-04-11 11:48:33|start script scripts/trayMessage.gv 
INFO|3720/0|Service socket-proxy|12-04-11 11:48:33| at java.lang.reflect.Method.invoke(Unknown Source) 
INFO|3720/0|Service socket-proxy|12-04-11 11:48:33| at org.rzo.yajsw.app.WrapperJVMMain.executeMain(WrapperJVMMain.java:53) 
INFO|3720/0|Service socket-proxy|12-04-11 11:48:33| at org.rzo.yajsw.app.WrapperJVMMain.main(WrapperJVMMain.java:36) 
INFO|wrapper|Service socket-proxy|12-04-11 11:48:33|end script scripts/trayMessage.gv 
INFO|3720/0|Service socket-proxy|12-04-11 11:48:34|process terminated 
INFO|3720/0|Service socket-proxy|12-04-11 11:48:34|Controller State: WAITING -> PROCESS_KILLED 
INFO|wrapper|Service socket-proxy|12-04-11 11:48:34|restart process due to default exit code rule 

在我的情况下,类包含静态公共主方法没有被公开,所以它是默认的package-private。

class Proxy { 
... 
    public static void main(String args[]) throws IOException{ 
     ... 
     } 
} 

包私有类的公共方法不属于一个不同包的类可见,所以这是我的情况的问题。例如参见https://stackoverflow.com/questions/5260467/public-methods-in-package-private-classes

public class Proxy { 
... 
    public static void main(String args[]) throws IOException{ 
     ... 
     } 
} 

声明类公开如上解决了我的问题。也许你可以发布一些关于整个问题的更多细节,有人会发布一个解决方案。 问候 -gf