You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jerry Malcolm <te...@malcolms.com> on 2019/02/09 16:16:04 UTC

Eclipse/Tomcat/jdbc

Any idea what could cause 'jdbc' to not be found when running eclipse, 
but it is found when running outside eclipse?

I have a fully functional Tomcat 9.0 running fine with Windows 
services.  But when I define a Tomcat 9.0 server in Eclipse and start it 
up, the first time I need to access a datasource jdbc/abcxyz it fails 
saying jdbc can't be found.  I figure I'm doing something wrong in the 
config.  But I've tried clearing out eclipse and starting over many times.

Suggestions?

Thx.

Jerry


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Eclipse/Tomcat/jdbc

Posted by John Dale <jc...@gmail.com>.
It's been awhile since I used eclipse, so forgive my lack of
specificity.  I did run into this problem several times, though, when
I was using eclipse I'm sure of it.

Are you setting up a database connection pool?  You can define these
either in server.xml or in a separate context file.  I believe the
server.xml configuration will override the context file (correct me if
I'm wrong here, but I'm pretty certain one will override the other).

Depending on how you give eclipse control of your war assembly and
tomcat lifecycle, it may create a context file automatically for you,
which is somewhere in the eclipse project
configuration/settings/preferences.

From the command line, do a ps -aux | grep tomcat (or the equivalent
in windows if that's what you're into) and take a look at the startup
string for tomcat that is being used by eclipse.  I also recommend
examining the differences between your stand alone "working"
deployment startup string and the eclipse startup string.  Eclipse
might be creating an entirely new deployment configuration tree and
pointing to your tomcat installation for its base files, and copying
an entirely new set of configuration files to the new tomcat
deployment tree.  This is useful for bringing up multiple instances of
Tomcat in a cluster, but does get annoying and confusing sometimes for
development.

More information about the error, and information about the startup
commands for tomcat would help me advise further.

Take a little time to straighten out which set(s) of files re driving
tomcat, and one final word to the wise .. make sure you aren't
pointing to another older/stale war file that is deploying
successfully.  THAT is annoying!  ;)

John


