Wayne Woodrow

Greenhorn
+ Follow
since Oct 31, 2014
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
3
Received in last 30 days
1
Total given
5
Given in last 30 days
5
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Wayne Woodrow

Quick update:
Not sure if I'm headed in the right direction, but I think I needed to specify the authentication type as 'setAuthentication("SqlPassword")' according to the link below:
https://docs.microsoft.com/en-us/sql/connect/jdbc/setting-the-connection-properties?view=sql-server-ver15

Once I did this, I got a new error:


I also tried this using 'setAuthentication("ActiveDirectoryIntegrated")' to login using my own AD credentials. The result was the same SSL error above. So, that's the trail I'm on now and hoping it's the correct one.
Greetings,

I am trying to connect to our SQL Server from my program, but I'm encountering an error:
com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user 'myUser'. ClientConnectionId:xxxxxx

We have a SQL server running with a user account for reading from the database. I am able to connect using SQL authentication from my computer via SQL Server Management Studio. This is working just fine.
We also have an application server on a separate box that runs our ticketing software. From within that application, I am also able to connect to the database using the same login and basic information (db server name, instance, db name, port).

Since I'm able to connect using both methods and from different boxes with the same account, I'm inclined to think it's not an issue with the account, although I'm a noob with SQL server administration.

Most of the examples that came up in searches had to do with people mixing authentication modes with the wrong connection strings. I don't think I've done that here as my scenario is very simple, but I must be missing something.

Also, the attempts to connect from my application do not show up in the SQL server's log.

Can you please take a look and let me know what you think?



Hi Tim, thanks for the response and the explanation on the webapp directories. I always have to go back and reference that.

I have some good news as well... It's finally working.

The link below has a good example for the embedded Tomcat, and they provide a download of the project files. Although, I had to switch back to JDK 8 for the example, as I was getting a 404 error when doing the 'mvn clean package' using JDK 13.
https://www.oracle.com/webfolder/technetwork/tutorials/obe/java/basic_app_embedded_tomcat/basic_app-tomcat-embedded.html#overview

So then I switched back to my own application, and after making some adjustments it's now serving the index.html page.

Here's what I adjusted:
- Added the directory and targetPath values to the POM
+

- Copied the Main method contents from the example, with the addition of the 'tomcat.getConnector()' line as mentioned in one of the earlier comments.
 + After some experimenting, the key was setting the appBase with the function 'tomcat.getHost().setAppBase(appBase)'. Also, I had to change the 'tomcat.addContext' function to 'tomcat.addWebapp(contextPath, appBase)'.

- Added the function 'tomcat.getConnector()' that James mentioned ealier in the thread (for Tomcat 9).

Interestingly, it doesn't seem to matter where appBase is set, as long as the folder exists. In the code it's set to '.', but I also tried 'C:/' and 'C:/dev' and it worked just fine.

What's still bugging me is that I don't know how to use 'tomcat.addContext(..., ...)'. It seems like one should be able to use that to serve up a static file. I can almost die happy, but I guess I'll let that go for right now. Perhaps it will become clear a bit further down the road.

Here are the pom and app files in all their glory:
App.java


pom.xml
1 week ago

James Kieliszek wrote:I had the same problem. This answer by Christopher Schultz got my tomcat server working again.
was all I needed to add. Tomcat 8 did this automatically, version 9 does not.



Thanks for the information. This got me a step further!

Unfortunately, I just came back to this a year later, and I'm trying to set up another simple example. I made the addition that you showed me above, and would like to serve a simple index.html file from the webapp folder. However, whenever I try to access http://localhost:8080 or http://localhost:8080/index.html, I get a 404 error.

File Structure (attached)
App.java


2 weeks ago
Yup it's working, thanks

Now back to Maven problems, haha.
3 weeks ago
Okay well, I'm an idiot.

Thank you both for your responses, it got me looking at this more closely. I'm working in windows, but also I was using the terminal through VSCode... and it was a PowerShell Terminal not a CMD. Once I changed the terminal type to CMD it worked perfectly.

I also used your advice and changed the URL to forward slashes instead of the double backslash.

3 weeks ago
Greetings,

So trying to get back into Java programming, I thought I would start a simple program writing to a SQLITE database. Initially this was a Maven project, but I had problems so got even more basic and just wanted to do a simple single class program. Well, still having trouble right off the bat.

The program and sqlite jdbc driver are located in the same folder. If anybody has some idea on how I can run this successfully, I would appreciate input. It's probably a really stupid mistake I'm sure..

First, I compiled the program using the command:


