Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cake script not valid #54

Closed
sakulstra opened this issue Aug 31, 2013 · 20 comments
Closed

cake script not valid #54

sakulstra opened this issue Aug 31, 2013 · 20 comments
Assignees
Milestone

Comments

@sakulstra
Copy link

Hay there,
i've some similar Problem like this:
#32

we've setup our dev-server with this file structure:
/var/www/cakeroot
/var/www/app1
/var/www/app2
...

so, when we try to create an php project with existing sources we have to set our path for apps with this configuration:
app Project path: "/"
Cakephp directory: "../cakeroot"

-> when i do this the cake symbol appears at the project in sidebar like it should
but when trying to "generate code"
Warning: Project's Cake script is not valid.(Cake script must be selected.)
Error: Cake script must be selected.
appears.

Using:
cakephp 2.3.10
netbeans 7.3.1

Thank you,
Lukas

@junichi11
Copy link
Owner

Hi Lukas,

Could you try to check whether your_app/Console/cake.php exists?

Thanks,
Junichi

@sakulstra
Copy link
Author

Hay Junichi,
yeah cake.php exists and when i navigate to
/var/www/app1/Console and use ./cake bake via console everything works fine

Thank you for your help,
Lukas

@junichi11
Copy link
Owner

Hi Lukas,

I see. Your directory structure is not what I assumed...

I assumed following directory structure:
/var/www/cakeroot/app1
/var/www/cakeroot/app2
...

So, plugin is looking at not /var/www/app1/ but /var/www/cakeroot/app1/.

I'll improve configurations for project properties as enhancement.(next or later)

Thanks,
Junichi

@junichi11
Copy link
Owner

@sakulstra
I improved configurations for project properties.
Could you try to test it?

Please set app directory path from project directory to project properties.
If your app directory is project directory, please set "." to it.

nbm for testing

https://bitbucket.org/junichi11/cakephp-netbeans/downloads
(org-cakephp-netbeans-0.9.3.1-for-testing-issue54.nbm)

@sakulstra
Copy link
Author

Hello Junichi,
i tried your fix and the error disappeared - but the run command wont work.

I already tested, if it's cause my cakeversion, but when i:

  1. create a fresh cakeinstallation(2.3.10) with your plugin (for example: /var/www/cakephp
  2. create a project(with bake project) in absolute path /var/www/projectname
  3. set up a netbeans project with existing sources in /var/www/projectname
    i can reproduce this error.

My settings for this setup:
app: .
cakephp dir: ./../cakephp

Thanks,
Lukas

@junichi11
Copy link
Owner

Hello Lukas,

I run your steps but I can't reproduce it.
/path/to/projects/cake2.3.10 (cake)
/path/to/projects/mycakeproject (bake project)

Perhaps, Warning means that Console/cake.php doesn't exist, but I'm not sure this cause...
Could you look at the IDE log? (then can you found the following warning? : "Not found cake" )

Thanks,
Junichi

cakeissue54-1
cakeissue54-2
cakeissue54-3

@junichi11
Copy link
Owner

Hi Lukas,

but the run command wont work.

What does mean this?

  • Is a error message shown?
  • Isn't command list shown?

Please also check the following:
Tools > Options > PHP > General > PHP 5 interpreter path.

Thanks,
Junichi

@sakulstra
Copy link
Author

screenshot from 2013-09-05 12 13 27

It means there is no error message shown, but no commands are listed.
The Interpreter Path should is okay.

Thanks,
Lukas

@junichi11
Copy link
Owner

I see. Probably, I guess that you don't set timezone in php.ini. (or you can set it to app/Config/core.php)
Please try to check it ;)

Thanks,
Junichi

@sakulstra
Copy link
Author

Hay,
I've set date_default_timezone_set('UTC'); in my core.php (and restarted netbeans)