On 2/9/19, Jerry Malcolm <te...@malcolms.com> wrote:
> John,
>
> Specifically what "jdbc configuration" am I looking for?  I see all the
> replicated config files in the eclipse workspace plus the metadata
> folder, etc.  But I don't really define 'jdbc' explicitly in native
> tomcat (At least I don't think I do).  So I'm not sure what should be
> replicated that's possibly not.   What config file paths, etc I'm
> looking for?  I looked at the Tomcat logs in the Eclipse console.  No
> mention of JDBC other than the exception.  Is there a bit more detail on
> what to look for?
>
> Thanks.
>
> Jerry
>
> On 2/9/2019 11:08 AM, John Dale wrote:
>> Eclipse creates its own set of deployment metadata .. likely your jdbc
>> configuration is not being replicated there.  In the tomcat logs, you
>> can usually find some file paths that give a clue as to the deployment
>> information being used .. in eclipse, I would guess they are machine
>> generated paths that will surprise you.
>>
>>
>> On 2/9/19, Arjuna Bandara <ar...@gmail.com> wrote:
>>> Jerry,
>>>
>>> Are you running Maven project?
>>>
>>> Could you send error msg?
>>>
>>> Regards,
>>>
>>> Arjuna
>>>
>>> On Sat, 9 Feb 2019 9:46 pm Jerry Malcolm, <te...@malcolms.com>
>>> wrote:
>>>
>>>> Any idea what could cause 'jdbc' to not be found when running eclipse,
>>>> but it is found when running outside eclipse?
>>>>
>>>> I have a fully functional Tomcat 9.0 running fine with Windows
>>>> services.  But when I define a Tomcat 9.0 server in Eclipse and start
>>>> it
>>>> up, the first time I need to access a datasource jdbc/abcxyz it fails
>>>> saying jdbc can't be found.  I figure I'm doing something wrong in the
>>>> config.  But I've tried clearing out eclipse and starting over many
>>>> times.
>>>>
>>>> Suggestions?
>>>>
>>>> Thx.
>>>>
>>>> Jerry
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>
>>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Eclipse/Tomcat/jdbc

Posted by John Dale <jc...@gmail.com>.
Bravo!  Good work.

John


On 2/9/19, Jerry Malcolm <te...@malcolms.com> wrote:
> John,
>
> Update.... I went into the eclipse server definition and changed "Use
> Workspace Metadata" to "Use Tomcat Installation" and it finally works.
> This validates your assumption that some config item was not being
> replicated.  But I still would like to know what it is that's missing.
> I guess I had my old server def set to "use tomcat installation" when it
> was working and somehow changed it for some reason, which would explain
> why it started failing. But it is pretty clear now that Eclipse didn't
> replicate everything required to use the metadata.  Any idea what might
> be missing?  I guess I might need to move this discussion over to
> Eclipse now.
>
> Thanks for the suggestions.
>
> Jerry
>
> On 2/9/2019 11:23 AM, Jerry Malcolm wrote:
>> John,
>>
>> Specifically what "jdbc configuration" am I looking for?  I see all
>> the replicated config files in the eclipse workspace plus the metadata
>> folder, etc.  But I don't really define 'jdbc' explicitly in native
>> tomcat (At least I don't think I do).  So I'm not sure what should be
>> replicated that's possibly not.   What config file paths, etc I'm
>> looking for?  I looked at the Tomcat logs in the Eclipse console.  No
>> mention of JDBC other than the exception.  Is there a bit more detail
>> on what to look for?
>>
>> Thanks.
>>
>> Jerry
>>
>> On 2/9/2019 11:08 AM, John Dale wrote:
>>> Eclipse creates its own set of deployment metadata .. likely your jdbc
>>> configuration is not being replicated there.  In the tomcat logs, you
>>> can usually find some file paths that give a clue as to the deployment
>>> information being used .. in eclipse, I would guess they are machine
>>> generated paths that will surprise you.
>>>
>>>
>>> On 2/9/19, Arjuna Bandara <ar...@gmail.com> wrote:
>>>> Jerry,
>>>>
>>>> Are you running Maven project?
>>>>
>>>> Could you send error msg?
>>>>
>>>> Regards,
>>>>
>>>> Arjuna
>>>>
>>>> On Sat, 9 Feb 2019 9:46 pm Jerry Malcolm, <te...@malcolms.com>
>>>> wrote:
>>>>
>>>>> Any idea what could cause 'jdbc' to not be found when running eclipse,
>>>>> but it is found when running outside eclipse?
>>>>>
>>>>> I have a fully functional Tomcat 9.0 running fine with Windows
>>>>> services.  But when I define a Tomcat 9.0 server in Eclipse and
>>>>> start it
>>>>> up, the first time I need to access a datasource jdbc/abcxyz it fails
>>>>> saying jdbc can't be found.  I figure I'm doing something wrong in the
>>>>> config.  But I've tried clearing out eclipse and starting over many
>>>>> times.
>>>>>
>>>>> Suggestions?
>>>>>
>>>>> Thx.
>>>>>
>>>>> Jerry
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>>
>>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Eclipse/Tomcat/jdbc

Posted by Jerry Malcolm <te...@malcolms.com>.
John,

Update.... I went into the eclipse server definition and changed "Use 
Workspace Metadata" to "Use Tomcat Installation" and it finally works.  
This validates your assumption that some config item was not being 
replicated.  But I still would like to know what it is that's missing.  
I guess I had my old server def set to "use tomcat installation" when it 
was working and somehow changed it for some reason, which would explain 
why it started failing. But it is pretty clear now that Eclipse didn't 
replicate everything required to use the metadata.  Any idea what might 
be missing?  I guess I might need to move this discussion over to 
Eclipse now.

Thanks for the suggestions.

Jerry

On 2/9/2019 11:23 AM, Jerry Malcolm wrote:
> John,
>
> Specifically what "jdbc configuration" am I looking for?  I see all 
> the replicated config files in the eclipse workspace plus the metadata 
> folder, etc.  But I don't really define 'jdbc' explicitly in native 
> tomcat (At least I don't think I do).  So I'm not sure what should be 
> replicated that's possibly not.   What config file paths, etc I'm 
> looking for?  I looked at the Tomcat logs in the Eclipse console.  No 
> mention of JDBC other than the exception.  Is there a bit more detail 
> on what to look for?
>
> Thanks.
>
> Jerry
>
> On 2/9/2019 11:08 AM, John Dale wrote:
>> Eclipse creates its own set of deployment metadata .. likely your jdbc
>> configuration is not being replicated there.  In the tomcat logs, you
>> can usually find some file paths that give a clue as to the deployment
>> information being used .. in eclipse, I would guess they are machine
>> generated paths that will surprise you.
>>
>>
>> On 2/9/19, Arjuna Bandara <ar...@gmail.com> wrote:
>>> Jerry,
>>>
>>> Are you running Maven project?
>>>
>>> Could you send error msg?
>>>
>>> Regards,
>>>
>>> Arjuna
>>>
>>> On Sat, 9 Feb 2019 9:46 pm Jerry Malcolm, <te...@malcolms.com> 
>>> wrote:
>>>
>>>> Any idea what could cause 'jdbc' to not be found when running eclipse,
>>>> but it is found when running outside eclipse?
>>>>
>>>> I have a fully functional Tomcat 9.0 running fine with Windows
>>>> services.  But when I define a Tomcat 9.0 server in Eclipse and 
>>>> start it
>>>> up, the first time I need to access a datasource jdbc/abcxyz it fails
>>>> saying jdbc can't be found.  I figure I'm doing something wrong in the
>>>> config.  But I've tried clearing out eclipse and starting over many
>>>> times.
>>>>
>>>> Suggestions?
>>>>
>>>> Thx.
>>>>
>>>> Jerry
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>
>>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Eclipse/Tomcat/jdbc

Posted by Jerry Malcolm <te...@malcolms.com>.
John,

Specifically what "jdbc configuration" am I looking for?  I see all the 
replicated config files in the eclipse workspace plus the metadata 
folder, etc.  But I don't really define 'jdbc' explicitly in native 
tomcat (At least I don't think I do).  So I'm not sure what should be 
replicated that's possibly not.   What config file paths, etc I'm 
looking for?  I looked at the Tomcat logs in the Eclipse console.  No 
mention of JDBC other than the exception.  Is there a bit more detail on 
what to look for?

Thanks.

Jerry

On 2/9/2019 11:08 AM, John Dale wrote:
> Eclipse creates its own set of deployment metadata .. likely your jdbc
> configuration is not being replicated there.  In the tomcat logs, you
> can usually find some file paths that give a clue as to the deployment
> information being used .. in eclipse, I would guess they are machine
> generated paths that will surprise you.
>
>
> On 2/9/19, Arjuna Bandara <ar...@gmail.com> wrote:
>> Jerry,
>>
>> Are you running Maven project?
>>
>> Could you send error msg?
>>
>> Regards,
>>
>> Arjuna
>>
>> On Sat, 9 Feb 2019 9:46 pm Jerry Malcolm, <te...@malcolms.com> wrote:
>>
>>> Any idea what could cause 'jdbc' to not be found when running eclipse,
>>> but it is found when running outside eclipse?
>>>
>>> I have a fully functional Tomcat 9.0 running fine with Windows
>>> services.  But when I define a Tomcat 9.0 server in Eclipse and start it
>>> up, the first time I need to access a datasource jdbc/abcxyz it fails
>>> saying jdbc can't be found.  I figure I'm doing something wrong in the
>>> config.  But I've tried clearing out eclipse and starting over many
>>> times.
>>>
>>> Suggestions?
>>>
>>> Thx.
>>>
>>> Jerry
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Eclipse/Tomcat/jdbc

Posted by John Dale <jc...@gmail.com>.
Eclipse creates its own set of deployment metadata .. likely your jdbc
configuration is not being replicated there.  In the tomcat logs, you
can usually find some file paths that give a clue as to the deployment
information being used .. in eclipse, I would guess they are machine
generated paths that will surprise you.


On 2/9/19, Arjuna Bandara <ar...@gmail.com> wrote:
> Jerry,
>
> Are you running Maven project?
>
> Could you send error msg?
>
> Regards,
>
> Arjuna
>
> On Sat, 9 Feb 2019 9:46 pm Jerry Malcolm, <te...@malcolms.com> wrote:
>
>> Any idea what could cause 'jdbc' to not be found when running eclipse,
>> but it is found when running outside eclipse?
>>
>> I have a fully functional Tomcat 9.0 running fine with Windows
>> services.  But when I define a Tomcat 9.0 server in Eclipse and start it
>> up, the first time I need to access a datasource jdbc/abcxyz it fails
>> saying jdbc can't be found.  I figure I'm doing something wrong in the
>> config.  But I've tried clearing out eclipse and starting over many
>> times.
>>
>> Suggestions?
>>
>> Thx.
>>
>> Jerry
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Eclipse/Tomcat/jdbc

Posted by Jerry Malcolm <te...@malcolms.com>.
Arjuna,

It's not maven.  It's a simple WAR file project.  Actually several 
virtual hosts with several WAR files per host.  I don't build in 
Eclipse.  I simply reference the source tree.  Everything is deployed in 
Tomcat and running fine standalone.

I decided to start from scratch and reinstalled the latest TC (9.0.14 I 
think).  I copied my server.xml and my Catalina virtual host folders.  
Started it up with Windows services.  Ran perfectly.  Created a new 
eclipse workspace, defined the server. It started up fine.  But again... 
no jdbc.

I had this all working a month ago, which is the frustrating thing.   
But startup was taking forever.  So I removed a few unused virtual 
hosts, and I updated the jarsToScan/jarsToSkip in Catalina.properties.  
It started failing after that.  But note that I did NOT make the changed 
to Catalina properties in the reinstall.   The frustrating part is that 
whatever I did to cause this, it doesn't fail when running standalone.  
Only in Eclipse. And I can't find anything in my server.xml or my 
virtual host files in Catalina that looks wrong  (And if it is wrong, 
wouldn't native TC flag it as well?)

Is there some step I'm missing in Eclipse to 'define' JDBC access for a 
server? (I'm not that proficient in Eclipse...)

javax.naming.NameNotFoundException: Name [jdbc/forklifts] is not bound 
in this Context. Unable to find [jdbc].
Feb 09, 2019 10:49:49 AM org.apache.jsp.jsp.guest.flcHome_jsp _jspService
SEVERE: java.lang.NullPointerException
java.lang.NullPointerException
     at jwm.db.DBTableObject.<init>(DBTableObject.java:75)
     at jwm.db.DBRecord.<init>(DBRecord.java:67)
     at jwm.servletdb.ServletRecord.<init>(ServletRecord.java:41)
     at jwm.entity.db.PersonDBRecordBase.<init>(PersonDBRecordBase.java:206)


On 2/9/2019 10:27 AM, Arjuna Bandara wrote:

> Jerry,
>
> Are you running Maven project?
>
> Could you send error msg?
>
> Regards,
>
> Arjuna
>
> On Sat, 9 Feb 2019 9:46 pm Jerry Malcolm, <te...@malcolms.com> wrote:
>
>> Any idea what could cause 'jdbc' to not be found when running eclipse,
>> but it is found when running outside eclipse?
>>
>> I have a fully functional Tomcat 9.0 running fine with Windows
>> services.  But when I define a Tomcat 9.0 server in Eclipse and start it
>> up, the first time I need to access a datasource jdbc/abcxyz it fails
>> saying jdbc can't be found.  I figure I'm doing something wrong in the
>> config.  But I've tried clearing out eclipse and starting over many times.
>>
>> Suggestions?
>>
>> Thx.
>>
>> Jerry
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Eclipse/Tomcat/jdbc

Posted by Arjuna Bandara <ar...@gmail.com>.
Jerry,

Are you running Maven project?

Could you send error msg?

Regards,

Arjuna

On Sat, 9 Feb 2019 9:46 pm Jerry Malcolm, <te...@malcolms.com> wrote:

> Any idea what could cause 'jdbc' to not be found when running eclipse,
> but it is found when running outside eclipse?
>
> I have a fully functional Tomcat 9.0 running fine with Windows
> services.  But when I define a Tomcat 9.0 server in Eclipse and start it
> up, the first time I need to access a datasource jdbc/abcxyz it fails
> saying jdbc can't be found.  I figure I'm doing something wrong in the
> config.  But I've tried clearing out eclipse and starting over many times.
>
> Suggestions?
>
> Thx.
>
> Jerry
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>