adobe flashplayer does not work on centos based on virtualbox

July 10th, 2010

Flashplayer does not work in firefox. I have installed the player a few times but I could not make it work.

SOLUTION:

1.find flashplayer plugin

rpm -ql flash-plugin | grep libflash

2.link plugin to firefox

cd /usr/lib/mozilla/plugins-wrapped

ln -s /usr/lib/flash-plugin/libflashplayer.so /usr/lib/mozilla/plugins-wrapped/

3.restart firefox

Netbeans 6.5.1. installation on Windows 7

June 14th, 2010

1.run command prompt as administrator to avoid folders read-only problem

2.

netbeans-6.5.1-ml-java-windows.exe –extract

java -jar bundle.jar

How to use datepicker in struts 1

February 22nd, 2010

I spend a lot of time to find out the solution how to use datepicker in struts 1. I spend a lot of hours googling around but I did not find any useful information. I have already decided to move to struts 2 where a datepicker functionality is a very simple task. Fortunatelly I found the solution at the end.

SOLUTION:
I am using Struts 1.3.8. The Struts tag has no name attribute although the javascript needs the attribute name as the first parameter.

<html:text name="StrutsForm" property="formattedDate" size="11" maxlength="11"></html:text>
<script language="JavaScript">
new tcal ({
// form name
'formname': 'StrutsForm',
// input name
'controlname': 'formattedDate'
});
</script>

Exception in thread “Thread-6″ java.lang.NoClassDefFoundError: org/codehaus/groovy/control/CompilationFailedException

November 29th, 2009

I am using netbeans and iReport 3.6.0. The reports are working fine running from iReport preview but I got an error when I tried to launch the report from the application:

Exception in thread "Thread-6" java.lang.NoClassDefFoundError: org/codehaus/groovy/control/CompilationFailedException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)

SOLUTION 1:
Open jrxml file and remove language=”groovy”

SOLUTION 2:
Add groovy-all-1.5.5.jar to your library path

org.apache.jasper.JasperException: dataGrid According to TLD or attribute directive in tag file, attribute items does not accept any expressions

November 24th, 2009

I was searching for a free library to present data in html table. I am using Netbeans 6.5.1. I found out a nice example descriping the way to present data from the database table to the html table. Please check out
http://www.roseindia.net/jsp/data-grid.shtml.

Problem:

I got the following error when I tried to launch the example:
org.apache.jasper.JasperException: /data_grid.jsp(119,8) PWC6236: According to TLD or attribute directive in tag file, attribute items does not accept any expressions

The error occured at <ui:dataGrid items=”${employees}” var=”employee” name=”datagrid1″ cellPadding=”0″. I spent a few hours before I found out the solution at .

SOLUTION:
Netbeans uses servlet 2.5. in web.xml. Modify web.xml from servlet 2.5. to 2.2.
Modify:
<web-app version=”2.5″ xmlns=”http://java.sun.com/xml/ns/javaee” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=”http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd”>
to:
<web-app version=”2.2″ xmlns=”http://java.sun.com/xml/ns/javaee” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=”http://java.sun.com/xml/ns/javaee http://java.sun.com/j2ee/dtds/web-app_2_2.dtd”

SEVERE: StandardServer.await: create[8005]: java.net.BindException: Address already in use: JVM_Bind

October 22nd, 2009

I got the following error when I try to start tomcat:

SEVERE: StandardServer.await: create[8005]:
java.net.BindException: Address already in use: JVM_Bind
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:365)
at java.net.ServerSocket.bind(ServerSocket.java:319)
at java.net.ServerSocket.<init>(ServerSocket.java:185)
at org.apache.catalina.core.StandardServer.await(StandardServer.java:363)
at org.apache.catalina.startup.Catalina.await(Catalina.java:616)
at org.apache.catalina.startup.Catalina.start(Catalina.java:576)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)

I am also running Netbeans and Glassfish at the same time.

First I tried to modify default tomcat port:

Modify C:\Program Files\Apache Software Foundation\Tomcat 5.5\conf\server.xml

It did not help. I found using netstat -abv command also gives you a detailed list of programs using ports. Note: this command takes a long time.

I have found occupied ports and modified them.

<Server port="8098" shutdown="SHUTDOWN">
<Connector port="8099" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" />
<Connector port="8097"
enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />

Problems with java ee tutorial 5

September 20th, 2009

Below is a list of problems that I faced while I was testing java EE tutorial 5. I have found some solutions using google, and some of then by myself.

Problem 1:

Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.1 (Build b60e-fcs (12/23/2008))): oracle.toplink.essentials.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because: java.net.ConnectException : Error connecting to server localhost on port 1527 with message Connection refused: connect.
Error Code: 0
Call: SQLCall(SELECT BOOKID, PRICE, DESCRIPTION, FIRSTNAME, TITLE, CALENDAR_YEAR, SURNAME, INVENTORY, ONSALE FROM WEB_BOOKSTORE_BOOKS WHERE (BOOKID = ?))
Query: ReadObjectQuery(com.sun.bookstore.database.Book)

