Win a copy of High Performance Python for Data Analytics this week in the Python forum!

Travis Prescott

Greenhorn
+ Follow
since Sep 05, 2009
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Travis Prescott

Peter, good advise...I was headed in that direction but our decision has not been made to use Maven so I was waiting on that while still experimenting with some of our tools. Do you have any advise if the other groups decided against Maven?

Thanks,
Travis
One clarification to make clearer what I'm looking for...

I want to move to more of an enterprise approach. I am not looking to just dump a jar file in the web's lib directory & the xml file into the classpath of the build. I want to be able to treat the xml file as a resource and have the ability to manipulate it without recompiling and I'd like to avoid classloading issues by referring to a common version of the jar file. As I said, any advise you can give or information you can point me to would be much appreciated...
I'm setting up a template project for future all of our future projects to begin with...kind of a starting point that already has the tools necessary for our development architecture. I just realized that I have never had to set up Log4j in an enterprise project...it's always just "been there". I don't think I'll have difficulty with the build script building out the project. However, when it comes to setting up a tool like Log4j that will be used in java projects as well as web projects and potentially EJB projects, I don't really know where to store the Log4j.jar & Log4j.xml file so I that I don't have them laying around in every project. I am interested in the best practices strategy for tools that are shared among projects tied to an EAR project and any information you all think might be useful.

Thanks,
Travis
Thanks! That was the solution:



One thing to note...the above was (very) slightly quicker than the join...but mostly negligable.

Thanks for the response, Thillakan!

Travis
after further experimentation with this issue, I changed to the other suggestion of the "in" statement for the query. This gives me good data & eliminates a secondary query to load the collection (see the information below).

PROBLEM: I am still getting a List of objects back from my "from Song" query. What is Hibernate returning to me? I have never seen this before & am about out of ideas. I can't cast them to anything meaninful. What do I do?

Travis


Using this sql stmt:



I now get this sql stmt generated:



and it generates the following results:

here's the generated SQL:


If I comment out the query and do just a select * (see below) rather than the join, the query returns a List<Song> as a result. With the join, it returns a List<Object>. This makes no sense b/c they are both "...from Song...". Why is the return different? Also, I have toString() methods in all of my beans but when I just print the results out, it prints the Object reference ID rather than the toString() value...so it's not even returning my bean objects.


String hql = "from Song s join s.soundsLike sl where sl.soundsLikeSearchId = ?";
List result = getHibernateTemplate().find(hql, params);
//result is a List<Object> ... not List<Song> but returns the proper number of results

String hql = "from Song s where s.id = ?";
List result = getHibernateTemplate().find(hql, params);
//result is a List<Song>
it appears that my limitation is SQL...not hibernate ;-)

That worked - it's returning the correct number of objects too. The only problem is that the app is failing when I try to cast the returning List to List<Song>. After playing with it, it is definitely not a list of Song objects. When I debugged & did an object.getClass(), it tells me that it's actually an Object. How can this be? The query even indicates "from Song". I did try to cast it to other objects that I have mapped here (both the join table & the SoundsLike table) and they fail as well. Do you have any idea what's happening here?

Travis

I am trying to map a many to many relationship as below. A straight "select *" query works but when I try to limit the results I'm getting errors that are difficult to understand. In the example below, I'm attempting to get all of the Song objects that have a SoundsLike value with a particular soundsLikeSearchId. For the record, I get the same error if I were to attempt to filter on the SoundsLike.id value too. I've seen lots of documentation on the mapping but not much on the query. What is a good way to do this? I thought the way below was rational...is it not?

table definition for many-to-many relationship:
----------------------------------------------




hibernate mapping for tables:
----------------------------


fields in objects:
-----------------



ERROR:
-----

That's actually not the case.

I created a new project and moved all of the files over from the broken project and get it to work just fine. however, when I delete the project completely, remove it from the deploy area in jboss and recreate it with the old files it has errors again. I have no idea what's causing it but it's pretty irritating b/c there's nothing wrong with the work i've done but apparently there's something cached in some mysterious spot (in eclipse maybe?) that will now prevent me from using the project name.

This is weird...if anyone has seen anything like this, I'd be interested in understanding what's going on.

Thanks, Travis
11 years ago
An application that was working now will not deploy. I backed out the new stuff I was working on & reverted to the stuff that was working. Same error (see below). The message is not all that helpful but sounds to me like classpath/loading stuff. My classpath has not changed for this Struts/Spring/Hibernate app. Have you guys seen this? Where should I start looking?

11 years ago
Sorry for the newbie question...I discovered the lib directory in the deploy area. It works now.
11 years ago
How do we tell jboss what driver tool we're using. For example, I'm using connector j (mysql) and I define my xml file (above) to use the driver class from that jar file. However, I'm getting the below error indicating that it doesn't know this class...i'm sure it's b/c i am not putting this jar file in a place where jboss knows to look. How do I configure this? Note: this is the driver class i use when connecting using a tool like SQuirreL...so I think that it's valid...


12:10:06,890 WARN [JBossManagedConnectionPool] Throwable while attempting to get a new connection: null
org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (org.jboss.resource.JBossResourceException: Apparently wrong driver class specified for URL: class: org.gjt.mm.mysql.Driver, url: jdbc:mysql://localhost:3306/license)
at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:225)
at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:195)
at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:633)
at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:267)
at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:622)
at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:404)
at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:381)
at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:496)
at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:941)
at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:89)
at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:82)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:111)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2101)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1325)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:814)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:732)
at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1202)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1172)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:428)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:284)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:244)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:187)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3910)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4393)
at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:310)
at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:142)
at org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:461)
at org.jboss.web.deployers.WebModule.startModule(WebModule.java:118)
at org.jboss.web.deployers.WebModule.start(WebModule.java:97)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
at org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:206)
at $Proxy38.start(Unknown Source)
at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:42)
at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:37)
at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
at org.jboss.system.microcontainer.ServiceControllerContext.install(ServiceControllerContext.java:286)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
at org.jboss.system.ServiceController.doChange(ServiceController.java:688)
at org.jboss.system.ServiceController.start(ServiceController.java:460)
at org.jboss.system.deployers.ServiceDeployer.start(ServiceDeployer.java:163)
at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:99)
at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:46)
at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)
at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1178)
at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)
at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:702)
at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)
at org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:362)
at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:255)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(Unknown Source)
at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.jboss.resource.JBossResourceException: Apparently wrong driver class specified for URL: class: org.gjt.mm.mysql.Driver, url: jdbc:mysql://localhost:3306/license
at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.getDriver(LocalManagedConnectionFactory.java:492)
at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:206)
... 92 more

11 years ago
ok...when i deleted the original in the console app, i could never read the file again (in the console). as soon as i created one with a different name i could. anyway, that solved that one...thank you!
11 years ago

First time attempting to use jboss managed db connection. I'm using mysql (connector j driver) and referencing using Spring. I created the below datasource xml file...

mysql-ds.xml:



When I start the appserver and go to the admin-console, my datasource shows up...one interesting thing is that it shows the max connections as 20 (correct) but the connection count == 0...even though the min is supposed to be 5. Don't know if this is the problem...

I am referencing the datasource as follows in the spring config...

applicationContext.xml:



Here is my stack trace:


11 years ago