« Back to General Discussion - All Versions

RE: 2nd try - URGENT - Email JNDI Setup

Combination View Flat View Tree View
Threads [ Previous | Next ]
Hi,
Can anyone point me to a document or help me with setting up the JNDI for the CVP Email element? I've seen several examples of the database element config but nothing for email.
Thanks
 
BTW this is for CVP 7.0(2) so the KB article http://kb.audiumcentral.com/questions/197/How-to-create-a-JNDI-email-connection-in-Tomcat-for-use-in-Audium-applications no longer works for Tomcat 5.5
 

I love these new Forums. No replies. Thank goodness for Google.
 
I've found the problem. My config was OK. The problem is a Tomcat Bug. Anybody else trying to use the email element with CVP 7.0(2) is going to have problems. There is a bug in Tomcat 5.5(20) and later; (23) is shipped with CVP 7.0. See https://issues.apache.org/bugzilla/show_bug.cgi?id=40668
The Mail Session class files are NOT present in the naming-factory.jar file after 5.5(17).
To fix the issue you need to download the 5.5(17) version http://archive.apache.org/dist/tomcat/tomcat-5/v5.5.17/bin/apache-tomcat-5.5.17.zip and copy the 'naming-session.jar' file to the Tomcat/common/lib file. You will need to stop tomcat and rename the old file first.
 
Cheers

I agree, it would be great if more people (including Cisco personnel)
would weigh in and share their knowledge.

Can you post the configuration that you put into the server.xml to
configure email?
I'd love to have that to share with my students.

Thanks, Janine

Cisco Developer Community Forums wrote:
> Bruce Johnson has created a new message in the forum "General
> Discussion - All Versions":
>
> --------------------------------------------------------------
> I love these new Forums. No replies. Thank goodness for Google.
> Â
> I've found the problem. My config was OK. The problem is a Tomcat Bug.
> Anybody else trying to use the email element with CVP 7.0(2) is
> going to have problems. There is a bug in Tomcat 5.5(20) and later;
> (23) is shipped with CVP 7.0. See
> https://issues.apache.org/bugzilla/show_bug.cgi?id=40668
> The Mail Session class files are NOT present in the naming-factory.jar
> file after 5.5(17).
> To fix the issue you need to download the 5.5(17) version
> http://archive.apache.org/dist/tomcat/tomcat-5/v5.5.17/bin/apache-tomcat-5.5.17.zip and
> copy the 'naming-session.jar' file to the Tomcat/common/lib file. You
> will need to stop tomcat and rename the old file first.
> Â
> Cheers
> --
> To respond to this post, please click the following link:
>
> <http://developer.cisco.com/web/cvp/forums/-/message_boards/message/1146853>
>
> or simply reply to this email.

OK but excuse my poor programing knowledge and skills.
There are two ways to configure the Resources. The first is to define them in the server.xml as <GlobalNamingResources> and then include 'Resource Links' in the Context.xml file or, just define the 'Resource names' in the Context.xml file and not touch the server.xml file. This later method seems to be what is now recommended for Tomcat 5.5. I have an open question on this discussion forum to try to determine which method should be used and what the pros and cons of each are. Been no takers as yet though.
 
So, as an example. defining both a MySQL database and an email JNDI.
1st Method (Defining Global Naming Resources and Resource Links)
 
Server.xml
 
<!-- Global JNDI resources -->
  <GlobalNamingResources>
 
   <Resource name="jdbc/TestDB"
     auth="Container"
     type="javax.sql.DataSource"
     factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
     driverClassName="com.mysql.jdbc.Driver"
     url="jdbc:mysql://localhost:3306/accttest1?autoReconnect=true"
     username="bruce"
     password="bruce"
     maxActive="20"
     maxIdle="10"
     poolPreparedStatements="true"/>
 
   <Resource name="mail/TestMail"
     auth="Container"
     type="javax.mail.Session"
     mail.smtp.host="your SMTP Server"/>
 
  </GlobalNamingResources>
 
Context.xml
 
<!-- The contents of this file will be loaded for each web application -->
<Context>
    <!-- Default set of monitored resources -->
    <WatchedResource>WEB-INF/web.xml</WatchedResource>
           <Manager pathname="" />
 
  <ResourceLink global="jdbc/TestDB" name="jdbc/TestDB" type="javax.sql.DataSource"/>
 
  <ResourceLink global="mail/TestMail" name="mail/TestMail" type="javax.mail.Session"/>             
</Context>
 
2nd method (Just defining the resource names in the Context.xml file
 
<Context>
<Resource name="jdbc/TestDB" auth="Container" type="javax.sql.DataSource"
          maxActive="100" maxIdle="30" maxWait="10000"
          username="bruce" password="bruce" driverClassName="com.mysql.jdbc.Driver"
          url="jdbc:mysql://localhost:3306/accttest1?autoReconnect=true"/>
 
<Resource name="mail/TestMail" auth="Container" type="javax.mail.Session"                                  
          mail.smtp.host="your SMTP server"/>
 
</Context>
 
Thanks

Bruce thanks a lot for sharing, i also shared the configuration of server.xml that allows the connection between VXML server and an access database. i hope others will share their knowlegde as well.
 
Cheers,

I'd like to note that this error still exists in CVP 8.5. The download link Bruce provided has the proper naming-factory.jar in it.

Also, to help Googlers out, the error I was receiving is:

A built-in element encountered an exception of type com.audium.server.AudiumException. The error was: There was a problem looking up the JNDI data source 'myEmail'. The root cause was: javax.naming.NameNotFoundException: Name myEmail is not bound in this Context