openfire error with no answers - java

I am running openfire server as a basis for my chat server, but i am not happy with the robustness of the openfire, it seems to be having lot of java errors,
java expert people who i talked to says that its all coding errors, that java exceptions hasn't handle correctly. Just want to know from a java expert is following errors are really java programming problem or a my server or settings problem.
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.RangeCheck(Unknown Source)
at java.util.ArrayList.get(Unknown Source)
at org.logicalcobwebs.proxool.util.FastArrayList.get(FastArrayList.java:475)
at org.logicalcobwebs.proxool.ConnectionPool.getConnection(ConnectionPool.java:184)
at org.logicalcobwebs.proxool.ProxoolDriver.connect(ProxoolDriver.java:89)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at org.jivesoftware.database.DefaultConnectionProvider.getConnection(DefaultConnectionProvider.java:86)
at org.jivesoftware.database.DbConnectionManager.getConnection(DbConnectionManager.java:124)
at org.jivesoftware.openfire.spi.PresenceManagerImpl.userUnavailable(PresenceManagerImpl.java:280)
at org.jivesoftware.openfire.handler.PresenceUpdateHandler.process(PresenceUpdateHandler.java:168)
at org.jivesoftware.openfire.handler.PresenceUpdateHandler.process(PresenceUpdateHandler.java:135)
at org.jivesoftware.openfire.handler.PresenceUpdateHandler.process(PresenceUpdateHandler.java:199)
at org.jivesoftware.openfire.PresenceRouter.handle(PresenceRouter.java:149)
at org.jivesoftware.openfire.PresenceRouter.route(PresenceRouter.java:85)
at org.jivesoftware.openfire.spi.PacketRouterImpl.route(PacketRouterImpl.java:84)
at org.jivesoftware.openfire.SessionManager$ClientSessionListener.onConnectionClose(SessionManager.java:1164)
at org.jivesoftware.openfire.net.VirtualConnection.notifyCloseListeners(VirtualConnection.java:214)
at org.jivesoftware.openfire.net.VirtualConnection.close(VirtualConnection.java:190)
at org.jivesoftware.openfire.http.HttpSession$HttpVirtualConnection.systemShutdown(HttpSession.java:1008)
at org.jivesoftware.openfire.spi.LocalRoutingTable.stop(LocalRoutingTable.java:146)
at org.jivesoftware.openfire.spi.RoutingTableImpl.stop(RoutingTableImpl.java:857)
at org.jivesoftware.openfire.XMPPServer.shutdownServer(XMPPServer.java:948)
at org.jivesoftware.openfire.XMPPServer.access$700(XMPPServer.java:146)
at org.jivesoftware.openfire.XMPPServer$ShutdownHookThread.run(XMPPServer.java:898)
2012.11.24 05:50:37 org.jivesoftware.util.log.util.CommonsLogFactory - Problem
java.sql.SQLException: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at org.logicalcobwebs.proxool.ConnectionPool.getConnection(ConnectionPool.java:235)
at org.logicalcobwebs.proxool.ProxoolDriver.connect(ProxoolDriver.java:89)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at org.jivesoftware.database.DefaultConnectionProvider.getConnection(DefaultConnectionProvider.java:86)
at org.jivesoftware.database.DbConnectionManager.getConnection(DbConnectionManager.java:124)
at org.jivesoftware.openfire.spi.PresenceManagerImpl.userUnavailable(PresenceManagerImpl.java:280)
at org.jivesoftware.openfire.handler.PresenceUpdateHandler.process(PresenceUpdateHandler.java:168)
at org.jivesoftware.openfire.handler.PresenceUpdateHandler.process(PresenceUpdateHandler.java:135)
at org.jivesoftware.openfire.handler.PresenceUpdateHandler.process(PresenceUpdateHandler.java:199)
at org.jivesoftware.openfire.PresenceRouter.handle(PresenceRouter.java:149)
at org.jivesoftware.openfire.PresenceRouter.route(PresenceRouter.java:85)
at org.jivesoftware.openfire.spi.PacketRouterImpl.route(PacketRouterImpl.java:84)
at org.jivesoftware.openfire.SessionManager$ClientSessionListener.onConnectionClose(SessionManager.java:1164)
at org.jivesoftware.openfire.net.VirtualConnection.notifyCloseListeners(VirtualConnection.java:214)
at org.jivesoftware.openfire.net.VirtualConnection.close(VirtualConnection.java:190)
at org.jivesoftware.openfire.http.HttpSession$HttpVirtualConnection.systemShutdown(HttpSession.java:1008)
at org.jivesoftware.openfire.spi.LocalRoutingTable.stop(LocalRoutingTable.java:146)
at org.jivesoftware.openfire.spi.RoutingTableImpl.stop(RoutingTableImpl.java:857)
at org.jivesoftware.openfire.XMPPServer.shutdownServer(XMPPServer.java:948)
at org.jivesoftware.openfire.XMPPServer.access$700(XMPPServer.java:146)
at org.jivesoftware.openfire.XMPPServer$ShutdownHookThread.run(XMPPServer.java:898)

