Mantis - Resin
Viewing Issue Advanced Details
5024 minor always 04-06-12 15:02 06-21-12 15:59
rickHigh  
ferg  
normal  
closed  
fixed  
none    
none 4.0.29  
0005024: EC2 CONFIG DEPLOY: Problems using MySQL @Inject DataSource with config-deploy
EC2 CONFIG DEPLOY: Problems using MySQL @Inject DataSource with config-deploy.

The deployment does not show up in the JMX tab of the resin-admin.

The error is as follows:

500 Servlet Exception

javax.enterprise.inject.UnsatisfiedResolutionException: example.BlogServlet.database:
Can't find a bean for 'interface javax.sql.DataSource' because no beans
implementing that class have been registered with the injection manager
InjectManager[web-app:production/webapp/default/blog].

Resin/4.0.27 Server: 'app-0'

This was in the log:


[12-04-06 14:44:00.783] {resin-port-8080-47} WebApp[production/webapp/default/blog] fail
[12-04-06 14:44:00.784] {resin-port-8080-47} javax.enterprise.inject.UnsatisfiedResolutionException: example.BlogServlet.database: Can't find a bean for 'interface javax.sql.DataSource' because no beans implementing that class have been registered with the injection manager InjectManager[web-app:production/webapp/default/blog].
[12-04-06 14:44:00.785] {resin-port-8080-47} javax.enterprise.inject.UnsatisfiedResolutionException: example.BlogServlet.database: Can't find a bean for 'interface javax.sql.DataSource' because no beans implementing that class have been registered with the injection manager InjectManager[web-app:production/webapp/default/blog].

FROM RESIN-ADMIN

ConnectionPool
resin:Host=default,WebApp=/resin-doc,name=jdbc/resin,type=ConnectionPool
Database
resin:Host=default,WebApp=/resin-doc,name=jdbc/resin,type=Database
JdbcDriver
resin:Host=default,WebApp=/resin-doc,name=jdbc/resin,type=JdbcDriver,url="jdbc:resin:/var/www/doc/resin-doc/WEB-INF/db"

It is missing from JMX.

The deploy looks like it is working as follows:

To verify that our deploy worked, lets run resinctl config-ls, and resinctl config-cat:



$ resinctl config-ls

Output:
resin-inf/blog-db/blog-database-conf.xml
resin-inf/blog-db/lib/mysql-connector-java-5.1.19-bin.jar

$ resinctl config-cat resin-inf/blog-db/blog-database-conf.xml

Output:
<resin xmlns="http://caucho.com/ns/resin" [^]
      xmlns:resin="urn:java:com.caucho.resin">

<database jndi-name="jdbc/blogdb">
        <driver type="com.mysql.jdbc.Driver">
                 <url>jdbc:mysql://localhost:3306/blogdb</url> [^]
                 <user>bloguser</user>
                 <password>roofoo</password>
         </driver>
</database>

</resin>


$ ls /var/www/resin-data/app-0/config/resin-inf/blog-db/
blog-database-conf.xml lib



$ ls /var/www/resin-data/app-0/config/resin-inf/blog-db/lib
mysql-connector-java-5.1.19-bin.jar


$ ls /var/www/resin-data/app-0/config/resin-inf/blog-db/blog-database-conf.xml
/var/www/resin-data/app-0/config/resin-inf/blog-db/blog-database-conf.xml
rick@ubuntu:~$ cat /var/www/resin-data/app-0/config/resin-inf/blog-db/blog-database-conf.xml
<resin xmlns="http://caucho.com/ns/resin" [^]
      xmlns:resin="urn:java:com.caucho.resin">

<database jndi-name="jdbc/blogdb">
        <driver type="com.mysql.jdbc.Driver">
                 <url>jdbc:mysql://localhost:3306/blogdb</url> [^]
                 <user>bloguser</user>
                 <password>roofoo</password>
         </driver>
</database>

</resin>

Notes
(0005737)
rickHigh   
04-06-12 15:07   
MySQL should load because of
ls /var/www/resin-data/app-0/config/resin-inf/blog-db/lib
is under cloud:/resin-inf

cloud:/resin-inf = /var/www/resin-data/app-0/config/resin-inf/

I think...


  <class-loader>
    <tree-loader path="${resin.root}/ext-lib"/>
    <tree-loader path="${resin.root}/resin-inf"/>
    <tree-loader path="cloud:/resin-inf"/>
  </class-loader>
(0005738)
rickHigh   
04-06-12 15:12   
I tried to move it based on

$ resinctl config-ls
app-inf/blog-db/blog-database-conf.xml
app-inf/blog-db/lib/mysql-connector-java-5.1.19-bin.jar

It seems like this is not working either....

   <!-- shared jars and drivers for the app-tier -->
    <class-loader>
      <tree-loader path="${resin.root}/${cluster.id}-inf"/>
      <tree-loader path="cloud:/{cluster.id}-inf"/>
    </class-loader>

    <!-- include resources config files in resources/ -->
    <resin:import fileset="${__DIR__}/${cluster.id}-inf/**/*.xml"/>
    <resin:import fileset="cloud:/${cluster.id}-inf/**/*.xml"
                  recover="true"/>
(0005739)
rickHigh   
04-06-12 18:46   
I got it to deploy with including the jar in the war (WEB-INF/lib) and creating a resin-web.xml file with the configured driver.

This works....

<web-app xmlns="http://caucho.com/ns/resin"> [^]

<database jndi-name="jdbc/blogdb">
        <driver type="com.mysql.jdbc.Driver">
                 <url>jdbc:mysql://localhost:3306/blogdb</url> [^]
                 <user>bloguser</user>
                 <password>roofoo</password>
         </driver>
</database>

</web-app>

With this:



@WebServlet("/blog")
public class BlogServlet extends HttpServlet {

    @Inject
    @Named("jdbc/blogdb")
    private DataSource database;

Now I am going to retrace my steps and see if I can get it to work with config-deploy
(0005929)
ferg   
06-21-12 15:59   
See 0005004