mysql-connector-java-5.1.23-bin.jar NOT deployed - java

I am coding my first web app in java and got stuck in db stuff. Followed two tutorials (ref: https://netbeans.org/kb/docs/web/mysql-webapp.html and part1:http://www.javaguicodexample.com/javawebmysqljspjstljsf5.html part2: http://www.javaguicodexample.com/javawebmysqljspjstljsf5_1.html) and got the same issue regarding db config. Crosschecked multiple times and found that mysql-connector-java-5.1.23-bin.jar is there in the desired path and configured properly but is not deployed on running the app. Due to this getting TABLE/VIEW not found.
Kindly help as I am debugging by crosschecking the steps of the provided manuals but its not sufficient.

If you are receiving "TABLE/VIEW not found" that means application is successful in making database connection. There is no such table/view exists in the database.
Regarding dependencies, I would suggest to use some build tool like maven or gradle to make sure all dependencies and versions are managed properly

Related

No suitable driver found for jdbc:postgresql://localhost:5432/postgres

I tried several tutorials that I could get my hands on, but all of them lead to the same error:
18:28:24,583 INFO [stdout] (default task-1) Database error :No suitable driver found for JDBC:postgresql://localhost:5432/postgres
I have configured the connection following this tutorial: HOW TO SETUP POSTGRESQL DATASOURCE WITH WILDFLY
and tried several ways to fix the problem. I have tried both the management console and the configuration file. The most common solution was trying to add the postgresql-42.2.24.jar to the project structures in modules, but that doesn't solve it. I have created a new simple Java project where I am just trying to connect to the database and it works (I used the same credentials in both places), but when I'm trying to link the server with the DB it's like it doesn't see the driver... When adding a Datasource from Intellij it works perfectly fine (it sees the tables, I can run queries and everything), but I can't get the connection with the server to work.
I'm using Wildfly 24.0.1 Final and Java 8.
Change JDBC to jdbc, it's case-sensitive.

AWS Elastic Beanstalk "Impaired services on all instances."

I have a spring service that I'm trying to load load into AWS Beanstalk. When i create the environment and upload my .war file it just stays stuck on degraded. When i look through the logs for errors i cannot see any errors. Also when try and connect to my url, for example http://something.us-east-1.elasticbeanstalk.com/, i get a 502 error. I've already looked at the documentation provided by amazon that states the red degraded message means that all/most of the requests to you page are failing. Any idea how i can find the issue? See the screenshot below for the Enhanced Health Overview.
So, it turned out that i was getting an error in my logs but i was not able to see them. I had to ignore all of the eb-something log files. I needed to be looking at the web-1.log. This file may be named different depending on your instance and your environment but this is where i could actually see my error.
people who are finding their actual log can look up for this section in their EB log file.
/var/log/web.stdout.log
I had the same problem, with "Impaired services on all instances."
As suggested above, I ssh'd into the elastic beanstalk instance and looked at /var/log/web.stdout.log.
As I found there, my problem was that I was following a django tutorial and created a django config file with the WSGIPath pointing to the project name that was in the tutorial, but my actual project had a different name.
I corrected the mistake, wiped the elastic beanstalk instance and set up the environment again from scratch.
No problems at all this time, everything turned green immediately.

Custom User Store Manager not recognized (WSOIS 5.3)

I've written a custom User Store Manager to interface WSO2 to a database managed by ASP.Net's Simple Membership Provider. My main issue is that SMP uses PBKDF2 for password hashing and the standard JDBC User Store doesn't seem to support that.
I basically used https://docs.wso2.com/display/IS530/Writing+a+Custom+User+Store+Manager as a template, as the example implements a different password hashing algo, which is exactly my use case.
You can find my POC implementation here: github project wso2_custom_userstore I built a jar, put it into the dropins directory and restarted the server. The server complained about lack of bundle headers, but that's it. When adding a new user store there's only the standard stores, nothing more. I then configured a JDBC user store and changed the class to the one I wrote. The only effect I saw was that my previously configured User Store had vanished. I tried putting the .jar into the libs directory instead, didn't change anything.
As that didn't seem to work and the server complained about missing bundle headers I built a OSGI bundle that exported my CustomUserStoreManager Package (the source can be found on github as well, I'm not allowed to add more than two URLs) - now the bundle gets loaded and activated but nothing more. Still my class is nowhere to be seen. I don't see it as an available class in the User Store add dialog and I don't see it as an available class in the log config. No hint of it anywhere, not in the log files, not in the server's startup output. Nada.
Am I doing something wrong?
I have to add that I by no means am a Java developer nor a developer at all. I'm evaluating WSO2 for a customer and this is supposed to be a PoC. Once it works and I know that using PBKDF2 hashes are possible someone more competent is going to build a production version.
Thanks in advance,
SunTsu
WSO2 IS 5.3.0 is based on org.wso2.carbon.user.core 4.4.11 [1] and you are using 4.2.0. Documentation should be updated in this case. You can find a sample code [2] which is written for WSO2 IS 5.1.0 and article in [3].

