Kuldip Shetty

Ranch Hand
+ Follow
since Jan 07, 2010
Kuldip likes ...
Eclipse IDE Java
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
6
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Kuldip Shetty

By adding public getter and setter method for instance variables in Book you should be able to print the values of the private variables of Book in TravelGuide

Book



TravelGuide
6 years ago
Below are three changes:
1. Book - Change private to protected as private variables are not accessible to inherited classes
2. Set the values in the Book constructor
3. TravelGuide - Invoke super() in constructor of TravelGuide to invoke base class Book constructor with parameters

Book


TravelGuide

6 years ago
You may possibly do this:
7 years ago
On DB Crash and restart the JBoss 6.2 EAP server is not able to reconnect to the MySQL database with the connections from the connection pool. I get Broken Pipe error after adding the autoReconnect connection property. Only after the restart of the JBoss application server it works fine.





server.log

Caused by: org.hibernate.TransactionException: rollback failed
at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.rollback(AbstractTransactionImpl.java:215)
at org.springframework.orm.hibernate4.HibernateTransactionManager.doRollback(HibernateTransactionManager.java:574)
... 72 more
Caused by: org.hibernate.TransactionException: unable to rollback against JDBC connection
at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.doRollback(JdbcTransaction.java:167)
at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.rollback(AbstractTransactionImpl.java:209)
... 73 more
Caused by: com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:

** BEGIN NESTED EXCEPTION **

java.net.SocketException
MESSAGE: Broken pipe

STACKTRACE:

java.net.SocketException: Broken pipe
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(Unknown Source)
at java.net.SocketOutputStream.write(Unknown Source)
at java.io.BufferedOutputStream.flushBuffer(Unknown Source)

----skipped lines----

at java.lang.Thread.run(Unknown Source)
** END NESTED EXCEPTION **
Last packet sent to the server was 0 ms ago.
at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:2759)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1612)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1723)
at com.mysql.jdbc.Connection.execSQL(Connection.java:3277)
at com.mysql.jdbc.Connection.setAutoCommit(Connection.java:5442)
at org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnection.checkTransaction(BaseWrapperManagedConnection.java:886)

8 years ago
At line 33 fetchNextWorkingDay method is called recursively
8 years ago
Add hidden type form element in html and read the value in Servlet using request.getParameter
8 years ago
JSP
Below are description of struts elements:
textfield - A text control for the "user" property is rendered. The label is also retrieved from a ResourceBundle via the key attribute
label - A label is rendered. The label is retrieved from a ResourceBundle via the key attribute

Below code snippet should display only one label

8 years ago
Data to be used by JSPs is generally passed to it as a request attribute by a servlet.
To run the index.html by default for the url localhost:8080/test add the below welcome-file-list tag in web.xml



how to write url without to specify each time the port like in apache http "http://localhost"



Change conf/server.xml file in tomcat server from the default port 8080 to 80 (Default http port). Restart the server after making the configuration changes and access the application using http://localhost
For reference
11 years ago
Below is the updated web.xml. Each servlet and servlet mapping tag is defined for a particular servlet. As you had added multiple servlets under servlet and servlet mapping tag, this resulted in the different servlet response which you are facing.

11 years ago
As per javadocs System.getEnv method has been deprecated and it recommend using System.getProperty. Hope this should resolve the environment variable issue.

11 years ago
As updated in above threads the issue is related to quotes. Similar question has been answered and resolved in another post - Click here
11 years ago
Test the below code and verify if it works as you expected. Hope the below code helps

You need to set few Context properties like Context.INITIAL_CONTEXT_FACTORY, Context.PROVIDER_URL before performing the JNDI Lookup.


Click here for more details
11 years ago
Each time you fetch connection from the pool after performing db operation verify if the connection is released back to the pool by performing connection.close()