jetty - javax.naming.InvalidNameException: A flat name can only have a single component
Posted
by Dinesh Pillay
on Stack Overflow
See other posts from Stack Overflow
or by Dinesh Pillay
Published on 2010-06-16T03:35:24Z
Indexed on
2010/06/16
3:42 UTC
Read the original article
Hit count: 452
I have been breaking my head against this for too much time now. I'm trying to get maven + jetty + jotm to play nice but it looks like its too much to ask for :(
Below is my jetty.xml:-
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN"
"http://www.eclipse.org/jetty/configure.dtd">
<Configure id="Server" class="org.mortbay.jetty.Server">
<New id="jotm" class="org.objectweb.jotm.Jotm">
<Arg type="boolean">true</Arg>
<Arg type="boolean">false</Arg>
<Call id="tm" name="getTransactionManager" />
<Call id="ut" name="getUserTransaction" />
</New>
<New class="org.mortbay.jetty.plus.naming.Resource">
<Arg />
<Arg>javax.transaction.TransactionManager</Arg>
<Arg><Ref id="ut" /></Arg>
</New>
<New id="tx" class="org.mortbay.jetty.plus.naming.Transaction">
<Arg><Ref id="ut" /></Arg>
</New>
<New class="org.mortbay.jetty.plus.naming.Resource">
<Arg>myxadatasource</Arg>
<Arg>
<New id="myxadatasourceA" class="org.enhydra.jdbc.standard.StandardXADataSource">
<Set name="DriverName">org.apache.derby.jdbc.EmbeddedDriver</Set>
<Set name="Url">jdbc:derby:protodb;create=true</Set>
<Set name="User"></Set>
<Set name="Password"></Set>
<Set name="transactionManager">
<Ref id="tm" />
</Set>
</New>
</Arg>
</New>
<New id="protodb" class="org.mortbay.jetty.plus.naming.Resource">
<Arg>jdbc/protodb</Arg>
<Arg>
<New class="org.enhydra.jdbc.pool.StandardXAPoolDataSource">
<Arg>
<Ref id="myxadatasourceA" />
</Arg>
<Set name="DataSourceName">myxadatasource</Set>
</New>
</Arg>
</New>
And this is the maven plugin configuration:-
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<configuration>
<scanIntervalSeconds>10</scanIntervalSeconds>
<stopKey>ps</stopKey>
<stopPort>7777</stopPort>
<webAppConfig>
<contextPath>/ps</contextPath>
</webAppConfig>
<connectors>
<connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
<port>7070</port>
<maxIdleTime>60000</maxIdleTime>
</connector>
</connectors>
<jettyConfig>src/main/webapp/WEB-INF/jetty.xml</jettyConfig>
</configuration>
<executions>
<execution>
<id>start-jetty</id>
<phase>pre-integration-test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<scanIntervalSeconds>0</scanIntervalSeconds>
<daemon>true</daemon>
</configuration>
</execution>
<execution>
<id>stop-jetty</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>10.6.1.0</version>
</dependency>
<dependency>
<groupId>jotm</groupId>
<artifactId>jotm</artifactId>
<version>2.0.10</version>
<exclusions>
<exclusion>
<groupId>javax.resource</groupId>
<artifactId>connector</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.experlog</groupId>
<artifactId>xapool</artifactId>
<version>1.5.0</version>
</dependency>
<dependency>
<groupId>javax.resource</groupId>
<artifactId>connector-api</artifactId>
<version>1.5</version>
</dependency>
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
<version>1.0.1B</version>
</dependency>
<!-- <dependency>
<groupId>javax.jts</groupId>
<artifactId>jts</artifactId>
<version>1.0</version>
</dependency>
-->
</dependencies>
</plugin>
I am using maven-jetty-plugin-6.1.24 cause I couldn't get the later one's to work either.
When I execute this I get the following exception:-
2010-06-16 09:03:13.423:WARN::Config error at javax.transaction.TransactionManager java.lang.reflect.InvocationTargetException [INFO] ------------------------------------------------------------------------ [ERROR] BUILD ERROR [INFO] ------------------------------------------------------------------------ [INFO] Failure
A flat name can only have a single component
[INFO] ------------------------------------------------------------------------
Caused by: javax.naming.InvalidNameException: A flat name can only have a single component
at javax.naming.NameImpl.addAll(NameImpl.java:621)
at javax.naming.CompoundName.addAll(CompoundName.java:442)
at
org.mortbay.jetty.plus.naming.NamingEntryUtil.makeNamingEntryName(NamingEntryUtil.java:136)
at org.mortbay.jetty.plus.naming.NamingEntry.save(NamingEntry.java:196)
at org.mortbay.jetty.plus.naming.NamingEntry.(NamingEntry.java:58)
at org.mortbay.jetty.plus.naming.Resource.(Resource.java:34)
... 31 more
Help!
© Stack Overflow or respective owner