The error is the same:
[Fatal Error] nb-cake-commands-6936403090534023092.xml:1:1: Content ist nicht zulässig in Prolog.
INFO [org.cakephp.netbeans.commands.CakeScript]
org.xml.sax.SAXParseException; systemId: file:/tmp/nb-cake-commands-6936403090534023092.xml; lineNumber: 1; columnNumber: 1; Content ist nicht zulässig in Prolog.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:251)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:300)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:205)
at org.cakephp.netbeans.commands.CakePhpCommandXmlParser.parse(CakePhpCommandXmlParser.java:75)
[catch] at org.cakephp.netbeans.commands.CakeScript.getFrameworkCommandsInternalXml(CakeScript.java:280)
at org.cakephp.netbeans.commands.CakeScript.getCommands(CakeScript.java:189)
at org.cakephp.netbeans.commands.CakePhpCommandSupport.getFrameworkCommandsInternal(CakePhpCommandSupport.java:99)
at org.netbeans.modules.php.spi.framework.commands.FrameworkCommandSupport.refreshFrameworkCommands(FrameworkCommandSupport.java:150)
at org.netbeans.modules.php.spi.framework.commands.FrameworkCommandSupport$1.run(FrameworkCommandSupport.java:181)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1432)
at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2044)
CONFIG [null]: Parse error in file file:/tmp/nb-cake-commands-6936403090534023092.xml line 1 column 1 (PUBLIC null)
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: /home/lukas/www/zentraldatei took: 14.337 ms (New or modified files: 0, Deleted files: 0) [Adding listeners took: 4.327 ms]
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: /home/lukas/netbeans-7.3.1/ide/jsstubs/corestubs.zip took: 135 ms (New or modified files: 0, Deleted files: 0) [Adding listeners took: 0 ms]
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: /home/lukas/netbeans-7.3.1/ide/jsstubs/domstubs.zip took: 306 ms (New or modified files: 0, Deleted files: 0) [Adding listeners took: 0 ms]
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Complete indexing of 7 source roots took: 19.724 ms (New or modified files: 1, Deleted files: 0) [Adding listeners took: 4.752 ms]
[Fatal Error] nb-cake-commands-4898623596705042836.xml:1:1: Content ist nicht zulässig in Prolog.
INFO [org.cakephp.netbeans.commands.CakeScript]
org.xml.sax.SAXParseException; systemId: file:/tmp/nb-cake-commands-4898623596705042836.xml; lineNumber: 1; columnNumber: 1; Content ist nicht zulässig in Prolog.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:251)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:300)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:205)
at org.cakephp.netbeans.commands.CakePhpCommandXmlParser.parse(CakePhpCommandXmlParser.java:75)
[catch] at org.cakephp.netbeans.commands.CakeScript.getFrameworkCommandsInternalXml(CakeScript.java:280)
at org.cakephp.netbeans.commands.CakeScript.getCommands(CakeScript.java:189)
at org.cakephp.netbeans.commands.CakePhpCommandSupport.getFrameworkCommandsInternal(CakePhpCommandSupport.java:99)
at org.netbeans.modules.php.spi.framework.commands.FrameworkCommandSupport.refreshFrameworkCommands(FrameworkCommandSupport.java:150)
at org.netbeans.modules.php.spi.framework.commands.FrameworkCommandSupport$1.run(FrameworkCommandSupport.java:181)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1432)
at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2044)
CONFIG [null]: Parse error in file file:/tmp/nb-cake-commands-4898623596705042836.xml line 1 column 1 (PUBLIC null)
[Fatal Error] nb-cake-commands-2511325152904729753.xml:1:1: Content ist nicht zulässig in Prolog.
INFO [org.cakephp.netbeans.commands.CakeScript]
org.xml.sax.SAXParseException; systemId: file:/tmp/nb-cake-commands-2511325152904729753.xml; lineNumber: 1; columnNumber: 1; Content ist nicht zulässig in Prolog.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:251)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:300)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:205)
at org.cakephp.netbeans.commands.CakePhpCommandXmlParser.parse(CakePhpCommandXmlParser.java:75)
[catch] at org.cakephp.netbeans.commands.CakeScript.getFrameworkCommandsInternalXml(CakeScript.java:280)
at org.cakephp.netbeans.commands.CakeScript.getCommands(CakeScript.java:189)
at org.cakephp.netbeans.commands.CakePhpCommandSupport.getFrameworkCommandsInternal(CakePhpCommandSupport.java:99)
at org.netbeans.modules.php.spi.framework.commands.FrameworkCommandSupport.refreshFrameworkCommands(FrameworkCommandSupport.java:150)
at org.netbeans.modules.php.spi.framework.commands.FrameworkCommandSupport$1.run(FrameworkCommandSupport.java:181)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1432)
at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2044)
CONFIG [null]: Parse error in file file:/tmp/nb-cake-commands-2511325152904729753.xml line 1 column 1 (PUBLIC null)
log4j:WARN No appenders could be found for logger (nu.validator.source.LocationRecorder).
log4j:WARN Please initialize the log4j system properly.
INFO [org.netbeans.modules.parsing.impl.TaskProcessor]: Task: class org.netbeans.modules.csl.hints.GsfHintsProvider ignored cancel for 4.799 ms.

