7

I am using ExtJS 4.1 and I am deploying my simple HelloExt program on GlassFish V3.1.

I am trying to create a build from Sencha SDK.

I have used the following two commands...

C:\>sencha create jsb -a http://localhost:8080/HelloExt/index.jsp -p appname.jsb
3 -v


C:\>sencha build -p appname.jsb3 -v -d .

As per the documentation, it will create app-all.js file. But where does it create the file?

How can I know IF build are created successfully or not?

Where are the generated JS files?

I made a search but I can not found anything like app-all.js.

For more information:

I am using JDK 1.6.0_12 and GlassFish V3.1 application server.

Here are the edited content of the question ....

And when I am trying to use the sencha SDK, It generates a .dpf file into the class path. The contents of the .dpf file as as below ...

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app error-url="">
  <context-root>/HelloExt</context-root>
  <class-loader delegate="true"/>
  <jsp-config>
    <property name="keepgenerated" value="true">
      <description>Keep a copy of the generated servlet class' java code.</description>
    </property>
  </jsp-config>
</glassfish-web-app>

Can anyone tell me Why here it generated .DPF file ? Why its not generating the app-all.js file ?

Gunjan Shah
  • 5,088
  • 16
  • 53
  • 72

1 Answers1

6

Try running the command from inside the app root directory and then using a relative path:

0) open cmd window

1) run in cmd window: "cd C:\[webserver_webapp_root]\[app_name]"

In other words change the cmd directory to the app root. Fill in the bracketed text above with the correct paths.

2) run in cmd window: "sencha create jsb -a index.html -p app.jsb3 -v"

The app.jsb3 should be created in your app's root directory (C:\[webserver_webapp_root]\[app_name]). Open it up and make sure it contains all of your app classes, it should look something like this:

{
    "projectName": "Project Name",
    "licenseText": "Copyright(c) 2012 Company Name",
    "builds": [
        {
            "name": "All Classes",
            "target": "all-classes.js",
            "options": {
                "debug": true
            },
            "files": [
                {
                    "clsName": "YourApp.view.Viewport",
                    "name": "Viewport.js",
                    "path": "app/view/"
                },
                // plus ALOT more classes...
            ]
        },
        {
            "name": "Application - Production",
            "target": "app-all.js",
            "compress": true,
            "files": [
                {
                    "path": "",
                    "name": "all-classes.js"
                },
                {
                    "path": "",
                    "name": "app.js"
                }
            ]
        }
    ],
    "resources": []
}

If everything looks fine then you can go onto the next step, if not then there is something wrong with your app directory structure and you need to fix it per Sencha recommended ExtJS application architecture.

You can also use any error messages to help identify the problem.

3) update placeholders ("Project Name", etc) at the top of app.jsb3

4) run in cmd window: "sencha build -p app.jsb3 -d . -v"

The app-all.js file should also be created in the app's root directory. If the cmd window doesn't give any errors before it says "Done Building!" then you are all done. You can now change your index.html script link to point to app-all.js instead of app.js.

If there are errors then you have to fix those and run this again.

Other things you can try:

In response to your last comment, your -p switch parameter should be a jsb3 file not jsb.

Make sure that the web server is running and that your app runs without any errors before you try to use the SDK Tools.

Then try these:

C:\Projects\HelloExt\build\web>sencha create jsb -a index.jsp -p HelloExt.jsb3 -v

C:\Projects\HelloExt>sencha create jsb -a index.jsp -p HelloExt.jsb3 -v

C:\>sencha create jsb -a [actual IP address]:8080/HelloExt/index.jsp -p HelloExt.jsb3 -v

Fill in your actual IP address where the brackets are (not localhost).

This should produce the jsb3 file shown in #2 above then you can move on to step #3 above.

egerardus
  • 11,316
  • 12
  • 80
  • 123
  • Dear Geronimo, Thanks for the reply.. I tested it as you mentioned ..But its not working..I have used the following command.. C:\Projects\HelloExt>sencha create jsb -a index.jsp -p app.jsb3 -v ..There is no error but the js file is not generated.. after that I used ..C:\Projects\HelloExt>sencha create jsb -a web/index.jsp -p app.jsb3 -v..The same case .there is not error ..but JS not generated..After that I provided deployment path ..C:\Projects\HelloExt>sencha create jsb -a http://localhost:8080/HelloExt/index.j but it also not wokring.. – Gunjan Shah Sep 06 '12 at 06:49
  • @GunjanShah Your `c:\Projects` seems like a strange webapp root directory. I am not that familiar with GlassFish and I imagine you can configure it to run your webapps out of anywhere but I am sure that it is not the default. Is your GlassFish web server actually running the apps from `c:\Projects` or are they served from another location? Also are you sure that the SDK Tools were installed correctly, you can test that if you just open a command prompt and type "sencha" - you should see a bunch of the commands when you do that. – egerardus Sep 06 '12 at 15:30
  • @GunjanShah I've been looking around, you should be able to find the path to the webapp in glassfish if you open `glassfish/domains/domain1/config/domain.xml`, what is the `location` attribute of your HelloExt app? – egerardus Sep 06 '12 at 15:40
  • Dear Geronimo, Here is the class path from domain.xml file ............location="file:/C:/Projects/HelloExt/build/web/" – Gunjan Shah Sep 07 '12 at 19:29
  • I checked sencha command in my Command Prompt.. In first trial it says that .. Can not find command ../command/sencha.js ... But in the second trial it works fine .. In second trial it gives USAGE patterns of Sencha command. So i think Sench SDK is installed properly – Gunjan Shah Sep 07 '12 at 19:31
  • I tried the following commands C:\Projects\HelloExt\build\web>sencha create jsb -a http://localhost:8080/HelloE xt/index.jsp -p HelloExt.jsb C:\Projects\HelloExt\build\web>sencha create jsb -a http://localhost:8080/HelloE xt/index.jsp -p HelloExt.jsb -v C:\Projects\HelloExt\build\web>sencha jsb -a http://localhost:8080/HelloExt/inde x.jsp -p HelloExt.jsb -v But It did not generate the JS file in Projects/build/HelloExt/WEb folder. – Gunjan Shah Sep 07 '12 at 19:46
  • Please see `other things you can try` in my answer above. – egerardus Sep 09 '12 at 01:24
  • Dear Geronimo, Thanks for the reply. I tries the above mentioned three steps. But bed luck JSBe file not generated. I think there are some other problems with my Sencha SDK installation. In my command prompt, when I enter "sencha" command first time .. It says command not found and when I enter the command second time, It founds the command and provides How to use command details. So I think there are some problems with the command and installation. – Gunjan Shah Sep 10 '12 at 18:10
  • Dear Geronimo, It seems that it generated .dpf file When I fire the first command that you have provided. You can see above my edited question – Gunjan Shah Sep 10 '12 at 18:30
  • It seems that there are more than one JAVA class path in my command.So had created issue. It works fine now. – Gunjan Shah Dec 21 '12 at 06:38
  • @GunjanShah Thanks for coming back to this and posting your resolution. – egerardus Dec 21 '12 at 16:14