What I have done: Modify C:\Temp\javaee-5-doc-tutorial-1.0_05\javaeetutorial5\examples\bp-project\app-server.properties. I modified javaee.home value from c:\\glassfish-v3 to C:\\Program Files\\glassfish-v2.1.

cd C:\Temp\javaee-5-doc-tutorial-1.0_05\javaeetutorial5\examples\web\bookstore1

ant create-tables

You will also need to ensure that the passwordfile is present and contains AS_ADMIN_PASSWORD.

Create C:/Temp/javaee-5-doc-tutorial-1.0_05/javaeetutorial5/examples/bp-project/password.txt and add the following line into a password.txt file:

AS_ADMIN_PASSWORD=adminadmin

Modify C:\Temp\javaee-5-doc-tutorial-1.0_05\javaeetutorial5\examples\bp-project\app-server.properties

javaee.server.passwordfile=C:\\Temp\\javaee-5-doc-tutorial-1.0_05\\javaeetutorial5\\examples\\bp-project\\password.txt

Define JAVA_HOME

Solution: Copy C:\Temp\javaee-5-doc-tutorial-1.0_05\javaeetutorial5\examples\bp-project\build.properties.sample to C:\Temp\javaee-5-doc-tutorial-1.0_05\javaeetutorial5\examples\bp-project\build.properties

Modify:

javaee.tutorial.home=C:\\Temp\\javaee-5-doc-tutorial-1.0_05\\javaeetutorial5

javaee.home=C:\\Program Files\\glassfish-v2.1

cd C:\Temp\javaee-5-doc-tutorial-1.0_05\javaeetutorial5\examples\web\bookstore1

ant create-tables

Problem 2: I got the following error when I tried to run bookstore1 example

package javax.persistence does not exist

The problem occured because bookstore1 example is using library from bookstore/dist/bookstore.jar. The bookstore.jar does not exists when the bookstore1 example is used the first time. Right click on the project bookstore1 and select “Open Required Projects”. Read more at:
http://www.mail-archive.com/java-ee-j2ee-programming-with-passion@googlegroups.com/msg00651.html

Problem 3: I could not create database tables from the example.
C:\Temp\javaee-5-doc-tutorial-1.0_05\javaeetutorial5\examples\web\bookstore1>ant  create-tables
Buildfile: build.xml
-pre-init:
init:
check:
tools:
start-db:
BUILD FAILED
C:\Temp\javaee-5-doc-tutorial-1.0_05\javaeetutorial5\examples\bp-project\app-ser
ver-ant.xml:142: Execute failed: java.io.IOException: Cannot run program “\bin\a
sadmin.bat”: CreateProcess error=3, Path not found

SOLUTION: Modify ..\javaeetutorial5\examples\bp-project\build.properties
Define path for parameter javaee.home (javaee.home=C:/Program Files/glassfish-v3-prelude)

GWT basics

July 31st, 2009

Create project:
webAppCreator -out Calculator com.javanus.gwtip.calculator.client.Calculator

Run hosted version:
ant hosted

Running web mode:
ant build
launch application html

 Make a war file:
jar cfM myapp.war .\war\*

javax.servlet.ServletException: Cannot create JDBC driver of class ” for connect URL ‘null’

July 28th, 2009

I found out a great article about connection pooling. I decided to try an example from the article. I have created a new web project and added the files from an example (DBCPoolingListener, CourseEnrollmentServlet). I also added listener DBCPoolingListener and resource-ref to web.xml.

<listener>
<description>ServletContextListener</description>
<listener-class>test.DBCPoolingListener</listener-class>
</listener>
<!-- This component has a dependency on an external resource-->
<resource-ref>
<description> DB Connection Pooling</description>
<res-ref-name>jdbc/TestDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>

I have created a datasource with Tomcat Web Server Administration Tool to use a connection pooling. I tried to launch an application with http://localhost:8080/ConnectionPooling/Testni?pool=yes but the error javax.servlet.ServletException: Cannot create JDBC driver of class ” for connect URL ‘null’ appeared.

The solution:
Use also context.xml file
<Context antiJARLocking="true"
path="/ConnectionPooling">
<!-- set the JNDI Datasource -->
<Resource name="jdbc/TestDB1"
auth="Container"
type="javax.sql.DataSource"
maxActive="4"
maxIdle="10"
maxWait="5000"
username="username"
password="password"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/db"/>
</Context>

The requested resource (/admin/) is not available

July 28th, 2009

I have successfully instaled Apache Tomcat. I also installed an admin package by the following way:

1.copy apache-tomcat-5.5.27\conf\Catalina\localhost\admin.xml to Tomcat 5.5\conf\Catalina\localhost

2.copy apache-tomcat-5.5.27\server\webapps\admin to Tomcat 5.5\webapps

I got an error The requested resource (/admin/) is not available when I tried to open tomcat web adimistration tool.

The solution: copy apache-tomcat-5.5.27\server\webapps\admin to Tomcat 5.5\server\webapps (instead of Tomcat 5.5\webapps

Launch an administration console with http://localhost:8080/admin/.