Datasource connection issues while upgrading from Jboss 5/6 to Jboss-as-7/Jboss eap

Posted on

While upgrading your application from Jboss 5 or 6 to Jboss-as-7 or Jboss eap, you may face datasource connection issue as follows:

(DefaultQuartzScheduler_Worker-1) Exception occured within if block of getDatasourceName method : javax.naming.NameNotFoundException: java:comp/env/jdbc/ExampleDB
at org.jboss.as.naming.InitialContext.lookup(InitialContext.java:121)
at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:213)
at javax.naming.InitialContext.lookup(InitialContext.java:392) [rt.jar:1.6.0_37]
at org.quartz.core.JobRunShell.run(JobRunShell.java:202) [quartz-1.6.3.jar:1.6.3]
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525) [quartz-1.6.3.jar:1.6.3]

To fix the above issue, you need to change the datasource connection as follows:

  1. In web.xml there will be no changes.
  2. In jboss-web.xml, the jndi-name has to be changed from java:/jdbc/ExampleDB to java:/ExampleDB as shown below:

<jboss-web>
<resource-ref>
<res-ref-name>jdbc/DCSIDB</res-ref-name>
 <jndi-name>java:/jdbc/DCSIDB</jndi-name>
</resource-ref>
</jboss-web>

 

3. In the class where you define datasource name, the datasource name has to be changed to java:/ExampleDB instead of          java:/comp/env/jdbc/ExampleDB.

 

Advertisements

Resolving war deployment problem in jboss-as-7

Posted on Updated on

If you are stuck with the following stacktrace:

09:19:05,123 INFO [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015876: Starting deployment of “HelloWorld.war”
09:19:07,168 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-5) MSC00001: Failed to start service jboss.deployment.unit.”HelloWorld.war”.POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit.”HelloWorld.war”.POST_MODULE: Failed to process phase POST_MODULE of deployment “HelloWorld.war”
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.0.Final.jar:7.1.0.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) [rt.jar:1.6.0_45]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) [rt.jar:1.6.0_45]
at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_45]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011093: Could not load component class org.apache.struts.taglib.template.InsertTag Read the rest of this entry »

Remove struts mapping messages from console

Posted on Updated on

You might be wandering that you have configured struts correctly but you still see some debug messages on the console related to struts config while starting any application server. Dont worry, struts is configured correctly. It is some other configurations that is displaying this message.  Read below to solve your issue.

It is due to some excessive code written in log4j configuration of your project. When the server runs, the debug message shown is something like below:

 

Convert string ‘/’ to class ‘java.lang.String’
Using converter ConverterFacade[StringConverter[UseDefault=true]]
Converting ‘String’ value ‘/’ to type ‘String’
setSimpleProperty: Invoking method public void org.apache.struts.config.ActionConfig.setInput(java.lang.String) with value / (class java.lang.String)
setProperty(ActionConfig[cancellable=false,path=null,validate=true,input=/,scope=session, parameter, methodName)
Target bean = ActionConfig[cancellable=false,path=null,validate=true,input=/,scope=session
Target name = parameter
Convert string ‘methodName’ to class ‘java.lang.String’
Using converter ConverterFacade[StringConverter[UseDefault=true]]

Read the rest of this entry »

Snowfall 2014 in Thimphu

Posted on Updated on

The most awaited snowfall for the year 2014 was seen on 11th January. It was lucky for me as i bought a car on this day. Then i led my wife and 3 year old daughter to play on the snow.

Wife and Daughter 20140111_142959 20140111_143012 Read the rest of this entry »

Check and Uncheck all checkboxes using jquery

Posted on Updated on

There are some simple things to do in programming yet some developers find it tough. This is an example of checking all the checkboxes in a page using jquery. For this to work , you need jquery.js file included in your page.

This is the body part with all the checkboxes:

          <table>
<tr>
<td align=”left” colspan=”4″><input type=”checkbox”  class=”checkAll”></td>
</tr>
<tr>
<td> <input type=”checkbox” name=”myChkBox”  class=”selectedId” id=”myChkBox1″ /> </td>

<td> <input type=”checkbox” name=”myChkBox”  class=”selectedId”
id=”myChkBox2″ /> </td>
<td> <input type=”checkbox” name=”myChkBox”  class=”selectedId”
id=”myChkBox3″ /> </td>
<td> <input type=”checkbox” name=”myChkBox”  class=”selectedId”
id=”myChkBox4″ /> </td>
</tr>
</table>

Read the rest of this entry »

Resolving the issue of css and images not being loaded while redirecting with httpd.conf

Posted on Updated on

After successful virtual hosting and redirecting my application, the redirection worked but the stylesheet(css) and images did not get loaded. For virtual hosting  check my post on Virtual Hosting in windows using Apache 2.4.4.

Everything was mapped correctly but one entry was left out. Firstly, i had just added the following line:

ProxyPass  /myApp      http://localhost:8080/myApp/
ProxyPassReverse /myApp      http://localhost:8080/myApp/

With the above mapping it loads the root file(index.jsp) but does not load the css and images. So to load everything i added the following line:

ProxyPass /   http://localhost:8080/myApp/
ProxyPassReverse /      http://localhost:8080/myApp/

 

Read the rest of this entry »