dotcms - won't see new database configuration - java

I'm in the midst of migrating a dotCMS installation to a new server. Everything seems to be working properly except for the database configuration. I've updated tomcat/conf/Catalina/localhost/ROOT.xml with a new IP address for our MySQL server, saved it, run ant deploy-plugins, and restarted dotcms/tomcat.
When I check the log, I get a number of SQL exceptions, all with the same error message: Host 'xxx' is not allowed to connect to this MySQL server. I double-checked all of my MySQL credentials, which were fine.
When I run netstat -pant, I can see an outgoing connection trying to reach the OLD MySQL server.
I've literally grepped the entire dotCMS folder hierarchy for this IP address (or hostname) and nothing turns up. Is there some kind of cache file I need to delete so the ROOT.xml changes are seen?

Sounds like you should check your MySQL permissions. You might need to GRANT access from the new IP address.

Are you sure there is no root.xml in the com.dotcms.config plugin that overwrites your root.xml after running ant deploy-plugins?

Related

The Network Adapter could not establish the connectionDSRA0010E: SQL State = null, Error Code = 17,002″

I am facing below issue.
1- I have data source on my local websphere6.1 and when i do test connection from web console server ,it was successful but when i tried to do the same from my application code it giving me error
java.sql.SQLException: Io exception: The Network Adapter could not establish the connectionDSRA0010E: SQL State = null, Error Code = 17,002
Note : I am connecting to remote oracle db in my machine , I have only raid,toad & web sphere installed.
I have already tried following things but issue is yet not resolved.
Replace my server names with the ip addresses.
Change minimum connection setting from web sphere server configuration
The same configuration is running to my other colleague but issue is occurring only on my laptop.
Please any body help me.
Advance thank you
Some things you can try, seeing your error:-
-> Verify that oracledb is started, also verify the port db is listening on is correct.
-> If you have firewall in between and you can disable it, disable it and try. Or else try adding the WAS ports in authorized lists of firewall.
After lot of searching and did lots of trick , i resolved this issue and this solution is Formatting my machine.
Some time there might be issue with network adapter due to this it create problem . I have tried below thing before formatting my machine.
1- Disable my symantic anti-virus but not work.
2- Adding oracle db ip in antivirus configuration and allow all traffic.
3-Tried to change from server admin console by changing (min connection ,max connection , componenet managed authentication
4- Finally ,un-install RAID/websphere . Still again problem persist.
I have spent lot of time and do Much R&D but finally solution come by formatting my laptop.
I resolved the issue after that I've changed the database port that I used to connect at the bd. Check on whitch port your db has been started.
You can check the official IBM developer network issue at:
https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014687717
Regards.
Please change the JVM argument through the WAS Admin console while connecting the JNDI connection. Below is value :
-Djava.net.preferIPv4Stack=true
Path to set JVM:
Go to the server and select Websphere application server and select server name like server1
Select Java and Process Management at the right side
Select Process definition
Select Java Virtual Machine
Enter above value (-Djava.net.preferIPv4Stack=true) in Generic JVM arguments and Save it and restart the server.
It resolved my problem!

Running Apache Derby on a Flash Drive

I'm trying to run the Apache Derby db from a flash drive. I copied the relevant .jar files and managed to start up the network server. But how to I specify the connection URL in connecting to the server? the database is in the flash drive labeled as G.
Used the following code, but came across an exception:
DriverManager.getConnection("jdbc:derby://localhost:1527");
java.sql.SQLException: The URL 'jdbc:derby://localhost:1527' is not properly formed.
How can I connect and use it as a normal database?
Thank You!
The presence of the flash drive is immaterial to this question. The most pertinent point is whether the Derby server is running in the embedded mode or in the network server mode.
From the URL used, it appears that you intend to connect to Derby running as a network server. This would be the case if you've started Derby using the startNetworkServer shell scripts, available in the Derby installation. If so, the connection URL format, as defined in the Derby documentation is as shown below. Note the presence of the databaseName parameter, which is missing in the URL posted in the question.
jdbc:derby://server[:port]/databaseName[;attributeKey=value]..
If you didn't want to start Derby in the network server mode, but instead as an embedded database, then the connection URL format is different. Note the absence of the port number, and the reliance on a subprotocol whose value are one of directory, classpath or jar. Examples of this format can also be found in the documentation.
jdbc:derby:[subsubprotocol:][databaseName][;attribute=value]*

MySql doesn't work from deployed java web app

I made a page using struts. When running on localhost (glassfish) it is working fine.
However, when I copy WAR file to a remote server and run the application from there login form does not work. That means something is wrong when connecting on mysql database.
How could I solve this?
Code snippet:
Connection conn = null;
Statement stmt = null;
try{
InitialContext ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup("jdbc/SB");
conn = ds.getConnection();
stmt = conn.createStatement();
ResultSet rs = null;
if(stmt.execute("SELECT * FROM users WHERE username='"+loginform.getUsername()+"' AND geslo=MD5('"+loginform.getPassword()+"') LIMIT 1;"))
{
rs = stmt.getResultSet();
}
rs.next();
Unfortunately I cannot read from the server console. What else should I do to see the exception (remote logging?)?
Thanks on replies.
UPDATE:
- Both locally and remotely GlassFish 3.0.1 is running.
- My working environment is NetBeans 6.9.1.
- Deploying locally is done simply in NetBeans. I just click on the project name and click publish. For remote deployment, admin gave me access to the FTP server where I just copy the WAR file.
- MySQL server is located somewhere else. The point is, it is accessible from the localhost web application but not from the same remote web application.
Assuming you have admin rights on the remote server, you need to
Verify that the datasource "jdbc/SB" exists. (Resources / JDBC / JDBC Resources)
Verify that the "poolname" in the datasoucre exists (Resources / JDBC/ Connection Pools)
Open the appropriate connection pool and click on the "ping" button.
If ping fails verify the connection params under the Additional Properties tab.
There could be a dozen other issues as well. You really need to get access to the server log so you see what the specific exception is. It's unlikely it's your code and more likely that the remote server is missing the driver dependency or isn't properly configured (the connection pool an datasource)
Some ideas are
- log to file instead of console
- Print log on your struts page
- maybe you don't have grants or firewall problem to access DB
I'd bet that you don't have authority to access the DB...
Try this as a test... install the MySQL client on another machine and then connect to the MySQL server from there.
If that fails then:
Say you log in with:
User: test
Password: password
Then open the Mysql client and enter:
use nameOfDatabase;
GRANT ALL ON nameofDatabase.* TO 'userName'#'ipaddressOfServerOrDNSName';
That should do it.
There are other ways to give access see http://dev.mysql.com/doc/refman/5.1/en/grant.html
Are you sure your database is setup correctly on your remote server? It sounds like maybe a firewall issue.
Unfortunately I cannot read from the server console.
If you have shell access to the remote server, the solution is simple:
Change the logging configs so that your webapp logs to a file instead of / as well as the console.
Login and read the file.
(Indeed, if you were using Tomcat, stuff written to System.out / System.err is written to a file anyway. Maybe this is true for Glassfish also.)
If you don't have shell access, you may have to modify your webapp to provide an extra page that can be used to download or view the log file from your web browser. If you have to resort to this, pay attention to the obvious security concerns.
This is my weg (wild eyed guess)....
Your local app server has the MySql driver installed. The JDBC resource is also defined correctly. The MySql server is probably running on your localhost. You have developed your app locally in NetBeans.
When you deploy an app from NetBeans onto a local server, the IDE makes sure that server has the DB driver installed. NetBeans cannot do that when you deploy to a remote host. If you use some other deployment method, driver installation is not automagic. It is an easy step to forget.
You can find out if the MySql drive is installed on your server by writing a web app that attempts to load or use one of the classes from the driver jar file. If the access generates an exception, you can probably get something that works by including the MySql drive in your webapp's WEB-INF/lib.
NetBeans also helps folks create and manage their JDBC resource definitions. If you create an app that targets a database on your localhost, the JDBC resource will have localhost as part of the URL. This will work great when the app is deployed onto the same server as the DB server. If the app is moved to another server, the JDBC resource needs to be changed to account for the possibility that the DB server is NOT on the localhost.
If you do not have admin access to the remote server, you will have trouble getting the resources defined. If your remote server was a GlassFish 3.1 domain/instance, you could leverage application scoped resources to get the resources defined for your app.
Regarding access to the log file.
If you are using asadmin to deploy onto the remote server, this command will help you access the server log if you are working with GlassFish v2.x: http://docs.sun.com/app/docs/doc/821-0179/display-log-records-1?l=en&a=view. You can also access the log via the admin console.
If you are using rcp to deploy your app, by copying it into the autodeploy directory of the remote server, you may want to see if you can copy the log onto your local machine.
For example... if your admin told you to deploy using an ftp command like this:
ftp> cd /a/b/glassfish/domains/domain1/autodeploy
ftp> put MyGreatWebapp.war
you may be able to get the log by doing something like this:
ftp> cd /a/b/glassfish/domains/domain1/logs
ftp> get server.log
Experiment....

JDBC: Oracle Application Server and "The Network Adapter could not establish the connection" error

I am getting the error: "The Network Adapter could not establish the connection" from a web application deployed in Oracle Application Server 10g. The database is local, so there shouldn't be any connection issues.
First test: I can connect to the DB no problem from SQL plus, run queries, etc.
Second test: I can connect to the database no problem from a locally installed JDeveloper on the server, and run queries, etc. no problem. This works with the short JDBC scring, and the long one (shown below).
jdbc:oracle:thin:#(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=abcd)(SERVER=DEDICATED)))
Yet when I run the web app, it gives the above error. It seems too generic for me to do anything about.
Any suggestions on how to solve this? I assume that Oracle logs failed connection attempts somewhere, but I couldn't find anything relevant in the databases alert.log file.
It is possible that the problem is that the application is using an old jsdk, but I would assume that then some version mismatch error would be given instead of a "network connection" message.
Edit: I don't know whether this is an OAS problem or a problem with the specific Web Application, I would like to figure this out first, as it seems it should be easy. In WebSphere, there is a "test connection" button to dest data-sources you have added, but it seems there is no such functionality in OAS10? Somehow I think there must be, and I am just missing it because I am not an OAS expert.
Edit 2: I installed JDevelop on a remote machine and connected to the database with no problems, so I know for sure it isn't an issue with the database connectivity itself - it seems like it must be a problem within OAS?
I faced similar problem(able to connect through client but not web application) with Oracle XE when running with default configuration. Increasing number of sessions and processes solved my problem. Check this http://www.markcallen.com/oracle/oracle-xe-tuning.
I assume that Oracle logs failed connection attempts somewhere
It would show up in listener.log, but with the error you get, it seems doubtful that JDBC could even contact the listener.
jdbc:oracle:thin:#(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=abcd)(SERVER=DEDICATED)))
Is that the same string you use for the web app?
I've had issues with localhost and 127.0.0.1 which go away when using a more definitive host name or address [IE a name that other machines would know the host as.]. I think it was to do with how the name was resolved (eg locally or off to a name server or similar).
Not a java person, but is there any way to simply ping localhost/127.0.0.1 from the java and see whether there's a response.
One of the ways to fix the issueis to update Hosts file at WAS Server with entries for DB servers as shown below:
111.222.333.444 serverab.abc.com serverab

JavaDB connection issues; database not found

I am having a problem with Java DB that I just don't know how to resolve. I am creating a DB and connecting to it using Java DB's native JDBC driver. If I relocate that database physically and try to connect to it using its new path, I consistently get XJ004 errors:
ERROR XJ004: Database 'blahblah' not found.
I am sure I am using the correct connection string. Is there any possibility the DB is somehow getting corrupted? Or is there some encoding of the DB path in the DB such that if you relocate a Java DB it gets confused?
I'm really at a loss here. :( Please help!
Jim
Have you verified that this error message isn't also used when there's no listener on the host machine ... and were you using JavaDB on your local machine before the relocation? Many database systems (and I'm not that familiar with JavaDB) ship set-up to only allow connections from localhost for security reasons. On PostgreSQL for instance, you have to allow TCP connections and bounce the daemon to obtain a remote connection.
Anyway ... since the problem started when you when remote, look for issues related to that first! (And if you can run your application on the remote machine, does that work?)
There must be a file named derby.log somewhere. Check the error there. If it is not detailed enough, try setting derby.stream.error.logSeverityLevel to a lower value. See the manual for more information.

Categories