Showing posts with label Solution. Show all posts
Showing posts with label Solution. Show all posts

Error : resource-ref: has no valid JNDI binding. Check the jboss-web/resource-ref - Solution

resource-ref: has no valid JNDI binding, which means resource-ref defined in the deployment descripter has no valid binding. Assume that you have configured JDBC Data Resources (JNDI) in Jboss 4.0 for any database (Db2 , Postgres, etc ..) . That is you have defined a reference lookup name (eg. jdbc/techLabsDS) to an external resource in the WEB-INF\web.xml and also you have created / copied *-ds.xml descriptor file with neccessary configurations like jndi-name , driver class in the in the Jboss application server folder Drive:\jboss-4.0.0\server\default\deploy . To use the resource adaptor defined in the deployment descripter (web.xml) , it must be integrated into the JBoss application server using a ds.xml descriptor file .
Now when you start the Jboss server or when you try to run the application for accessing the database , you may get the error "javax.naming.NamingException: resource-ref: jdbc/techLabsDS has no valid JNDI binding. Check the jboss-web/resource-ref" where techLabsDS is the JNDI name. To solve the this error , you have to copy the jboss-web.xml file with the following additional lines to Application's WEB-INF folder.

<resource-ref>
<res-ref-name>jdbc/techLabsDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<jndi-name>java:/jdbc/techLabsDS</resource-ref>

The following picture shows where the jboss-web.xml file to be copied.




Read more...

Solution for Unable to find a javac compiler error in Jboss 4.0 with Eclipse when running JSP file

When you run a JSP with JBoss Application server in eclipse IDE , the following error may occur "org.apache.jasper.JasperException: Unable to compile class for JSP"

JBoss appserver throws the following error
Unable to find a javac compiler , com.sun.tools.javac.Main is not on the classpath. Perhaps JAVA_HOME does not point to the JDK

The reason for the above error is "com.sun.tools.javac.Main" class which is bundled with tools.jar, is not in the class path . So we need to include the tools.jar file in the class path. When we add the jre to the build path , it includes all necessary jar files except tools.jar in the class path . Assume that jdk1.6.0_23 is installed in d:\ . jdk1.6.0_23 can be downloaded from java site.
tools.jar file will be located in the installed folder of jdk (i.e d:\jdk1.6.0_23\lib OR d:\ jdk1.6.0_23\jre\lib)

Steps to include the tools.jar file in the classpath in eclipse
1. Select Windows->Preferences ->Java -> Installed JRE
2. Highlight the selected jre and click in edit buttor as shown in the following screen shot

3. Click on Add External Jars and select the tools.jar file from the jdk\lib OR jdk\jre\lib folder then Finish.

Now you will be able to run the JSP file.


Read more...

Solution for Port already in use / Port already open. How to close a port in windows whis is in already in use or open ?

Sometimes you may get the error "port already in use" or "port already open" when you install a application or when you start any server . That means the mentioned port is used by an application. For Example you may get the following error when you start the test server in WSAD .



This is due to, we may have terminated the WSAD by using Task Center when it is not responding. When you again load WSAD , starting the test server will the above error. This can be solved either by restarting the system or Stopping / Killing the process which uses the port . The same error may also occur when you install new application or when you run a java program (Socket Programming), in this situation you can use new port or if you want to use the same port means , you have to kill the process which uses the port.

Steps to end / stop / kill the process which uses the port
First find out the process id of process / application which is using port . To find out the process id of a process using the port no

netstat -aon | findstr "<port number>"
For example to find the process id of the application which is using the port 9080 , use the following command

C:\>netstat -aon | findstr "9080"

When you run the above command ,if the port 9080 is already used , then the following output is displayed

TCP 0.0.0.0:9080 0.0.0.0:0 LISTENING 3800

The number in the last column is the process id (PID) of the process holding the socket. That is 3800

Once PID is known, one can kill the application which corresponds to the PID using "Windows Task Manager" . (Note : to display the PID value in Task Manager, go to Processes tab, open View menu, then Select Columns)

or Using Command prompt to kill the process using process id , you can use the following command

taskkill /PID processid

Command to kill the processid 3800 , use the following command

c:\> taskkill /PID 3800


Read more...

Installing SSL (Security Certificate) in Mozilla Firefox

The following instructions will guide you how to install security Certificate in Mozilla Firefox which is an open source and most popular web browser.

Such certificates are widely used for encrypting your information which you are sending so that the right person can read the message OR encrypted message can be read only by the right person who has the key. For eg a person can send any personal identification in online banking systems.



Installing Security Certificate in Mozilla Firefox

1) Select Options in the Tool menu as follows . Tools -> Options.



2) The following screen appears. In that screen select advanced options which displays as follows.




3) Click on the View Certificates which will display the following screen.



4) Click on the import button which will display the dialog box. Select the Security Certificate and click OK. Now the certificate is installed.
Read more...

 
Copyright 2011 Java Online