Second, I attempted to run the program, including the driver in the classpath:


For comparison, I created the same program using IntelliJ instead and was able to run the program through the IDE. The console showed the following command which looks the same in format as mine above:


The resulting error is below:


Here is the program


4 weeks ago
Thanks for all your replies, and Noel I feel a little better knowing I wasn't alone on this.

Tim thanks for the additional information. I'm still trying to understand everything you said and how to go about figuring this stuff out... You referred to earlier versions of Tomcat, but I just wanted to mention quickly that 8.5 also shows the 'Global web.xml not found' message, but then continues to work. Below is the console output with the app starts:


1 year ago
Good afternoon,

So I have still been trying intermittently to get this to work, pulling from various examples (all on Tomcat versions other than 9), but I'm still getting the same result.

However, I had some slight success today in finding that the code below works with Tomcat 8.5, but not with Tomcat 9. So I guess there's an extra step or something different I need to do on version 9 to get this running, and I'm a little frustrated about that. But I am glad to at least have something working so I know I'm not completely off base.

See the attached images to compare the output. I think I'm going to keep messing with Tomcat 9 because I want to know why it's not working, so if you still have any tips I would be grateful for your input, thanks!


1 year ago
Hello again,

I started reading up on how to access the logging and tried a few different things, but I'm still not having any luck getting more information on why the startup ends where it does.

The code for my latest attempt is below. I retrieved the LogManager to get a list of all loggers. After checking that the loggers are not null, I set the level to ALL for each of the loggers listed, which seems to work okay. However, once I run the application, it doesn't seem to have any effect. I still get the usual INFO: and WARNING: messages but nothing else. I feel like there's another instance of a logger somewhere that I need to set to ALL, but if the LogManager doesn't see it then where would it be?

Any ideas would be appreciated. Attached is a screenshot of the console

1 year ago
Thank you for the response, I will try that. Right now there are no log files so I think I need to figure out how to get that first. I assume they would be in the circled area (attachment) if they were being generated?

1 year ago
Greetings,

I am trying to create a basic web application to start building upon. I started from scratch with only Maven and the pom.xml. I am trying to embed Tomcat9 to bundle the whole application as a single JAR. The problem I am having is Tomcat doesn't seem to fully start. I'm not very knowledgable when it comes to setting up the logging, so in this scenario I'm not sure where to get more details on what's happening.

The last line in the log reads 'WARNING: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [175] milliseconds.' After this, nothing else happens.

I followed this tutorial (link below) for comparison and it ran successfully, so I tried to apply it to my program, but it's just not happening.
https://devcenter.heroku.com/articles/create-a-java-web-application-using-embedded-tomcat

I would appreciate any input on this, thanks!
The repo link for the project is below:
https://github.com/Wawawarrior/ddshop
Tomcat 9.0.10
Java Compiler 1.9


Here is the Main.java for quick reference:

1 year ago
Thanks to both of you for your replies and thoughtful answers. I felt like it was probably more of a fantasy and not something to expect, at least not in the near future, so your realistic advice is much appreciated.
3 years ago
Hey Everyone,

I've been thinking things over for a while now, and while I think I already know the answer, I would greatly appreciate your input. My two goals right now are: work in software development, and work remotely so I can move/live in different places (within the US).

A brief overview of my current situation is: I have a very secure tech support job with the best company in my area. Almost 29 years old. B.A. in Mathematics, B.S. in IT - Software, and about 4 years of professional experience in technical support. I have an oracle cert in Java SE 6, and I am familiar with Javascript, HTML, CSS, SQL etc.. Most of my time in Java has been spent working with Servlets/JSP/JSTL but the problem is I'm not really practiced in the stuff, I've been having a hard time the last couple of years making real progress after work, and I'm really just trying to get off the ground here, and get out of tech support.

So my two part question:
What is your advice and experience on leaving a job to study software development for 6-12 months to transition into software development?
How realistic is it to land a remote position early in my career or at all?

I've been contemplating that I would be able to make tremendous progress if I were able to focus on this stuff all day, thereby allowing me to land a job doing what I enjoy. At the same time, there's that part that considers the worst-case of leaving a secure job and not having anywhere to go. Do I just sack up and continue trying to build experience in 1-2 hour increments, or is there a better way?
3 years ago
Thank you for the advice and the fix! I went ahead and changed my DataSource, PreparedStatement, and Connection to objects from the javax.sql.DataSource, java.sql.PreparedStatement, and java.sql.Connection, and the program is working.

I am still wondering though why I cannot use the ones that I was trying to before?
4 years ago