2011-10-30 9 views
5

मैंने टॉमकैट के लिए एक ग्रेल्स वेबपैप लिखा जो कि /data/transactions/foobar पर बर्कले डीबी से खुलता है और पढ़ता है।मैं Grails/Tomcat Webapp के लिए वर्तमान कार्य निर्देशिका कैसे प्राप्त करूं?

यह कोड मेरे ग्रहण वातावरण में ठीक है।

लेकिन जब मैं इसे सर्वर पर ले जाता हूं, तो यह इस अपवाद को थकाता है। मुझे यकीन नहीं है कि वर्तमान कार्यशील निर्देशिका कहां है जब मैं सर्वर पर वेबपैस वेब अनुप्रयोग के रूप में एक WAR फ़ाइल में Grails को तैनात करता हूं।

com.sleepycat.je.EnvironmentNotFoundException: (JE 4.1.10) ./data/transactions/Foobar 
Home directory: ./data/transactions/Foobar ENV_NOT_FOUND: 
EnvironmentConfig.setAllowCreate is false so environment creation is not permitted, but there are no log files in the environment directory. Environment is invalid and must be closed. 

लिनक्स सर्वर पर मेरी टॉमकैट इंस्टॉल निर्देशिका/usr/share/tomcat6 है। वेबपैप्स रूट डीआईआर/usr/share/tomcat6/webapps है। हम "निर्देशिका" नामक उपनिर्देशिका में स्थापित WAR निर्देशिका स्थापित है। मेरे Grails ऐप के लिए WAR पथ/usr/share/tomcat6/webapps/पुल

मैंने दोनों/usr/share/tomcat6/webapps और/usr/share/दोनों में ./data/transaction/Foobar डालने का प्रयास किया है। कोई भाग्य के साथ tomcat6/webapps/पुल।

मैंने किसी भी भाग्य के साथ/usr/share/tomcat6 आधार निर्देशिका स्थापित करने में /data/transaction/Foobar डालने का भी प्रयास किया।

Error 500: Executing action [index] of controller[com.ecmhp.ecmdatabridge.generators.GenerateEmiDigestsController] 
caused exception: (JE 4.1.10) ./data/transactions/Foobar 
    Home directory: ./data/transactions/Foobar ENV_NOT_FOUND: 
    EnvironmentConfig.setAllowCreate is false so environment creation is not permitted, but there are no log files in the environment directory. Environment is invalid and must be closed. 

सर्वलेट:

Exception Message: (JE 4.1.10) ./data/transactions/Foobar 
Home directory: ./data/transactions/Foobar ENV_NOT_FOUND: 
EnvironmentConfig.setAllowCreate is false so environment creation is not permitted, but there are no log files in the environment directory. Environment is invalid and must be closed. 

Caused by: (JE 4.1.10) ./data/transactions/Foobar 
    Home directory: ./data/transactions/Foobar ENV_NOT_FOUND: 
    EnvironmentConfig.setAllowCreate is false so environment creation is not permitted, but there are no log files in the environment directory. Environment is invalid and must be closed. 

किसी भी /bridge/grails/generateEmiDigests/index.dispatch: Grails

यूआरआई

निम्न त्रुटियों मैं बिलाव सर्वर से देख रहे हैं विचार करें कि मैं अपने टॉमकैट युद्ध के लिए वर्तमान कार्यशील निर्देशिका कैसे सेट कर सकता हूं ताकि उसे बर्कले डीबी ./data/transaction फाइलें मिलें? या कोई विचार मैं यह पता लगा सकता हूं कि वर्तमान कार्यशील निर्देशिका क्या है मेरी Grails ऐप लॉन्च की गई है?

उत्तर

1

आप grails के लिए कंसोल प्लगइन स्थापित हैं, तो आप सिर्फ

new File('test.html').absolutePath 

हमारे एप्लिकेशन के लिए चला सकते हैं, इस /data/opt/tomcat/5.5/ देता है, इसलिए मुझे लगता है कि आप अपनी निर्देशिका लगाने की जरूरत है usr/share/tomcat6/डेटा/लेनदेन

8

अंदर आप 'grailsApplication' सेम, जो है या Grails ढांचे के विभिन्न भागों में autoinjected जा सकती है, पर भी नियंत्रण प्राप्त कर सकते हैं आप की कोशिश कर सकते हैं:

grailsApplication.mainContext.servletContext.getRealPath('/data/transactions/foobar') 
संबंधित मुद्दे