This is either a problem with the parameters you are (or aren't) passing to your database driver - or possibly a bug in the database driver itself. My guess is that you aren't passing in required properties in your DB connection string.
It is certainly not a problem with openfire itself - we have used openfire for many years now, and it is an exceptional piece of software.

Related

H2 Database connection timeout with new computer

I'm using two H2 databases in my Java projects. Recently, I changed my computer and since then I have no problem with connecting to one of those databases using my Java code but problems with the other one. It's exactly the same code (up to PATH_TO_DATABASE) I use to start the connection:
import java.sql.DriverManager;
import java.sql.SQLException;
public class DatabaseConfig {
private static java.sql.Connection connection;
public static void init() {
if (connection == null) {
try {
connection = DriverManager.getConnection("jdbc:h2:tcp://192.168.178.50:9092/C:/Users/PATH_TO_DATABASE", "USER", "PW");
} catch (SQLException e) {
System.err.println("SQLException");
e.printStackTrace();
System.exit(0);
}
}
}
[...]
}
This is the stack trace I get:
SQLException
org.h2.jdbc.JdbcSQLException: Connection is broken: "java.net.SocketTimeoutException: connect timed out: 192.168.178.21:9092" [90067-196]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
at org.h2.message.DbException.get(DbException.java:168)
at org.h2.engine.SessionRemote.connectServer(SessionRemote.java:457)
at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:334)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:116)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:100)
at org.h2.Driver.connect(Driver.java:69)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at data.DatabaseConfig.init(DatabaseConfig.java:20)
...
Caused by: java.net.SocketTimeoutException: connect timed out
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at org.h2.util.NetUtils.createSocket(NetUtils.java:103)
at org.h2.util.NetUtils.createSocket(NetUtils.java:83)
at org.h2.engine.SessionRemote.initTransfer(SessionRemote.java:115)
at org.h2.engine.SessionRemote.connectServer(SessionRemote.java:453)
... 8 more
Using the web interface I can connect to both databases easily.
I'm a little bit lost here since I can't figure out what's going wrong with one of the databases. The strange thing is that everything works fine with the other database.
EDIT: I just realized that the IP address in the error message is different from the one in the code (192.168.178.21:9092 vs. 192.168.178.50:9092). Maybe this is th ereason of the error. The one in the code is the correct IP address. Why do I get a different one in the error message? Is that the reason of my problem?
If it's a remote connection, do an ipconfig to find out if the 192.168.x.x. address is changed.
If it's a local connection, you can simplify your URL as
jdbc:h2:~/PATH_TO_DATABASE
I just solved the problem (it was kind of my stupidity): The project couldn't build on the new computer because the H2 jar was not properly included in the build path. That's why eclipse called all the time the old .class file and hence tried to connect to the old computer (192.168.178.21:9092) instead to the new one (192.168.178.50:9092). I didn't realize that eclipse didn't compile and was executing old stuff.

gridsim-Exception in thread "router2" java.lang.NullPointerException

I'm working on gridsim Min-Min project for workflow in Java Netbeans,i have 3 entities:user,broker and GridResources.
user send application with form of workfllow to broker
broker send gridlets to GridResource;
i implement the network topology for this entities with helping of example "auction" in example folder of Gridsim's pakage.
when run my programe,sometime its run without error and every thing is ok,
but after 3 run or some time after 8 run its failed with error and stop.
i checked network topology with another example but the logic of my programe is ok but im confiusing with this,i searched but not found anything.
anyone help me?
Exception in thread "router1" java.lang.NullPointerException
at gridsim.net.RIPRouter.dequeue(Unknown Source)
at gridsim.net.RIPRouter.processInternalEvent(Unknown `enter code here`Source)
at gridsim.net.RIPRouter.processEvent(Unknown Source)
at gridsim.net.Router.body(Unknown Source)
at eduni.simjava.Sim_entity.run(Sim_entity.java:605)
Exception in thread "router2" java.lang.NullPointerException
at gridsim.net.RIPRouter.dequeue(Unknown Source)
at gridsim.net.RIPRouter.processInternalEvent(Unknown Source)
at gridsim.net.RIPRouter.processEvent(Unknown Source)
at gridsim.net.Router.body(Unknown Source)
at eduni.simjava.Sim_entity.run(Sim_entity.java:605)

Microsoft SSAS OLAP Connection from Java Code

