You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Søren Krogh Neigaard <So...@systematic.com> on 2010/03/04 16:00:53 UTC

classnotfounderror when running as service?

Hi

I am installing my service with this command:

prunsrv.exe //IS//SESThesaurusImporter --Install=%path_to_base_dir%\bin\ prunsrv.exe --Description="My Service" --Classpath=%path_to_base_dir%\lib\jms-1.1.jar;%path_to_base_dir%\lib\my-service.jar;%path_to_base_dir%\lib\log4j-1.2.15.jar;%path_to_base_dir%\lib\wlfullclient-10.3.jar;%path_to_base_dir%\config --StartMode=jvm --StartClass=com.myservice.MyService --StartMethod=startService --StartParams=%path_to_base_dir% --StopMode=jvm --StopClass= com.myservice.MyService --StopMethod=stopService --StopParams=stop --LogPath=%path_to_base_dir%\logs --StdOutput=auto --StdError=auto --Startup auto --JavaHome %java_home%

Whenever I start my service, I get the following error:

javax.naming.NoInitialContextException: Cannot instantiate class: weblogic.jndi.WLInitialContextFactory [Root exception is java.lang.ClassNotFoundException: weblogic/jndi/WLInitialContextFactory]
                             at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
                             at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
                             at javax.naming.InitialContext.init(Unknown Source)
                             at javax.naming.InitialContext.<init>(Unknown Source)
                             at com.systematic.ins.sesthesaurusimporter.jms.impl.JMSQueueReceiverImpl.getInitialContext(JMSQueueReceiverImpl.java:58)
                             at com.systematic.ins.sesthesaurusimporter.jms.impl.JMSQueueReceiverImpl.<init>(JMSQueueReceiverImpl.java:30)
                             at com.systematic.ins.sesthesaurusimporter.SESThesaurusImporter.getJMSQueueReceiver(SESThesaurusImporter.java:139)
                             at com.systematic.ins.sesthesaurusimporter.SESThesaurusImporter.getXMLMessages(SESThesaurusImporter.java:145)
                             at com.systematic.ins.sesthesaurusimporter.SESThesaurusImporter.startImporter(SESThesaurusImporter.java:100)
                             at com.systematic.ins.sesthesaurusimporter.SESThesaurusImporter.start(SESThesaurusImporter.java:86)
                             at com.systematic.ins.sesthesaurusimporter.SESThesaurusImporter.startService(SESThesaurusImporter.java:57)
Caused by: java.lang.ClassNotFoundException: weblogic/jndi/WLInitialContextFactory
                             at java.lang.Class.forName0(Native Method)
                             at java.lang.Class.forName(Unknown Source)
                             at com.sun.naming.internal.VersionHelper12.loadClass(Unknown Source)
                             ... 11 more

The weblogic.jndi.WLInitialContextFactory class is in the wlfullclient-10.3.jar, and if I do a Class.forName("weblogic.jndi.WLInitialContextFactory") I get no errors.

I then try and run this via the commandprompt and via a main method, and then it all works just fine. I also tried to do a System.out.println(System.getProperty("java.class.path")); both when running as service and when running from the command prompt. And it gives me the exact same classpath.

Any ideas what the hell is wrong here?

Med venlig hilsen / Kind regards 
Søren Krogh Neigaard


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org