[jboss-user] [JBoss Seam] - MSSQL Integration with SEAM/Tomcat 5.5

juergenmelzer do-not-reply at jboss.com
Mon Aug 20 09:34:14 EDT 2007


Hi there everyone,

I tried my helloworld example from Michael Yuan's book, which does work under Tomcat 5.5 and HSQL-DB, to configure for MS SQL Server.

Im am working with Seam 1.2.1.GA.

My MS SQL Server driver is the current driver from Microsoft (sqljdbc.jar)  for MSSQL 2000/2005 and used to work pretty well. I copied that file to the WEB-INF/lib directory.

Since DB Configuration takes place in the jboss-beans*.xml files, I changed my jboss-beans.xml to the following:

<?xml version="1.0" encoding="UTF-8"?>

<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
            xmlns="urn:jboss:bean-deployer">
  
   
      com.microsoft.sqlserver.jdbc.SQLServerDriver
      jdbc:sqlserver://localhost:1433;databaseName=tomcatejb3;user=sa;password=sa;
      sa
      sa
      java:/DefaultDS
      0
      10
      1000
      100000
      
      
      
   
   
   
        
            
        
   



================================================
My persistence.xml looks like this:


   <persistence-unit name="helloworld">
      org.hibernate.ejb.HibernatePersistence
      <jta-data-source>java:/DefaultDS</jta-data-source>
      
         
         
         
         
         
         
         
      
   </persistence-unit>
 

================================================
Im am using a very easy facelets page, named test.jspx:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" 
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:s="http://jboss.com/products/seam/taglib"
	version="2.0">

<ui:composition>



 





	<h:inputText value="#{test.text}"></h:inputText>





</ui:composition>
</jsp:root>

================================================
This page uses an Controller (testimpl.java) class, which looks like that:

import static javax.persistence.PersistenceContextType.EXTENDED;

import javax.ejb.Remove;
import javax.ejb.Stateful;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.jboss.seam.annotations.Destroy;
import org.jboss.seam.annotations.Name;


@Stateful
@Name("test")
public class testimpl implements test {

	String text;
	
	@PersistenceContext (type=EXTENDED)
	private EntityManager em;
	
	public String getText()
	{
		String s;
		s = (String)em.createQuery("select MIN(p.name) from Person p").getSingleResult();
		//s = "test";
		return s;
	}
	

	@Remove @Destroy
    public void destroy() {}
}

================================================
This class ist derived from the interface test.java:
import javax.ejb.Local;

@Local
public interface test
{
	public String getText();
	public void destroy ();
}

================================================
When I try that, I receive following message: 
org.jboss.seam.InstantiationException: Could not instantiate Seam component: test

Complete trace:
SCHWERWIEGEND: Error Rendering View[/test.jspx]
org.jboss.seam.InstantiationException: Could not instantiate Seam component: test
	at org.jboss.seam.Component.newInstance(Component.java:1740)
	at org.jboss.seam.Component.getInstance(Component.java:1643)
	at org.jboss.seam.Component.getInstance(Component.java:1610)
	at org.jboss.seam.jsf.SeamVariableResolver.resolveVariable(SeamVariableResolver.java:53)
	at com.sun.faces.el.VariableResolverChainWrapper.getValue(VariableResolverChainWrapper.java:100)
	at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:135)
	at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:64)
	at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:65)
	at com.sun.el.parser.AstValue.getValue(AstValue.java:106)
	at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:192)
	at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
	at javax.faces.component.UIOutput.getValue(UIOutput.java:173)
	at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:189)
	at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:320)
	at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:200)
	at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:829)
	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:894)
	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:890)
	at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:571)
	at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
	at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:248)
	at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
	at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:63)
	at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
	at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
	at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:60)
	at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
	at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
	at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
	at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:79)
	at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
	at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
	at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
	at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
	at java.lang.Thread.run(Thread.java:619)
Caused by: javax.naming.NameNotFoundException: testimpl not bound
	at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
	at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
	at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
	at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
	at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:626)
	at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:588)
	at javax.naming.InitialContext.lookup(InitialContext.java:392)
	at org.jboss.seam.Component.instantiateSessionBean(Component.java:1107)
	at org.jboss.seam.Component.instantiate(Component.java:1093)
	at org.jboss.seam.Component.newInstance(Component.java:1736)
	... 48 more

================================================
I really had a hard time finding out how to configure my seam application for Tomcat/MSSQL and never got it to run.

I really appreciate any help on that issue.

I right now need to get a project going, this is just the beginning...
So I need to find the missing puzzle asap.

Thanks for everything,


J. Melzer


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4075849#4075849

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4075849



More information about the jboss-user mailing list