I am new to the concept of OLAP DB.
Please excuse me if I missed out something in the Connection String.
I am trying to connect to connect to Microsoft Analysis Server(which is in different Domain) from my System.
While Connecting I am getting below Error.
Can you please let me know, what am I doing wrong?
I have executed the Steps Mentioned in :
https://msdn.microsoft.com/en-us/library/gg492140.aspx
and referred to the below link for connection to the Cube:
http://www.matthewgodding.com/articles/2010/2/27/getting-data-from-sql-analysis-services-using-java-and-olap4.html
After connecting to the CUbe, I need to execute MDX Query.
Please find the snippet of the code I am using:
public static void main(String[] args) {
try {
Class.forName("org.olap4j.driver.xmla.XmlaOlap4jDriver");
final Connection connection = DriverManager
.getConnection("jdbc:xmla:Server=http://Remote_Server_IPAddress/OLAP/msmdpump.dll;"
+ "Catalog=MyCatalog;"
+ "User='Domian\\Username';" \\ This is the Username to login to the Server
+ "Password='Password';" \\ This is the Password to login to the Server
+ "Cube=Cube;"); \\This is the Cube Name
I get the below Exception when I execute the program:
Exception:
java.lang.RuntimeException: org.olap4j.OlapException: This connection encountered an exception while executing a query.
at org.olap4j.driver.xmla.DeferredNamedListImpl.getList(DeferredNamedListImpl.java:96)
at org.olap4j.driver.xmla.DeferredNamedListImpl.size(DeferredNamedListImpl.java:116)
at org.olap4j.driver.xmla.XmlaOlap4jConnection.getOlapDatabase(XmlaOlap4jConnection.java:451)
at org.olap4j.driver.xmla.XmlaOlap4jConnection.getDatabase(XmlaOlap4jConnection.java:444)
at org.sid.practise.CheckConnection.main(CheckConnection.java:79)
Caused by: org.olap4j.OlapException: This connection encountered an exception while executing a query.
at org.olap4j.driver.xmla.XmlaHelper.createException(XmlaHelper.java:43)
at org.olap4j.driver.xmla.XmlaOlap4jConnection.executeMetadataRequest(XmlaOlap4jConnection.java:878)
at org.olap4j.driver.xmla.XmlaOlap4jDatabaseMetaData.getMetadata(XmlaOlap4jDatabaseMetaData.java:137)
at org.olap4j.driver.xmla.XmlaOlap4jDatabaseMetaData.getMetadata(XmlaOlap4jDatabaseMetaData.java:67)
at org.olap4j.driver.xmla.XmlaOlap4jDatabaseMetaData.getDatabaseProperties(XmlaOlap4jDatabaseMetaData.java:1044)
at org.olap4j.driver.xmla.XmlaOlap4jConnection.makeConnectionPropertyList(XmlaOlap4jConnection.java:324)
at org.olap4j.driver.xmla.XmlaOlap4jConnection.generateRequest(XmlaOlap4jConnection.java:1037)
at org.olap4j.driver.xmla.XmlaOlap4jConnection.populateList(XmlaOlap4jConnection.java:849)
at org.olap4j.driver.xmla.DeferredNamedListImpl.populateList(DeferredNamedListImpl.java:136)
at org.olap4j.driver.xmla.DeferredNamedListImpl.getList(DeferredNamedListImpl.java:90)
... 4 more
Caused by: org.olap4j.driver.xmla.proxy.XmlaOlap4jProxyException: This proxy encountered an exception while processing the query.
at org.olap4j.driver.xmla.proxy.XmlaOlap4jHttpProxy.getResponse(XmlaOlap4jHttpProxy.java:181)
at org.olap4j.driver.xmla.proxy.XmlaOlap4jAbstractHttpProxy.get(XmlaOlap4jAbstractHttpProxy.java:181)
at org.olap4j.driver.xmla.proxy.XmlaOlap4jHttpProxy.get(XmlaOlap4jHttpProxy.java:42)
at org.olap4j.driver.xmla.XmlaOlap4jConnection.executeMetadataRequest(XmlaOlap4jConnection.java:876)
... 12 more
Caused by: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read1(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at org.olap4j.driver.xmla.proxy.XmlaOlap4jHttpProxy.getResponse(XmlaOlap4jHttpProxy.java:136)
It's difficult to know what went wrong for you. Few things you could do,
Don't specify cube in connection. This is not listed as property in XMLA driver.
You can install fiddler and see what's going on with the requests.
Not sure if single quotes are needed in user name and password.

Prepared statement only throws exception when not debugging

I use this piece of code to insert some data into database:
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:war_odbc");
PreparedStatement st =
con.prepareStatement(
"INSERT INTO Actors(FirstName,LastName,Age) VALUES(?,?,?)" );
st.setString(1, "Robert");
st.setString(2, "de Niro");
st.setInt(3,45);
st.executeUpdate();
con.close();
If I use debugger and step one line at a time, everything goes well. If I don't use it and just run the application, I get this exception:
[Microsoft][ODBC Driver Manager] Invalid string or buffer length
at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.SQLGetDataString(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcResultSet.getDataString(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcResultSet.getString(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcConnection.buildTypeInfo(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcConnection.initialize(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
I am using Windows 7 64 bit.
I went to Administrative Tools, Data Sources(ODBC) and i successfully tested it.
The best solution is to stop using this class from sun package (Why Developers Should Not Write Programs That Call 'sun' Packages). Also this driver is really old, it's a type 1 driver that convert JDBC calls in ODBC calls.
Now almost all DB vendors have implemented type 4 driver. This driver implementation converts JDBC calls directly into a vendor-specific database protocol.
Also according to this documentation this bridge will be removed in JDK8 so it's bad idea to use it if you want a portable / adaptable solution.
Replace st.setInt(2, "de Niro"); with st.setString(2, "de Niro");
Just few points regarding the code snippet provided.
st.setInt(2, "de Niro");
Here you are setting "string" as second parameter of query but you have used setInt() method and thats incorrect.
Is itsomething related to your OS . i mean are u using 64-bit widows OS and 32 bit connector. i am not sure about it though.
Check this link.
"[Microsoft][ODBC Driver Manager] Invalid string or buffer length" error

Java: Prevent NPE in MetalFileChooserUI$IndentIcon.getIconWidth?

on Windows systems. I get the following NPE with the FileChooser. It is a known bug that is not fixed by sun yet. http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6342301
Does somebody know a workaround to prevent this exception?
Thanks.
André
Exception in thread "AWT-EventQueue-2" java.lang.NullPointerException
at
javax.swing.plaf.metal.MetalFileChooserUI$IndentIcon.getIconWidth(Unknown
Source) at javax.swing.SwingUtilities.layoutCompoundLabelImpl(Unknown
Source) at javax.swing.SwingUtilities.layoutCompoundLabel(Unknown
Source) at javax.swing.plaf.basic.BasicLabelUI.layoutCL(Unknown
Source) at
javax.swing.plaf.basic.BasicLabelUI.getPreferredSize(Unknown Source)
at javax.swing.JComponent.getPreferredSize(Unknown Source) at
javax.swing.plaf.basic.BasicListUI.updateLayoutState(Unknown Source)
at javax.swing.plaf.basic.BasicListUI.maybeUpdateLayoutState(Unknown
Source) at
javax.swing.plaf.basic.BasicListUI$Handler.valueChanged(Unknown
Source) at
javax.swing.DefaultListSelectionModel.fireValueChanged(Unknown Source)
at javax.swing.DefaultListSelectionModel.fireValueChanged(Unknown
Source) at
javax.swing.DefaultListSelectionModel.fireValueChanged(Unknown Source)
at javax.swing.DefaultListSelectionModel.changeSelection(Unknown
Source) at
javax.swing.DefaultListSelectionModel.changeSelection(Unknown Source)
at javax.swing.DefaultListSelectionModel.setSelectionInterval(Unknown
Source) at javax.swing.JList.setSelectedIndex(Unknown Source) at
javax.swing.plaf.basic.BasicComboPopup.setListSelection(Unknown
Source) at javax.swing.plaf.basic.BasicComboPopup.access$300(Unknown
Source) at
javax.swing.plaf.basic.BasicComboPopup$Handler.itemStateChanged(Unknown
Source) at javax.swing.JComboBox.fireItemStateChanged(Unknown Source)
at javax.swing.JComboBox.selectedItemChanged(Unknown Source) at
javax.swing.JComboBox.contentsChanged(Unknown Source)
In the bug report that you linked to, they also mention a workaround.
It seems to come down to calling the methods in a specific order.
Have you tried that?
A DESCRIPTION OF THE PROBLEM :
There appears to be an undocumented bad intereaction between
explicitely setting the UI and removing all file filters, even temporarily.
If the latter is done before setting the ui, trying to display a file dialog
will throw an exception but not if the ui was set prior to messing with
the filters. Maybe it is possible to make the code more robust against
this or to include a warning in the docs?
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the attached program: it will not bomb. Then move the setUI
line to the bottom of the constructor and try again: it will.
So, now with registered account :)
The problem with these steps in the mentioned link is, that the look and feel and therefor the UI is set globaly in our software. So the UI is set before I'm able to manipulate the file filters.
Edit: Missunderstood the code for reproduction. The exampled works as mentioned. Thanks.
It looks like the workaround description says you should try to set the UI before manipulating the filters. Does this not work?
If that doesn't work, is it possible to create an instance of your manipulated FileFilters at the same point that you are setting your UI?

Categories