NexJ Studio Tutorial Problems

From CDOT Wiki
Jump to: navigation, search
Important.png
This page may be obsolete.
It contains historical information.

Introduction to NexJ Express Studio

Problem 1

User root is not recognized,or message likes "Can't find any matching row in the user table"

Solution: Use other account that has sufficient privileges to the new created databases.

Problem 2

Cannot deploy on server, get Error Message: Unknown component "HTTPServer.WSRP" in repository "Training 101".

Solution: Use new version core model and new Eclipse plugin.

Problem 3

It only upgrade the database correctly, but it doesn't upgrade the dump file.

When run recreate, I get error message Error: Version mismatch: dump version http:// www.nexj.com/ns/gwtsample-login#1.15, metadata version http:// www.nexj.com/ns/gwtsample-login#1.16

Solution: Publish a model before create any class, and Upgrade UnitTest dump before upgrade the database.


Summer 2011

Problem 4

Null pointer exception when creating a new class (P. 19) Null pointers randomly throughout use of IDE

Nexjproblem5.png

Solution: Revert to NexJ Core 7.x.x and do not use 7.1.0 (known issue from previous versions)

Problem 5

Non-matching core files

Solution: Latest versions of NexJ Studio Plugin have Optional JBoss libraries built in. Do not replace with other versions.

Problem 6

Error with Model Browser in Eclipse

Nexjcoreblock.png

Solution: File is "blocked" on Windows 7. Right click on file and click "unblock"

Problem 7

Problem upgrading database

Solution: nexj user not created yet. Create nexj user in mysql database with the appropriate commands. Grant privileges to the nexj user

CREATE USER 'nexj@localhost' IDENTIFIED BY 'nexj';
GRANT CREATE, INSERT, DELETE, UPDATE, SELECT on train101.* to nexj@localhost WITH GRANT OPTION
GRANT CREATE, INSERT, DELETE, UPDATE, SELECT on unittest.* to nexj@localhost WITH GRANT OPTION

Check with SHOW DATABASES and SHOW TABLES that appropriate tables and databases have been created

Problem 8

"Extra character found after the s-expression (scheme syntax error)"

(define e (Person'new (: firstName "Len") (: lastName "Chan"))) (define tp (read-instance TelcomType '() '(= name "Business") '())) (define telcom (Email'new (: entity e) (: type tp) (: name (tp'name)) (: address "len@nexj.com") (: displayName "Len Chan"))) (commit)

Unresolved

Fundamentals 103 Integration 20110506 PDF

Steps before beginning

1. Do this PDF only after finishing "Introduction to NexJ Express Studio" PDF

2. Start with a new workspace if you run into issues (I started with a new one to begin with)

3. Run the following SQL in MySQL after you have created the model :

Createmodel.png

CREATE DATABASE [deploymentdbname]
CREATE DATABASE [unittestdbname]

GRANT ALL ON [deploymentdbname].* TO nexj@localhost WITH GRANT OPTION
GRANT ALL ON [unittestdbname].* TO nexj@localhost WITH GRANT OPTION

4. Create the SQL script to create all the tables from Database Schema Tool (the icon two icons to the right of the schema icon, use drop down arrow) and run it with

USE [deploymentdbname] SOURCE [pathtosqlscript]

5. Because the PDF is designed for NexJ Studio Enterprise, you cannot use the "Finance" model to start. Instead, follow these instructions before starting Chapter 1 (Emailed from Greg Fenton) :

Attached, find the PDF for “NexJ Studio Training – Integration Fundamentals” course. This course is geared towards our Enterprise platform, but it can be used with the Express platform with just a couple of changes:

1. Create an Address class with attributes:

· street – string

· city – string, required

2. Create a Person class in the business model layer that has attributes:

· firstName – string

· lastName – string, required

· address – Address, collection

3. In the Address class, go to Persistence Mapping and:

· Set the Data Source to “DefaultRelationalDatabase”

· Set the Primary Table to “Address”

· Set the Key Generator to “KeyGenerator.GUID”

· Click “Select Attribute Mappings…”, then “Add All”, then “OK”

· Click “Update Data Source…”, then “OK”

4. In the Person class, go to Persistence Mapping and:

· Set the Data Source to “DefaultRelationalDatabase”

· Set the Primary Table to “Person”

· Set the Key Generator to “KeyGenerator.GUID”

· Click “Select Attribute Mappings…”, then “Add All”, then “OK”

· Click “Update Data Source…”, then “OK”

5. In the previous two steps, you ended up adding two new tags to the source of the DefaultRelationalDatabase. You now need to add those same two tables as steps to an upgrade in Main.upgrade: · Open Persistence >> Upgrades >> Main.upgrade · Scroll to the bottom of the Upgrades list (top of the editor on the Overview tab) and click the Add (+) button >> RelationalDatabaseUpgrade · Double click the Version column of the new upgrade and set a new version (if the previous version is “1.19”, then make this new step “2.19” where the first number is the version of your model and everything after the first dot (“.”) is the version of the base model) · In the Upgrade Steps, click the Add (+) button >> Table Upgrade Step >> Create Table · Now you can manually enter the information for the Person table (same definition as in the DefaultRelationalDatabase) and then a new Create Table for the Address table. However, this is error prone. The easier and much faster way is to copy the table definitions from the DefaultRelationalDatabase to the Main.upgrade and tweak the XML. Here’s how: i. Open Persistence >> Data Sources >> DefaultRelationalDatabase ii. Click the Source tab at the bottom of the editor iii. Scroll to the bottom of the XML and look for the last two
tags. They should be for name=”Person” and name=”Address”. Highlight all of the lines from the first
tag to the last
tag, then copy to your clipboard.

iv. Return to Main.upgrade


v. Click the Source tab


vi. Scroll to the bottom of the XML and look for the last <CreateTable/> tag, highlight and delete that tag.


vii. Where that tag was, paste the contents of your clipboard (the two tags). viii. For the XML you just pasted in, find the “
” and “
”, and replace them with “<CreateTable>” and “</CreateTable>”, respectively.


ix. Save all files. Validate the model.

6. You can now create a new (or upgrade an existing) database. Now you can create Person and Address instances and persist them to the database.

With those two classes being persistable you should be able to work through chapters 1 to 6 using the Core model (not the Finance model). The last two chapters assume you have the full NexJ enterprise application model (though you could probably rework most of chapter 8 to work with the Person class created above instead of the Entity class from Finance chapter 8 is a cool lab!).

REMEMBER TO UPGRADE YOUR DUMP FILE THEN PUBLISH BEFORE YOU DO ANYTHING ELSE. IF YOU GET AN ERROR DO NOT PROCEED AS YOU WILL NOT BE ABLE TO PUBLISH OR DUMP AND MAY ENTER A CIRCULAR LOOP.

Problem 1 : Grant denied when updating dump files

GRANT denied when updating dump files

Solution: use WITH GRANT OPTION when granting privileges to nexj user. See above for SQL

Problem 2 : User denied when trying to run Scheme console

User denied when trying to run Scheme console

Solution: nexj user does not exist in njusers table. So, use data load tool to RECREATE information (drop, create, load)