Does the error "Table/View 'TABLE_1' already exists in Schema 'MYSCHEMA_1'" affect the application?

I have been working on an swing application using Netbeans and the database used is Derby.
In the development phase I have been using an implementation of Derby running in my local machine, this instance of derby is separated from the app.
At the moment I am trying to import the program in the production environment and I want the app to have a derby Db for each instance.
I am using a class that connects to the DB and creates few tables.
When the program is run for the first time the program runs fine, further runs obviously throw the following error:
java.sql.SQLTransactionRollbackException: Table/View 'TABLE_1' already exists in Schema 'MYSCHEMA_1'.
at org.apache.derby.client.am.SQLExceptionFactory.getSQLException(Unknown Source)
at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
at org.apache.derby.client.am.ClientStatement.execute(Unknown Source)
at clienteditor.DerbyInitializer.main(DerbyInitializer.java:52)
at clienteditor.ClientEditor.main(ClientEditor.java:2224)
Caused by: ERROR X0Y32: Table/View 'TABLE_1' already exists in Schema 'MYSCHEMA_1'.
at org.apache.derby.client.am.ClientStatement.completeSqlca(Unknown Source)
My question is: considering that the app seams to works fine, does this error affect in any way my application ? It seams to me that it is bypassed and ignored.
thanks Alb
We recently started making our project compatible with hibernate 3 and 5 at same time tried refactoring and faced similar issue. We use Derby data base for local testing. I faced this issue when i am refactoring to get create query from hibernate session (for hibernate 5 as we cannot get connection from hibernate session as we do with hibernate 3 ).
The first suggestion for this is to delete local derby folder for that specific project which gets create in your eclipse work space and try.
If the problem still persists try check how you are writing query, if there is way to refactor the code before you start running delete the existing derby for that project and then run the test.

Tomcat Deploying 2 Projects

I have a requirement that I need to use a single server machine to run 2 totally different applications.
The server machine has Apache Tomcat 6.0 installed. 1 of the applications is deployed on it and is running successfully for a long time. Initially, the clients used to connect to it by invoking the url "http://machine-name/1stProjectName/initialPage". I have also mentioned the "initialPage" as the Welcome Page in web.xml of this project. But somehow, later some ports or relating things were changed by the server maintenance team, and to connect to the application, now one has to use the url "http://machine-name" or "http://machine-name/initialPage", i.e. the machine name has started behaving like the project name folder because now if I invoke the url "http://machine-name/1stProjectName/initialPage", it gives 404 error saying that "/1stProjectName/1stProjectName/initialPage" resource not available.
Now, when I deploy the WAR of the second application into the webapps folder of Tomcat (just like I did for the first application), it unpacks it properly. But, the issue is how do I connect to this second project. If I use "http://machine-name", it takes me to the 1st application and if I use "http://machine-name/2ndProjectName/initialPage", it gives me an error that "/1stProjectName/2ndProjectName/initialPage" not available.
Kindly help or guide me in some direction.
Thanks in advance.
Your URLs should look like this if you did things properly:
Project 1: http://host:port/war-name-1
Project 2: http://host:port/war-name-2
That means no changes to content.xml to modify the path.
I would talk to your "server maintenance team" and let them know what you are trying to do (since they are the ones who made these changes in the first place). But it sounds to me that they just mapped a path to a specific location, that is your machine-name root is mapped to 1stProjectName.

Categories