@junichi11
Copy link
Owner

Please try to run the following command with CLI (not plugin):
cake command_list --xml

@sakulstra
Copy link
Author

cd /home/lukas/www/disposim/Console && ./cake command_list --xml
screenshot from 2013-09-05 12 51 00

@junichi11
Copy link
Owner

Umm, usually, we can get result like this :
mycakeproject$ Console/cake command_list --xml

<?xml version="1.0"?>
<shells><shell name="acl" call_as="acl" provider="CORE" help="acl -h"/><shell name="api" call_as="api" provider="CORE" help="api -h"/><shell name="bake" call_as="bake" provider="CORE" help="bake -h"/><shell name="command_list" call_as="command_list" provider="CORE" help="command_list -h"/><shell name="console" call_as="console" provider="CORE" help="console -h"/><shell name="i18n" call_as="i18n" provider="CORE" help="i18n -h"/><shell name="schema" call_as="schema" provider="CORE" help="schema -h"/><shell name="server" call_as="server" provider="CORE" help="server -h"/><shell name="test" call_as="test" provider="CORE" help="test -h"/><shell name="testsuite" call_as="testsuite" provider="CORE" help="testsuite -h"/><shell name="upgrade" call_as="upgrade" provider="CORE" help="upgrade -h"/></shells>

If there are no xml elements, this is CakePHP's problem. But I also used the same as your version...
We can't run command if they doesn't exist because plugin is using that xml data.

@junichi11
Copy link
Owner

File encoding of your cake project is UTF-8, isn't it?
If it is UTF-8 with BOM, the above error will be shown.

@sakulstra
Copy link
Author

Hay,
like you can see in the picture above i get exactly the output you got, too

<?xml version="1.0"?>
<shells><shell name="acl" call_as="acl" provider="CORE" help="acl -h"/><shell name="api" call_as="api" provider="CORE" help="api -h"/><shell name="bake" call_as="bake" provider="CORE" help="bake -h"/><shell name="command_list" call_as="command_list" provider="CORE" help="command_list -h"/><shell name="console" call_as="console" provider="CORE" help="console -h"/><shell name="i18n" call_as="i18n" provider="CORE" help="i18n -h"/><shell name="schema" call_as="schema" provider="CORE" help="schema -h"/><shell name="server" call_as="server" provider="CORE" help="server -h"/><shell name="test" call_as="test" provider="CORE" help="test -h"/><shell name="testsuite" call_as="testsuite" provider="CORE" help="testsuite -h"/><shell name="upgrade" call_as="upgrade" provider="CORE" help="upgrade -h"/></shells>

properties-> encoding is set to utf-8

@junichi11
Copy link
Owner

properties-> encoding is set to utf-8

It's not this. Please check with other editor or terminal.

e.g.
vim some.php
: set bomb?
bomb or nobomb is shown.

@sakulstra
Copy link
Author

i checked /Console/cake.php -> nobomb

@junichi11
Copy link
Owner

Thanks for checking it!

[Fatal Error] nb-cake-commands-6936403090534023092.xml:1:1: Content ist nicht zulässig in Prolog.
INFO [org.cakephp.netbeans.commands.CakeScript]
org.xml.sax.SAXParseException; systemId: file:/tmp/nb-cake-commands-6936403090534023092.xml; lineNumber: 1; columnNumber: 1; Content ist nicht zulässig in Prolog.

I think that xml file created by plugin has problem.
But I'm not sure the cause yet...

Can you run command with /path/to/cakephp project? (i.e. project created by you with plugin at first)

@sakulstra
Copy link
Author

ahrg ... sorry
everything works perfect
i found out, what produces this problem - i don't know why, but your plugin needs the permission to write in /cakeroot/app/tmp - per default the owner for this directory is www-data ...the console itself don't needs that permission
Thank you,
Lukas

@junichi11
Copy link
Owner

Okay 👍

Thanks,
Junichi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants