Re: Jasic install help?

Vic Cekvenic <[email protected]> Wed, 01 Oct 2003 03:15:53 -0400
Newsgroups gmane.comp.java.mvc.devel
Organization baseBeans Engineering
Message-ID <[email protected]>
Here are the install notes from the Docs folder:


One way to say the goal is: =93Use Struts, Tomcat and SQL to replace=20
Apache for content=94.

basicPortal is an example of the code needed on 80% of all web projects,=20
implemented using the best practices and design available.  It has=20
sample beans, Struts Actions, and DAOs that can be used and extended by=20
developers.  It also contains samples XML files with settings for Struts=20
Menus, Validators, and Tiles so that these files do not have to be=20
written from scratch.  basicPortal is currently running on=20
http://www.basebeans.com.

basicPortal has a content management system (CMS), allowing=20
administrators to add text or HTML content through an easy web=20
interface.  All pages are stored in the system database.  The top=20
picture above illustrates the form where an administrator can edit the=20
home page.

Notice that each web page has an identifying tag such as HOME or ABOUT.=20
  The bottom picture above shows how any page can be displayed easily by=20
passing basicPortal an HTTP parameter such as content=3DABOUT.

Users can register to become members of the site, and administrators can=20
edit their information and privileges.
BasicPortal CMS (Content Management System) is dynamic and stored in SQL=20
and just as fast as hard to manage HTML.
The other is: =93A large % of code on a project is common=94.  Things lik=
e=20
J2EEuser authentication, displaying home page, approving content, user=20
sign in etc. That part is common, and we can then just write the parts=20
that are unique to our project.
Also, there is integration of Struts with an application server and IDE=20
and connection pools to SQL. BasicPortal provides those. It comes with a=20
DAO DB layer and configured application server for connections. We all=20
need reporting, so it comes with working and configured Jasper Reports.=20
We all like rich client user interface, so it comes with open source=20
implementation of Flash ActionScript forms. Etc.

  So this project is to leverage several of the Apache Foundation=92s=20
Jakarta projects into a vertical application suite that:
-	is simple (follows the =93KISS=94 principle); the platform will remain =
as=20
simple as possible while still being a database driven high performance=20
web application suitable for very large sites
- 	is easy to learn and teach
-	demonstrates accepted best practices in Java software design, such as=20
J2EE container managed security, JavaBeans, JavaServer Pages (JSP), the=20
Model-View-Controller paradigm (MVC/Struts), data access objects (DAO),=20
the JSP Standard Tag Library (JSTL), caching, etc.
-	demonstrates accepted best practices in web GUI development using=20
standards such as CSS, Struts Tiles and Layouts
-	works on multiple application servers (Tomcat, Resin, Orion, etc.)
-	works on multiple SQL database servers (PostgreSQL, MySQL, Oracle, etc.=
)
-	does multi-row updates and =93CRUD=94 (database creation, reading,=20
updating, and deletion)
-	contains the functionality common to 80% of web projects, and gives=20
developers the ability to customize the platform for their specific needs
-	enables very high developer productivity.  Experienced coders should=20
be able to produce at least two or three modules per day.
-	Open Source means:
o	No contracts or cost of ownership
o	Enables transfer of software budget to other vital resources
o	Freedom from closed, proprietary systems and upgrade fees
o	Competitive support - anyone who knows Struts and JSTL can provide supp=
ort
o	Community development - added features from other companies and volunte=
ers
The aim is to provide many of the features found in modern web community=20
and portal systems including news, forums, calendars, web logs=20
(=93blogs=94), wikis, ecommerce, and email support.  It will eventually=20
provide automatic generation of GUI elements such as tabs and image=20
buttons.  Additional technical goals include support for large binary=20
objects (BLOBs), integration with iReport/JasperReports, automated=20
stress testing, and automated code generation.
basicPortal, the main software component of the system, is targeted at=20
technical project leads of corporate application development,=20
demonstrating the simplicity of using Struts to build a data driven=20
application.  A content management system with sample HTML and XML data=20
is included for users to build upon.  The system contains member sign up=20
and administration facilities.  Its design is based on Struts, JSTL, and=20
JavaBeans that contain DAO helper classes.  basicPortal is packaged with=20
the iBatis SQL database layer for object-relational mapping, but any=20
custom DAO can be implemented by making use of an interface.


THE JASIC DISTRIBUTION

The Jasic distribution is a complete development suite.  It includes=20
basicPortal with the required Java framework classes such as Struts and=20
JDBC preconfigured.  Also included are the following third-party=20
programs, but you can use any J2EE and SQL DB:

-	JRockit 8.1 Java Virtual Machine (VM) from BEA Systems or JDK1.4 from=20
IBM or Sun
-	Resin 3  App Server or Tomcat 5 or any JSP 2.0 container
-	Eclipse  3 IDE with SolarEclipse web applications plug-in
-	PostgreSQL 7.4 database
-	pgAdmin II database tool (Windows only)
- 	iReport visual report designer (Windows only)


Variations on this platform are possible.  The Java Development Kits=20
(JDKs) from Sun and IBM can be used instead of JRockit, as long as the=20
JDK 1.4+ compatible versions are used.  basicPortal has been tested with=20
Resin, Tomcat, and Orion, but other J2EE application servers compatible=20
with JDK 1.4 and JSP 1.2/2.0 can be used.  baseBeans recommends the use=20
of Eclipse with the SolarEclipse plug-in as an IDE, however others such=20
as IntelliJ can be used.

PostgreSQL is the recommended database, but any SQL DB would do.

A database administration interface such as pgAdmin II for PostgreSQL is=20
recommended.  SQuirreL is another good tool that works with various=20
databases such as PostgreSQL, Oracle, and MySQL.

Developers are encouraged to make platform choices that best suit their=20
needs and the culture of their organizations.  However, developers=20
should keep in mind that variations on the platform will require extra=20
configuration to ensure all pieces work together.  Also, some=20
development procedures may vary from those specified in other=20
basicPortal documentation if customizations are made.

The Jasic distribution for Windows 2000 can be downloaded in one zipped=20
file from SourceForge.
Liunx works great and is the ideal platfrom. At this time, users of=20
Linux and other Unix-type systems must CVS source, download, install,=20
and configure all components separately.


For all the platfroms, the latest downloads that you need are on the=20
baseBeans.com downloads page.
First, create a directory such as C:\jasic or D:\jasic.  It is good=20
practice to keep the entire platform in one directory tree.  This makes=20
the system easy to backup and restore, and makes it easy for developers=20
to duplicate the setup on development computers.

Downloading the Jasic distribution (for all users):

 From http://www.sourceforge.net/projects/basicportal, download the=20
latest Jasic distribution.  The filename will be of the form=20
jasicxxx.zip.  Unzip the downloaded file into your \jasic directory.

AFTER DOWNLOADING

It is recommended that you download and install a Netscape=20
(www.netscape.com) or Mozilla (www.mozilla.org) browser.  Some tags that=20
work in Internet Explorer may not work in other browsers, so it is best=20
to test on a variety of platforms.

To minimize the possibility of conflicts, make sure that there is only=20
one Java Development Kit on your server.  This can be done in the=20
Control Panel -> Add/Remove Programs interface and by searching for=20
files such as javac.exe outside of the Jasic directory.  The Java=20
Virtual Machine that comes bundled with Windows should not cause a proble=
m.

Next, put the Java directories in your system variables.  If JRockit=20
will be your JDK, go into the Control Panel -> System -> Advanced ->=20
Environment Variables section and make the following changes:

JAVA_HOME should be C:\jasic\jrockit81

PATH should be %JAVA_HOME%\bin;%SystemRoot%\system32;%SystemRoot%

Note: A frequent error in configuration is not seting the one system=20
evntioment path to %JAVA_HOME%\bin;%SystemRoot%\system32;%SystemRoot%.

If you installed Jasic on a drive other than C:, replace C:\ with the=20
proper drive designation for your system.

Bring up a command prompt by running the program command.com (in Start=20
-> Run).  Issue the command:

C:\>java -version
java version "1.4.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1)
BEA WebLogic JRockit(R) Virtual Machine (Native Threads, Generational=20
Concurrent Garbage Collector)


If the outcome of the command is consistent with the JDK you have=20
selected for development, you can proceed to the next steps.

For any component installation question, you can refer to cheat sheet on=20
baseBeans.com Cheat Sheet page.
INSTALLING AND CONFIGURING THE DATABASE

You must have some SQL engine to create the tables on, since data is=20
stored in a SQL DB.

To install the bundled PostgreSQL software, first run the PostgreSQL=20
Windows installer in \jasic\pgSQL.  Then run the pgAdmin II installer in=20
the same directory.  Accept most defaults in the process, other than the=20
installation directories, which can be set to \jasic\PostgreSQL and=20
\jasic\pgAdmin2.

Once the database programs are installed, make sure the PostgreSQL=20
service is started in
Control Panel -> Administrative Tools -> Services.  Then run pgAdmin II=20
from the Windows Start menu.  Click the icon in the upper left corner to=20
connect to the database.  Click OK at the next dialog box to connect as=20
the default superuser named postgres; you may connect with no password=20
from the local computer.

Under Users in the left panel object tree, right-click on postgres and=20
select Change Properties.  Give this user a new password for increased=20
security.

Next, select (right-click) localhost -> Create Object -> User.  Create a=20
new user called bpuser.  Give this user a secure password, and grant the=20
user the ability to create new databases.  Take note of the user=92s=20
expiration date and set it far into the future if desired.

Exit pgAdmin II and reconnect as bpuser.  Select (right-click) localhost=20
-> Create Object -> Database.  Create a database called basicportal (no=20
data entry other than the database name is required in the dialog box).=20
  It is a good idea to use all lower case names in PostgreSQL.

You will now have to run some prewritten SQL scripts to create the=20
tables for use with basicPortal and some sample table data.  These=20
scripts are located in \jasic\bp\WEB-INF\doco.  Under Databases in the=20
left panel object tree, select (right-click) basicportal -> SQL.  Select=20
Load, navigate to the file \jasic\bp\
WEB-INF\doco\table_create.sql, then select Open and Execute.  The=20
basicPortal tables should then be created.  Repeat this step for the=20
file \jasic\bp\WEB-INF\doco\table_sample_data.sql.

Table data can be viewed and edited by right-clicking on the table name=20
and selecting View Data.  If you will be writing additional modules for=20
basicPortal, you should familiarize yourself with these tables.  The=20
table usr contains user information and passwords, and is used to=20
implement logins and security.  The table content is used to enable=20
content management, and contains web page data.

For information on how to manipulate these tables by hand, please see=20
the documentation for PostgreSQL (www.postgresql.org) and pgAdmin II=20
(pgadmin.postgresql.org).

Note: You can save yourself time by testing a JDBC connection via=20
something like http://squirrel-sql.sourceforge.net

STARTING THE APPLICATION SERVER

After database installation, the system is ready to be activated.  All=20
other Jasic components are preconfigured for easy use.

If you installed Jasic on a drive other than C:, edit the file=20
\jasic\resin-3\conf\resin.conf.  Change the drive letter in the=20
following line:

<web-app id=3D'/' app-dir=3D'c:\jasic\bp'>

Also, change the db connection settings.

   <init-param=20
url=3D"jdbc:postgresql://localhost:5432/basicportal?autoReconnect=3Dtrue"=
/>
   <init-param user=3D"bpuser"/>
   <init-param password=3D"changeme"/>

Same is true of other app. servers. There is a sample for Tomcat and Resi=
n


Next, start Resin by running the file \jasic\resin-3\bin\httpd.exe.  A=20
terminal window will appear, and Resin should report that it is started=20
and listening.

In your web browser, navigate to http://127.0.0.1/test.  This will test=20
the database connection, and should display the contents of one user=20
object and one content object.  Then navigate to http://127.0.0.1.  A=20
sample basicPortal web site should appear.  basicPortal is now installed=20
and running!

You need to customize the content and user rights, but that is easy.

If you are configuring your own container, make sure JDBC driver is in=20
commons/lib.


Ex: JDBC Realm setting

       <Realm  className=3D"org.apache.catalina.realm.JDBCRealm" debug=3D=
"99"
              driverName=3D"org.postgresql.Driver"
           connectionURL=3D"jdbc:postgresql://localhost:5432/
					basicportal?autoReconnect=3Dtrue"
	  connectionName=3D"bpuser" connectionPassword=3D"changeme"
	  userTable=3D"usr" userNameCol=3D"real_email_id" userCredCol=3D"passwrd=
"
           userRoleTable=3D"usr" roleNameCol=3D"role_code" />

Ex: App. Context setting

<<Context path=3D"" docBase=3D"c:/jasic/bPproj/bP"
	debug=3D"0"
	reloadable=3D"true" crossContext=3D"true">

<Resource name=3D"bppool" auth=3D"Container" type=3D"javax.sql.DataSource=
"/>
<ResourceParams name=3D"bppool">

<parameter><name>url</name>
	<value>jdbc:postgresql://localhost:5432/basicportal?autoReconnect=3Dtrue=
</value> </parameter>
<parameter><name>driverClassName</name>
	<value>org.postgresql.Driver</value> </parameter>
<parameter><name>maxIdle</name>
	<value>3</value></parameter>
<parameter><name>username</name>
	<value>bpuser</value>     </parameter>
<parameter> <name>maxWait</name>
         <value>5000</value>      </parameter>
<parameter><name>maxActive</name>
         <value>10</value>    </parameter>
<parameter><name>password</name>        <value>changeme</value>
       </parameter>
<parameter> <name>removeAbandoned</name>
         <value>true</value>  </parameter>
<parameter>  <name>removeAbandonedTimeout</name>
          <value>20</value></parameter>

</ResourceParams>
</Context>

In the case of Tomcat, you will also need to copy the dbcp and=20
commons-jar to common/lib, so that the connection pool will work in Tomca=
t.





hth,
.V

Aaron Goldstein wrote:
> I downloaded and installed jasic 0.9.8.5.  I followed the configuration=
=20
> instructions but when I try to access the application at:
>=20
> http://127.0.0.1:8080/test
>=20
> =20
>=20
> I receive the following error from Resin:
>=20
>=20
>   500 Servlet Exception
>=20
> WEB-INF/web.xml:21: `com.bP.cms.coreBeans.TestServlet' must have a publ=
ic,
>=20
> zero arg constructor.  Servlets must have public zero-arg constructors.
>=20
> =20
>=20
> I haven=92t altered the web.xml that came with the application at all a=
nd=20
> I am running this JVM:
>=20
> java version "1.4.1_03"
>=20
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_03-b02)
>=20
> Java HotSpot(TM) Client VM (build 1.4.1_03-b02, mixed mode)
>=20
> =20
>=20
> Any help is appreciated.  Thanks.
>=20
> =20
>=20
> Aaron
>=20